Monorepo Architecture
Project Structure
The monorepo structure generated by create-modern-mern-app separates client and server into isolated npm workspaces with unified root coordination.
Workspace Tree Layout
Here is the standard layout produced for an authenticated TypeScript application with shadcn/ui:
Monorepo Directory Layout
bash
my-app/
├── client/ # Vite + React 19 Frontend workspace
│ ├── src/
│ │ ├── api/ # Shared Axios client instance & interceptors
│ │ │ └── client.ts
│ │ ├── components/ # Reusable UI components & shadcn primitives
│ │ │ ├── ui/ # button, input, card, dialog, table, dropdown-menu
│ │ │ ├── DashboardHeader.tsx
│ │ │ └── DashboardSidebar.tsx
│ │ ├── layouts/ # Route layout wrappers with
│ │ │ ├── PublicLayout.tsx
│ │ │ └── DashboardLayout.tsx
│ │ ├── pages/ # Top-level view routes
│ │ │ ├── Home.tsx
│ │ │ ├── Login.tsx
│ │ │ ├── Signup.tsx
│ │ │ ├── Overview.tsx # shadcn dashboard-01 parity
│ │ │ ├── Members.tsx # Protected member list
│ │ │ ├── Account.tsx # Profile editing
│ │ │ └── Settings.tsx
│ │ ├── App.tsx # React Router DOM route definitions
│ │ ├── index.css # Tailwind CSS v4 & theme variables
│ │ └── main.tsx # React 19 root bootstrap
│ ├── components.json # shadcn/ui configuration with Lucide icons
│ ├── package.json # client workspace dependencies
│ ├── tsconfig.json
│ └── vite.config.ts # Vite config with API proxy
├── server/ # Node.js + Express 5 Backend workspace
│ ├── src/
│ │ ├── config/ # Environment config & MongoDB connection
│ │ │ └── db.ts
│ │ ├── controllers/ # Request handling & HTTP response contracts
│ │ │ ├── auth.controller.ts
│ │ │ └── user.controller.ts
│ │ ├── middleware/ # Security, auth verification, and rate limiting
│ │ │ ├── auth.middleware.ts
│ │ │ ├── rateLimiter.ts
│ │ │ └── validate.ts
│ │ ├── models/ # Mongoose document schemas & types
│ │ │ └── user.model.ts
│ │ ├── routes/ # Express Router definitions
│ │ │ ├── auth.routes.ts
│ │ │ └── user.routes.ts
│ │ └── services/ # Database transactions & business rules
│ │ ├── auth.service.ts
│ │ └── user.service.ts
│ ├── index.ts # Express bootstrap, Helmet, CORS & middleware
│ ├── package.json # server workspace dependencies
│ └── tsconfig.json # NodeNext module resolution
├── .env.example # Template for required environment variables
├── .gitignore # Ignore rules for node_modules, dist, and secrets
├── package.json # Monorepo root with concurrent scripts
└── README.md # Project-tailored setup guideRoot Workspace Configuration
The root package.json uses native npm workspaces to link client and server, letting you install dependencies once at the root with standard npm commands:
Root package.json
json
{
"name": "my-app",
"version": "1.0.0",
"private": true,
"workspaces": [
"client",
"server"
],
"scripts": {
"dev": "concurrently -n "client,server" -c "cyan,magenta" "npm --prefix client run dev" "npm --prefix server run dev"",
"build": "npm --prefix client run build && npm --prefix server run build",
"lint": "npm --prefix client run lint && npm --prefix server run lint",
"test": "npm --prefix server run test"
},
"devDependencies": {
"concurrently": "^9.1.2"
}
}Strict Cross-Platform Conventions
All generated imports use forward slashes (/) regardless of whether created on Windows, macOS, or Linux. NodeNext TypeScript configs require explicit .js extensions on relative server imports so compiled outputs run natively under Node.js ES Modules.