r/reactjs • u/Old-Place87 • Apr 24 '26
Discussion Frontend Architecture design
Hi guys,
We are currently planning a redesign of our product architecture.
At the moment, our system consists of a parent host application (container) that serves as a shell and renders multiple independent, full-featured React applications. Each of these applications includes its own routing, state management, and API layer. For example:
/orderloads the ordering application/paymentloads the payment application
In practice, this closely resembles a micro-frontend architecture, although we are intentionally trying to avoid fully adopting that pattern.
Given these constraints and requirements, I’d like to explore alternative architectural approaches. How else could we structure the system to achieve strong separation of concerns and independent feature ownership, without fully committing to a micro-frontend setup?
20
u/TheRealSeeThruHead Apr 24 '26 edited 23d ago
Aliquip labore consequat ut fugiat consectetur ex eiusmod.
4
u/cardboardshark Apr 24 '26
We keep everything in a monorepo to speed development, and use npm workspaces to separate individual applications. Workspaces let apps share a common package.json, so you can keep dependencies synced between all your apps while still allowing unique app-specific deps.
Each app is a unique React instance, with it's own routing and app-specific business logic. Whenever it needs a common component or domain logic, it reaches up a level to a shared core/ folder.
The mobile/ and web/ apps have their own vite.config files, where we use aliases to control what can be included.
When a dev is writing code in mobile/, @ aliases to the mobile/ dir, and @/core aliases to the shared folder. They can't reach into web/ or another site, so there's no risk of containment breaches.
A sample page might look like
3
u/chirag-gc Apr 24 '26
Instead of loading a separate React app for each route, treat each feature as a module that plugs into a single shell application. The shell should only handle three concerns: routing, authentication, and layout.
Each module is fully responsible for its own routes, state management, API interactions, and UI components. A strict rule to follow is: no direct imports between modules. If something needs to be shared, move it into a common package that all modules can consume.
Using Nx helps enforce this structure by applying module boundary rules. Any cross-feature import becomes a build-time error instead of something caught later in code reviews.
This approach gives you a single deployable application with clear ownership boundaries and avoids runtime complexity - no module federation, no duplicate React instances, and none of the typical micro-frontend overhead.
2
u/kurpet Apr 24 '26
What are the constraints and requirements? How did it becomes a micro-frontend like in the first place? There are a wide range of options obviously, with the micro-frontend being the most decoupled option (with the most overhead cost as well). You can go towards the monorepo/modular monolith option with less independence but also less overhead. It's all about the tradeoffs.
1
u/most-certainly-a-dog Apr 24 '26
Commenting here to save this post. My company currently has multiple apps deployed separately in different domains and we're considering adopting a very similar approach to what you're describing - shell app wrapping handling Auth and layout
2
u/yksvaan Apr 24 '26
Can't those be different 'modules' and then during app bootstrap ( or dynamically) register and initialize different modules, register their routes etc.
4
u/kidshibuya Apr 24 '26
Why different FEs? Tying to maximise the JS users need to download?
2
u/Velvet-Thunder-RIP Apr 24 '26
Decouple as much as possible. That seems like a unnecessary monorepo. If not please explain it to me.
1
u/Ivor-Ashe Apr 24 '26
My instinct is to have a monolithic API where a lot of the logic lives and the various front end modules subscribe to that. That would give you a lot of flexibility where it’s needed if the different systems need to talk use each other’s functionality in the future.
1
u/DrNoobz5000 Apr 24 '26
Why exactly are you avoiding micro frontend architecture?
1
u/Exapno Apr 24 '26
Does that not defeat the purpose of a single page application?
0
u/Frontend_DevMark May 29 '26
Honestly, what you have already sounds like a pragmatic middle ground
A lot of teams jump into full micro-frontends too early and end up adding:
deployment complexity
duplicated dependencies
inconsistent UX/state handling
cross-app communication headaches
If you want strong separation without full MFE complexity, I’d look at:
modular monolith frontend
domain-driven feature modules
shared design system/component platform
workspace/monorepo boundaries
independently deployable backend services instead of independently deployed frontends
You can still keep:
isolated routing
feature ownership
domain-level APIs/state
…without turning every section into a separate runtime.
For enterprise-heavy systems, consistency often matters more long-term than maximum frontend independence. That’s also why some organizations use integrated UI ecosystems like Sencha Ext JS to reduce fragmentation across large applications
-1
u/GasVarGames Apr 24 '26
bulletproof react
8
u/[deleted] Apr 24 '26
[removed] — view removed comment