engrsakib-boilerplate — Ultimate Full-Stack Monorepo Starter
Enterprise-grade Turborepo monorepo delivering a production-ready full-stack foundation: dual Next.js 15 surfaces, a NestJS API on the Fastify adapter, Prisma ORM, PostgreSQL, Redis, and Nginx reverse-proxy orchestration.
Author
| Name | Md. Nazmus Sakib |
| Title | Software Engineer and Researcher |
| Official URL | engrsakib.com |
Architecture Overview
engrsakib-boilerplate/
├── apps/
│ ├── web/ # Next.js 15 — public application (App Router, Tailwind, TypeScript)
│ ├── admin/ # Next.js 15 — administration console (App Router, Tailwind, TypeScript)
│ └── api/ # NestJS + Fastify — high-performance REST API with Prisma
├── packages/
│ ├── database/ # Prisma schema, generated client, shared data-access layer
│ ├── typescript-config/ # Shared TypeScript baselines (base / Next.js / NestJS)
│ └── eslint-config/ # Shared ESLint flat-config rulesets
├── docker/
│ └── nginx/ # Reverse-proxy core config, vhosts, TLS mount point
├── docker-compose.yml # PostgreSQL · Redis · Nginx · Web · Admin · API
├── turbo.json # Turborepo pipeline definitions
├── pnpm-workspace.yaml # Workspace package boundaries
└── README.md
Runtime Topology
| Service | Technology | Default Port | Role |
|---|---|---|---|
web | Next.js 15 | 3000 | Customer-facing application |
admin | Next.js 15 | 3001 | Operations / administration UI |
api | NestJS + Fastify | 4000 | REST API, Prisma, Redis |
postgres | PostgreSQL 15 Alpine | 5432 | Primary transactional datastore |
redis | Redis Alpine | 6379 | Cache and session state |
nginx | Nginx Alpine | 80 / 443 | Reverse proxy & TLS edge |
Client
│
▼
Nginx (:80/:443)
├── / → web:3000
├── /admin/ → admin:3001
└── /api/ → api:4000
├── Prisma → PostgreSQL
└── ioredis → Redis
Prerequisites
Ensure the following tooling is available on the host machine before proceeding:
| Requirement | Minimum Version | Notes |
|---|---|---|
| Node.js | v20+ | LTS recommended (engines.node >= 20) |
| pnpm | 10.x | Enforced via packageManager field |
| Docker Desktop | Latest stable | Required for Compose-based infrastructure |
Verify locally:
node -v
pnpm -v
docker -v
docker compose version
Local Quickstart Guide
1. Install dependencies
pnpm install
2. Configure environment
cp .env.example .env
Adjust PostgreSQL credentials, Redis endpoints, and public URLs as required for your workstation.
3. Start infrastructure (PostgreSQL, Redis, Nginx, app containers)
docker-compose up -d --build
For hot-reload application development on the host, you may start only the data plane:
docker-compose up -d postgres redis
4. Initialize Prisma schema (push to PostgreSQL)
pnpm --filter database db:push
Equivalent root convenience script:
pnpm db:push
Generate the Prisma Client after schema changes:
pnpm db:generate
5. Start hot-reload local development
pnpm dev
Turborepo will orchestrate concurrent dev tasks across web, admin, api, and database.
| Surface | URL |
|---|---|
| Web | http://localhost:3000 |
| Admin | http://localhost:3001 |
| API | http://localhost:4000/api |
| API Health | http://localhost:4000/api/health |
6. Type-safety verification
pnpm typecheck
This command executes TypeScript compliance checks across all workspace packages and applications, validating inter-package linkage integrity.
Production Deployment Guidelines
Build pipeline
pnpm install --frozen-lockfile
pnpm db:generate
pnpm build
pnpm typecheck
Containerized production stack:
docker-compose up -d --build
Images for web, admin, and api use multi-stage Node builds to minimize runtime image size and exclude development tooling from the final layers.
Environmental isolation
- Never commit live secrets. Use
.env.exampleas the contract; inject production values via your secrets manager or Compose/K8s secret mounts. - Isolate
NODE_ENV=productionfor application containers; keep developer.envfiles off shared hosts. - Point
DATABASE_URLandREDIS_URLat private network endpoints (Compose service DNS or VPC-internal hostnames), not public ingress.
Nginx security context
The edge proxy (docker/nginx) is configured with:
server_tokens offto suppress version disclosure- Baseline security headers (
X-Frame-Options,X-Content-Type-Options,Referrer-Policy) - Upstream keepalive pools for web, admin, and API
- Gzip for common text/binary assets
- TLS stub for mounting certificates under
docker/nginx/ssl/
Production recommendations:
- Terminate TLS at Nginx with certificates from your ACME provider or corporate PKI.
- Enable HSTS once HTTPS is authoritative.
- Restrict admin ingress via IP allowlists, SSO gateway, or mTLS where policy requires it.
- Rate-limit
/api/at the edge for abuse resistance. - Keep Nginx config mounted read-only (
:ro) as defined in Compose.
Operational health
- Nginx probe:
GET /nginx-health - Application probe:
GET /api/health(reports PostgreSQL and Redis readiness)
Workspace Scripts
| Script | Description |
|---|---|
pnpm dev | Concurrent hot-reload development across apps |
pnpm build | Production builds via Turborepo |
pnpm typecheck | Full workspace TypeScript validation |
pnpm lint | ESLint across packages and applications |
pnpm db:generate | Generate Prisma Client |
pnpm db:push | Push schema to the database (dev) |
pnpm db:migrate | Run Prisma migrations |
pnpm db:studio | Open Prisma Studio |
Shared Packages
database
Central Prisma schema (User, Post, Role) and exported PrismaClient singleton for NestJS and future consumers (packages/database).
@engrsakib/typescript-config
Shared compiler baselines:
base.json— strict Node/ES2022 foundationnextjs.json— App Router / Bundler resolutionnestjs.json— decorators and CommonJS emit
@engrsakib/eslint-config
Flat ESLint configs for base TypeScript, Next.js, and NestJS surfaces.
License
MIT © Md. Nazmus Sakib
engrsakib-boilerplate — engineered for teams that require clarity, performance, and production discipline from day zero.
