A production-ready starter template for building full-stack web applications with NestJS backend and Angular frontend. Includes authentication, user management, and common infrastructure patterns.
-
Backend (NestJS)
- JWT-based authentication with refresh tokens
- Role-based access control (Admin, Manager, Regular)
- MongoDB integration with Mongoose
- RESTful API with validation and error handling
- Task scheduling system
- Notifications and alerts
- Circuit breakers and utility services
- Rate limiting and security guards
- Shared contracts library (DTOs, Commands, Queries, Enums)
-
Frontend (Angular 21)
- Admin UI with Angular Material components
- User UI (public-facing application)
- Signals-based state management with local storage
- Tailwind CSS configured
- Shared common UI library
- JWT authentication interceptors
- Node.js (v24 or higher)
- MongoDB running as a single-node replica set (
rs0) — required for transactions. See MongoDB replica set. - npm or yarn
-
Install dependencies:
npm install cd frontend && npm install cd ../backend && npm install
-
Configure MongoDB: MongoDB must be a replica set (
rs0). If you have a standalone instance, convert it first: MongoDB replica set.Default URI in
backend/config/development.ts:mongoUri: "mongodb://localhost/nest-angular-starter?replicaSet=rs0&retryWrites=true";
-
Initialize database:
cd backend npm run init-db:devThis creates the database and seeds users for each role (Admin, Manager, Regular).
-
Start development servers:
# From project root npm run devOr run individually:
- Backend:
cd backend && npm run start:debug(port 8200) - Admin UI:
cd frontend && npm run start:admin(port 5100) - User UI:
cd frontend && npm run start:user(port 5200)
- Backend:
├── backend/ # NestJS backend (monorepo)
│ ├── src/ # Application modules
│ ├── libs/ # Shared libraries (contracts)
│ └── config/ # Environment configurations
├── frontend/ # Angular workspace
│ ├── projects/
│ │ ├── admin-ui/ # Admin dashboard (Material UI)
│ │ ├── user-ui/ # Public-facing app
│ │ └── common-ui/ # Shared components & services
└── package.json # Root scripts
- Backend config:
backend/config/development.ts(orproduction.ts,stage.ts) - Frontend config: Runtime
window.__envinjected viaenv.jsper app (frontend/projects/*/src/environments/) - Shared contracts:
backend/libs/contracts/src/(automatically available in frontend via TypeScript path alias)
Root:
npm run dev- Start all services in development modenpm run dev:admin- Start backend + admin UInpm run dev:user- Start backend + user UInpm run build-prod- Build all for productionnpm run build-stage- Build all for stagingnpm run test- Run backend unit tests and e2e smoke testnpm run lint- Run backend ESLint
Backend:
npm run start:dev- Development with watch modenpm run start:debug- Development with debuggernpm run init-db:dev- Initialize and seed database
Frontend:
npm run start:admin- Serve admin UInpm run start:user- Serve user UInpm run build-prod:admin- Build admin UI for productionnpm run build-prod:user- Build user UI for production
- Architecture — system design and layers
- Backend features — modules and API routes
- Frontend features — admin/user UI catalog
- Shared infrastructure — reusable building blocks (check before adding new utils/modules)
- MongoDB replica set — convert a standalone node to
rs0for transactions - AGENTS.md — agent workflow for consulting and updating the catalog
MIT