2 answers

★ Best answer

Feature-based structures tend to work better than technical layers in most cases, especially for larger projects. The reason is simple: when you need to touch a feature, all the relevant files are in one place instead of scattered across different "components" and "services" folders. So instead of having `/src/components/UserCard`, `/src/services/userService`, `/src/utils/userHelpers`, you bundle everything together under `/src/features/user/`. That makes navigation easier and reduces cognitive load while coding. Especially when multiple people are working on a project, you get fewer conflicts and confusion about "where should this actually go?".

Within your features, you can then build a consistent internal structure. Something like `/features/user/components`, `/features/user/hooks`, `/features/user/types`, `/features/user/utils` makes sense - here you have clear subcategories, but everything belongs together thematically. For really large modules, it's worth subdividing further into subfeatures. A practical example: your `/features/user` could be split into `/features/user/authentication`, `/features/user/profile`, `/features/user/settings`.

Things that span multiple features - shared utilities, global types, core services - you put in separate folders like `/shared`, `/lib`, or `/core`. That's really the exception, not the rule. The most important thing is actually just picking a structure and sticking with it consistently. What works best depends on the size and stack of your project, but feature-first is pretty much the standard in practice these days.

Start with feature-based organization, it scales way better than technical layers - each feature gets its own folder with all the associated components, services, and utils inside it. That way you'll find related code pieces faster later on and can delete or move entire features more easily without having to search around everywhere. You can still use technical layers like "utils" or "shared" for stuff that's truly project-wide, but most of it should be organized close to the feature.

Your answer

Log into answer.