Skip to content

React front-end architecture: Vite, Next, Astro, monorepos and micro-frontends

How each stack structures a React app, when to move to a monorepo or micro-frontends, and what is left of MVC, MVVM and clean architecture on the front end in 2026.

Ramon Gomes 17 min read Level: Intermediate

Also available in: Español, Français, Português

"How do you structure a React project?" has a different answer depending on the question behind it. Sometimes it's about folders. Sometimes it's about which framework to use. And sometimes it's about how five teams will work on the same product without stepping on each other's toes.

I've already written about the inside part, feature folders, Feature-Sliced Design and linting. This article covers the outside: the structure each stack imposes, when to move to a monorepoSingle repository that holds several related projects or packages, such as apps and shared libraries, with common versioning and tooling. or micro-frontendsSplitting a large interface into independent parts, each with its own team, repository and deploy, combined into one page for the user., and what is left of MVC, MVVM and clean architecture in React in 2026. This very site is an example of two of those layers: an Astro site with React islands, in a repository with the backend right next to it.

Tidy woodworking shop, with a pegboard on the wall where each tool hangs over the painted outline of its shape, drawers with blank labels and a person seen from behind hanging a hammer back in its place
Folder architecture is the painted outline on the wall: useless on day one, and essential once five people share the shop.

The Starting Point Changed: Goodbye, Create React App

On February 14, 2025, the React team announced: "we're deprecating Create React App for new apps", recommending a move to a framework or to "a build tool like Vite, Parcel, or RSBuild" (React, 2025). CRA still works in maintenance mode, but a new app built with it starts life with a deprecation warning.

The current docs are blunt: "If you want to build a new app or website with React, we recommend starting with a framework". The recommended ones are Next.js (App Router), React Router and Expo, with TanStack Start and RedwoodSDK as up-and-coming frameworks (react.dev). They also make a point that takes apart a common myth: "Full-stack frameworks do not require a server". You can export a static site.

Building from scratch, with Vite, is for when no framework fits, you want to build your own, or you're learning (react.dev). The current stable versions are React 19.3, Vite 8, Next.js 16, Astro 7 and React Router 8.

Four folder trees side by side: React with Vite, with index.html at the root and src holding main.tsx, App.tsx, features and shared; Next.js App Router, with app, layout, a store group, a private components folder, an API route, features and proxy.ts; Astro with React, with src/pages, components and layouts; and React Router in framework mode, with app, root.tsx, routes.ts and the routes folder
The same store in four stacks. What changes is who owns the outer structure: you, the app folder, the pages folder or the routes.ts file.

Plain React with Vite: Every Decision Is Yours

Vite's react-ts template creates index.html at the root, public/ for static files and src/ with main.tsx and App.tsx. The index.html sits up front, "front-and-central instead of being tucked away inside public", because it's the application's entry point (Vite). The current template already ships with oxlint instead of ESLint.

Everything after that is up to you: router, data fetching, folder structure. That's freedom, and it's risk. In a Vite SPA, the approach that works is the same one I argue for in the patterns article: src/app/ for routes and providers, src/features/<domain>/ with components, hooks and APIContract that defines how one program asks another for data or actions: which endpoints to call, what to send and what comes back. On the web, usually HTTP with JSON. calls together, and src/shared/ only for what more than one feature uses.

When to use it: an internal dashboard behind a login, an app that doesn't need SEO, a prototype, or when another system already takes care of the server. If the page needs to show up on Google or load fast on the first visit, look at the frameworks. The difference between rendering on the server, at build time or in the browser is covered in SSR, SSG, ISR or CSR.

Next.js: The Folder Is the Route

In the App Router, the structure of app/ is the routing. Each file has a fixed role: "Add page to expose a route, layout for shared UI, loading for skeletons, error for error boundaries, and route for APIs" (Next.js). In version 16, the old middleware became proxy.ts at the root.

Two conventions organize things without touching the URL:

  • Private folder _folder: stays out of routing, along with all its subfolders. Great for components only that route uses.
  • Group (folder): organizes and can have its own layout, but "should not be included in the route's URL path". Example: (store) and (account) with different layouts.

Next says it is "unopinionated about how you organize and colocate your project files" and lists three strategies: keep code outside app/ (which then holds only routes), keep it in top-level folders inside app/, or split it by feature or route. I prefer the first, with features/ next to app/: the route imports from the feature, never the other way around.

Astro: HTML First, React Where It's Needed

In Astro, "the only directory reserved by Astro is src/pages/". components/, layouts/ and styles/ are convention, and public/ is copied without processing (Astro).

What changes the architecture is the idea of islands: "an enhanced UI component on an otherwise static page of HTML" (Astro). The page ships as HTML, and only the interactive components load JavaScript, each with a directive that says when:

Directive When the component wakes up
client:load as soon as the page loads
client:idle when the browser is idle
client:visible when it scrolls into view
client:media when a media query matches
client:only only in the browser, with no server HTML

The term "component island" comes from Katie Sylor-Miller, at Etsy, in 2019, and Jason Miller, the creator of Preact, popularized it in 2020. Astro accepts React, Preact, Svelte, Vue and Solid on the same page.

This site works that way: pages and articles are .astro, and search, the blog filters and the forms are React islands. The result is very little JavaScript on content pages. When to use it: content sites, blogs, documentation, landing pages, portals. For an app full of state and interaction on every screen, the gain from islands shrinks.

React Router in Framework Mode: Remix Became React Router

In May 2024, the Remix team announced: "What we planned to release as Remix v3 is now going to be released as React Router v7" (Remix, 2024). Version 7 went stable in November 2024, with Remix's features "in the form of framework mode", and React Router is now on version 8.

It has three cumulative modes: declarative, data and framework. Framework mode "wraps Data Mode with a Vite plugin" and adds typed routes, code splitting and SPA, SSRStrategy where the server builds the page HTML on each request, with current data, so the browser receives content ready to display. or static output (React Router). Routes are declared in a single file, app/routes.ts, with route(), index(), layout() and prefix(), and they're all nested under app/root.tsx. If you prefer file-based routes, there's flatRoutes().

When to use it: when you want a framework that stays close to the web platform (loaders, actions, forms), you already use React Router in an SPA and want to grow without switching libraries, or you prefer routes spelled out in code over routes defined by folders.

Feature-based Inside Any Stack

Whatever the stack, the inside question is the same: where does the code for each part of the product live? Feature folders (features/orders/, features/catalog/) with a boundary rule in the linter cover most cases. The details, the alternatives (Feature-Sliced Design, Atomic Design) and the cost of barrel files are in front-end patterns for teams.

Isometric scale with five levels, from bottom to top: React + Vite on an app screen, a SPA with no render server; a framework with fitted pieces, Next, Astro or React Router; feature folders inside the app; a monorepo with apps/ and packages/ and several deploys; micro-frontends with teams and independent deploy per team. Each step solves an organization problem and adds complexity.
Only climb a step when the one below starts to hurt. Each one solves an organization problem and charges you in tooling, builds and coordination.

Monorepo: Several Apps, One Repository

A monorepo is a repository with several projects that share code. Turborepo recommends apps/ for applications and services and packages/ "for everything else, like libraries and tooling" (Turborepo). Under the hood, it runs on the package manager's workspaces. In pnpm, the workspace: protocol guarantees the dependency comes from the local package: pnpm "will refuse to resolve to anything other than a local workspace package" (pnpm).

text
apps/
  site/          # Astro or Next
  dashboard/     # React + Vite
packages/
  ui/            # design system
  api-client/    # API types and calls
  config/        # tsconfig, lint
pnpm-workspace.yaml

Two Turborepo rules save you pain: no nested globs (apps/**) and no ../ reaching from one package into another. If a package needs another one, it declares the dependency.

When to use it: a site and a dashboard that share components and types, a web app and a mobile app with the same API layer, a design systemSet of components, color and spacing tokens and usage rules a team shares so every screen follows the same look and behavior. published and consumed by several apps. A monorepo can still have a single deploy. If your question is about a server layer built for one specific front end, see backend for frontend.

Micro-frontends: Several Teams, Independent Deploys

Street with a row of attached townhouses, each facade a different color with different windows, but all sharing the same sidewalk, the same lamp post and the same overhead wiring; a person seen from behind walks a dog
Micro-frontends are attached townhouses: each owner paints and renovates their own house, but the sidewalk, the power and the address have to be agreed on by everyone.

The reference text is by Cam Jackson, from Thoughtworks, on Martin Fowler's site: "An architectural style where independently deliverable frontend applications are composed into a greater whole" (martinfowler.com, 2019). The phrase that matters is "independently deliverable": each part ships without waiting for the others.

Ways to put the parts together:

Integration How Watch out for
Server-side each part's HTML is assembled on the server caching and latency per fragment
Build time each part is an npm package you lose independent deploys
Iframe each part in its own window strong isolation, poor integration
JavaScript at runtime the shell loads each part from its own server React and dependency versions
Web Components each part becomes a custom element styles and events across boundaries

The most used tools for runtime integration are Module Federation, which debuted in webpack 5 and in version 2.0 gained dynamic types, a manifest and its own runtime, with support for Rspack and webpack (Module Federation), and single-spa, "a framework for bringing together multiple JavaScript microfrontends in a frontend application", which lets you mix frameworks on the same page (single-spa). Web ComponentsNative browser standard for creating your own HTML tags, with encapsulated style and behavior, that work in any framework or none at all. are an option without an orchestration framework; I explained how they work in what are Web Components.

Jackson himself lists the costs: payload size, differences between environments and "operational and governance complexity". Micro-frontends solve a team organization problem, not a code problem. With a single team, it's cost with no return.

MVC, MVVM and React

MVC was born in a technical note by Trygve Reenskaug, at Xerox PARC, in December 1979, the first to name model, view and controller (Reenskaug, 1979). MVVM came from John Gossman, at Microsoft, in 2005, as "a variation of Model/View/Controller", in which the ViewModel is the "Model of a View" and relies on data binding (Gossman, 2005).

React entered this story as the view layer. The project's README, in 2015, said: "Lots of people use React as the V in MVC" (React v0.13). Back then it became standard to split "containerIsolated package that bundles an application with its dependencies and runs the same on any machine, sharing the host operating system. Docker is the most common." components, which fetched data, from "presentational" components, which only displayed it. Dan Abramov, who popularized the split, later wrote, in a 2019 note on the same post, that he no longer recommended splitting things that way, because Hooks solve the same problem without the division.

What survived was the idea of layers. Juntao Qiu, on Martin Fowler's site, showed how to modularize a React app with well-known UI patterns, starting from the split into presentation, domain and data (martinfowler.com, 2023). The core advice: "have the user interface as thin as possible" and move logic into a model layer.

Diagram with four layers in sequence: view, with components that only display and pass events along; hooks and state, which connect the screen to the domain; domain, with pure TypeScript rules and no React, highlighted; and data, with fetch, cache and API translation
If the discount rule lives inside the component, you can only test it by rendering the component. In the domain layer, it's a function.

In practice, the hook plays the role of the MVVM ViewModel: it prepares state for the screen and exposes the actions. The domain is TypeScript with no import React. The data layer translates the API into domain types, and that's where you swap a fetch for TanStack Query without touching the screen.

Clean and Hexagonal Architecture on the Front End

Alistair Cockburn's hexagonal architecture, from 2005, has a goal that fits the front end: let the application "equally be driven by users, programs, automated test or batch scripts", and be developed and tested in isolation from production databases and devices (Cockburn, 2005). In React, that becomes ports (interfaces like OrderGateway) and adapters (the fetch implementation, or a fake one in tests).

It pays off when the business rules are large and change little, such as shipping, pricing or permission calculations, and when the same domain runs on web and mobile. For a CRUD of forms, the extra layers turn into ceremony. The signal to adopt it is concrete: you need to test the rule without rendering anything, or swap the data source without touching the screen.

How to Choose

Tools to Try

  • StackBlitz, to open a Vite, Next or Astro project in the browser and compare their structures in minutes.
  • CodeSandbox, to test an organization idea and share it with the team.
  • Bundlephobia, to check a dependency's weight before putting it in a shared package.
  • Vitest, to test the domain layer without rendering anything.

A ready-made cloud development environment, for a new monorepo, is the subject of GitHub Codespaces.

Quick check

1. What's the difference between a monorepo and micro-frontends?
Show answer

Answer: A monorepo groups apps that share code; micro-frontends let each team deploy on its own

One solves code shared between apps. The other solves teams that need to ship without waiting for each other.

2. An internal dashboard behind a login, with no need for SEO. What does the article's guide suggest?
Show answer

Answer: React with Vite, or a framework in SPA mode

With no SEO and a less critical first load, a SPA does the job. Islands shine on content sites, not on stateful apps.

3. In Astro, what is an island?
Show answer

Answer: An interactive component on a page that is otherwise static HTML

The page ships as HTML and only the islands load JavaScript, each with a directive that says when to wake up.

4. Why move business rules into a domain layer in plain TypeScript?
Show answer

Answer: So you can test the rule as a function, without rendering the screen

Inside the component, the rule can only be tested by rendering. In the domain layer, it's just a function.

Frequently Asked Questions

Can Create React App still be used?

It still works in maintenance mode, but it was deprecated for new apps in February 2025. The React docs recommend starting with a framework or, to build from scratch, with Vite, Parcel or Rsbuild.

What's the best folder structure for React?

For most apps, organize by feature, with the code for each part of the product kept together and a lint rule saying who can import whom. The stack defines the outside (routes and pages), and the feature organization takes care of the inside.

Next.js, Astro or React Router?

Astro for content, with little interaction and lots of HTML. Next.js for apps with SEO, SSR and lots of interaction, with the biggest ecosystem. React Router in framework mode if you want a framework close to the web platform, with loaders and actions, or you already use React Router in an SPA.

What's the difference between a monorepo and micro-frontends?

A monorepo is about where the code lives: several projects in one repository, sharing packages. Micro-frontends are about how the product ships: parts of the interface with independent deploys, usually owned by different teams. You can have one without the other.

When should I use micro-frontends?

When several teams need to ship parts of the same product without coordinating every deploy. With a single team or a small product, the cost of integration, versions and governance outweighs the gain.

Can you use MVC in React?

The idea, yes; the literal pattern, no. React is the view layer; hooks play the role of controller or ViewModel; and business rules can live in a domain layer in plain TypeScript, testable without rendering anything.

Are container and presentational components still worth it?

As a mandatory split, no: Dan Abramov himself stopped recommending it after Hooks. The idea of a thin component that only displays and passes events along is still good, but the logic now lives in hooks and domain modules.

Is Feature-Sliced Design better than feature folders?

It's more complete and stricter, with defined layers and import rules. It pays off in a large product with several teams. For most apps, feature folders with two or three boundary rules in the linter solve the same problem.

References

Source: https://ramongomessilva.com.br/blog/react-frontend-architecture · Accessed on December 02, 2026

Share Share on LinkedIn Share on X
Cite this article

Ready-made reference, with today as the access date.

ABNT

Brazilian standard (NBR 6023). Use it in theses and academic papers submitted in Brazil.

GOMES, Ramon. React front-end architecture: Vite, Next, Astro, monorepos and micro-frontends. Ramon Gomes, 20 nov. 2026. Disponível em: https://ramongomessilva.com.br/blog/react-frontend-architecture. Acesso em: 2 dez. 2026.

APA

American Psychological Association style. Common in scientific papers and journals, especially in the social, behavioral and health sciences.

Gomes, R. (2026, November 20). React front-end architecture: Vite, Next, Astro, monorepos and micro-frontends. Ramon Gomes. https://ramongomessilva.com.br/blog/react-frontend-architecture

BibTeX

Format for LaTeX users (Overleaf, for example). Paste it into your .bib file or import it into Zotero or Mendeley.

@online{gomes2026reactfrontendarchitecture,
  author = {Gomes, Ramon},
  title = {{React front-end architecture: Vite, Next, Astro, monorepos and micro-frontends}},
  organization = {Ramon Gomes},
  year = {2026},
  month = nov,
  date = {2026-11-20},
  url = {https://ramongomessilva.com.br/blog/react-frontend-architecture},
  urldate = {2026-12-02}
}
Found a mistake?

Wrong fact, broken link, outdated information: tell me and I will fix it.

10 to 2,000 characters. If you can, point to the right source.

Only so I can reply. It never shows on any page of the site.

Written by

Ramon Gomes

Software Engineer

Full stack software engineer. I like taking a messy problem, listening to the people who live with it and shipping something that holds up day to day. These days I split my time between my own products, applied AI and client work.

Available for projects

Need Something Like This Built?

I build websites, systems, apps and AI automations, from design to deploy. Tell me what you need or see what I offer.

Related Articles