A production‑ready monorepo starter kit built with Next.js, NestJS, and Auth.js, featuring JWT‑based authentication, full RBAC (Role‑Based Access Control), and a scalable architecture suitable for SaaS, enterprise, and multi‑tenant applications.
This starter kit is designed to help you move fast while following best practices for security, code sharing, and maintainability.
- Single repository for frontend, backend, and shared packages
- Shared types, auth config, and utilities
- Consistent tooling and dependencies
- App Router support
- Server Components + Client Components
- Protected routes (RBAC aware)
- Session handling via Auth.js
- API-safe JWT handling
- Modular architecture
- JWT authentication guard
- Role & permission guards
- Custom decorators (
@Roles(),@Permissions()) - Fully protected REST APIs
-
Auth.js for authentication
-
JWT‑based auth (stateless & scalable)
-
Access & refresh token support
-
Full RBAC implementation
- Roles (e.g.
ADMIN,USER,EDITOR) - Fine‑grained permissions
- Roles (e.g.
-
Secure token verification on backend
- Shared auth config
- Shared types & utilities
- ESM‑compatible packages
- Type‑safe end‑to‑end
- ESLint + Prettier
- Environment‑based config
- Easy local development
.
├── apps/
│ ├── frontend/ # Next.js frontend
│ └── backend/ # NestJS backend
│ └── docs/ # Fuma Docs
│
├── packages/
│ └── config/ # ESLint, TS configs
│
├── .env.example
├── package.json
├── pnpm-workspace.yaml
└── README.md
- User signs in via Next.js (Auth.js)
- Auth.js issues a JWT
- JWT is sent to NestJS via
Authorization: Bearer <token> - NestJS verifies token
- RBAC guards validate role & permissions
- Request is allowed or rejected
- Middleware‑based route protection
- Server‑side session validation
pnpm installpnpm dev- Frontend:
http://localhost:3000 - Backend:
http://localhost:5000
| Command | Description |
|---|---|
pnpm dev |
Run all apps in dev mode |
pnpm build |
Build all packages |
pnpm lint |
Lint entire repo |
pnpm typecheck |
Type check all apps |
- Frontend deployable on Vercel
- Backend deployable on Docker / VPS / AWS / Fly.io
- JWT makes backend fully stateless
- Monorepo supports CI/CD easily
✅ Production‑grade auth ✅ Clean RBAC implementation ✅ Scalable monorepo structure ✅ Perfect for SaaS & enterprise apps ✅ Saves weeks of setup time
MIT License
Contributions are welcome! Please open an issue or submit a PR.
If you find this project useful, please give it a ⭐ on GitHub.
Happy coding! 🚀