Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Project structure · Full stack

MERN (MongoDB, Express, React, Node) project structure

Opens with credits

One repository with a React app built by Vite in client/, an Express API with Mongoose in server/, and a tiny shared/ package that both import for request shapes and types. npm workspaces give you one install and one command to run both, and one example feature (clinic appointments) runs through every folder so you can see how a request travels from a form to MongoDB and back, and what tests, security and operations a real team adds around it.

Curated by Tauseef FayyazIntermediate247 files and foldersNode.js 24 LTS, React 19, Vite 8Checked October 2026
Explore the filesPick any file to see what it is, why it exists and when you add it.

How it grows

Each stage opens the explorer there

  1. 1Day 1What the scaffold and your first hour give you35 files and folders
  2. 2GrowingWhat a real app with features and tests adds+121 files and folders
  3. ProductionWhat running it for real users adds+39 files and foldersOpens with credits
  4. ExpertWhat a team needs to keep it healthy for years+52 files and foldersOpens with credits

How it is organised

  • Two clear halves: client/ is the browser app, server/ is the API. Learners always know which side of the network a file runs on.
  • npm workspaces tie them together: one npm install, one lock file, one node_modules, and npm run dev at the root starts both. The alternative, two folders with their own package.json and no root workspace, also works and is common in tutorials, but you then install twice and cannot share code without copying it.
  • The API contract lives in shared/: Zod schemas validate input on the server and type the forms and responses on the client, so a renamed field breaks the build instead of production.
  • Inside client/src and server/src, group by feature (features/appointments, features/auth), not by file type. On the server each feature splits into routes, controller, service and repository, so HTTP, rules and queries never mix.
  • In development the Vite dev server proxies /api to Express, so the browser sees one origin: no CORS setup and cookies just work. In production Express serves the built client, keeping that same single origin.
  • Configuration comes from environment variables, validated once at startup. Secrets never go into the client, because everything in a Vite bundle is public.
  • Test in layers: unit and component tests from Growing (Vitest, Testing Library, MSW, mongodb-memory-server), real-database and browser tests at Production (Testcontainers, Playwright), and contract, accessibility, visual and load tests at Expert when the team and traffic justify them.

At the top of the project

Open one in the explorer for the full story

Learn more on Sefism

Roadmaps, cheat sheets and projects that go with MERN (MongoDB, Express, React, Node).

See 10 more
Checked against 20 official sources, October 2026. If something has changed, the docs win.Show sources

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com