Frontend development has become much more complex in recent years: frameworks are multiplying, and performance, UX, and scalability requirements are increasing. In such circumstances, the architecture of the project ceases to be a "secondary issue" — it determines how quickly you can develop the product.
Below are the three most common mistakes that I have encountered in projects, and what can be done about them.
1. A "monolithic" frontend without modularity
Error: the entire application lives in the same code pile: the components access the store directly, the same imports are everywhere, and the business logic is scattered in random places.
Consequences:
- It is not possible to modify or test a separate module locally;
- New developers spend weeks "moving in";
- Bugs are "floating" all over the app.
What to do:
Implement modularity. Even if you don't use micro-frontends, divide the project into features and layers (feature-sliced design, domain-driven design, vertical slices). Let each feature store its components, styles, tests, and storages separately.
2. Mixing business logic and UI
Error: business rules (for example, access checks, calculations, validation) are written directly in the components.
// example of an anti-pattern
function CheckoutButton({ user }) {
if (!user || !user.cart || user.cart.length === 0) {
return null
}
return <button>Buy</button>
}
Effects:
- The component code grows and becomes difficult to maintain;
- Business rules cannot be reused (for example, on the server);
- It's difficult to test — you have to race the rendering.
What to do:
Put business logic in separate layers (services, hooks, use-cases). The component should be responsible only for the display, not for the rules of the product.
3. Ignoring State strategies
Error: "we throw everything into the global store" (Redux, Zustand, Vuex, etc.) or vice versa — we drag the state through props from parent to child until the tree turns into spaghetti.
Consequences:
- A store that is too large becomes a bottleneck;
- Performance drops due to unnecessary re-renderers;
- Changes are difficult to track and debug.
What to do:
Divide the state into levels:
- Local (UI details, modals, checkboxes);
- Contextual (the state of a group of components);
- Global (authentication, user settings).
Use the tools for their intended purpose, not "out of habit."
Conclusion
A good frontend architecture is not about the "right framework", but about clear boundaries between layers. The sooner you eliminate these three errors, the faster and more stable you will develop the product.
👉 What architectural pitfalls have you encountered in your projects? Share it in the comments — it will help others avoid the same problems.
Top comments (0)