Section 1 of 17
Why front-ends need an architecture
Contents
A front-end grows the same way every time. The first year there is one application and a src/app folder with components, services and store. By the third year the same project usually looks like this:
shared/holds three hundred files, and half of them are used by exactly one feature;- a component in billing imports a selector from maintenance because it was there;
- the root store has forty feature keys, and nobody knows which ones a page needs;
- a second application is created by copying the first one, because extracting code is too hard;
- one change to a date helper rebuilds and retests the whole repository;
- a new developer, or a coding agent, needs days to learn where a feature lives and what it may use.
None of this comes from bad engineers. It comes from the absence of a shared answer to two questions: where does this file go, and who may import whom. Without an answer the nearest folder wins, and the nearest folder is always shared/.
The architecture in this guide answers both questions once, for every kind of front-end code, and makes the answer mechanical: a lint rule rejects an import that crosses a line, in the editor and in CI.
1.1. Goals
- Findability. Knowing the name of a feature tells you its folder, in every application.
- Local changes. A change inside one domain cannot break another domain, because the other domain cannot see its internals.
- Fast feedback at scale. CI builds and tests only the libraries a change affects.
- Parallel teams. A team owns domains, not files scattered across
shared/. - Replaceable state. A feature does not know whether its data comes from NgRx, a Signal Store, a cache or the server.
- One rulebook for three frameworks. Angular, React and Vue applications in the same company follow the same structure, and framework-free code is shared between them.
1.2. Non-goals
- It does not choose your back-end, your design system or your CSS.
- It does not require micro front-ends. Everything here works in one deployable application; micro front-ends are a later, separate decision.
- It does not replace your product rules. It says where code lives and what it may use; your project says what the code must do.