"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.

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.
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.
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).
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

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.
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
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
- React, Sunsetting Create React App, 2025; Creating a React App and Build a React app from scratch, accessed in 2026.
- Vite, Getting Started, accessed in 2026.
- Next.js, Project structure and organization, 2026.
- Astro, Project structure, Islands architecture and directives, accessed in 2026.
- Remix, Merging Remix and React Router, 2024, and React Router v7, 2024; React Router, Picking a mode and Routing, accessed in 2026.
- Turborepo, Structuring a repository, and pnpm, Workspaces, accessed in 2026.
- Cam Jackson, Micro Frontends, martinfowler.com, 2019.
- Module Federation and single-spa, accessed in 2026.
- Trygve Reenskaug, Models-Views-Controllers, Xerox PARC, 1979.
- John Gossman, Introduction to Model/View/ViewModel pattern, 2005.
- Juntao Qiu, Modularizing React Applications with Established UI Patterns, martinfowler.com, 2023.
- Alistair Cockburn, Hexagonal architecture, 2005.
- Book: Luca Mezzalira, Building Micro-Frontends: Distributed Systems for the Frontend, 2nd edition, O'Reilly, 2025. The most complete reference on when micro-frontends are worth it and how to govern them.