To keep your code organized, you need to pick a methodology and sticking with it. One good example is the MVC pattern, where there are three different components for organizing an app's logic. These are model, view, and controller. You can use whichever methodology you want, depending on what kind of programming language you're using. For example, if you're writing in PHP, consider using namespaces or PSR-4 auto-loading conventions to organize your codebase.