engrsakib
5,433 hrs
Live WakaTime Coding Metric

Repository Workspace

engrsakib-boilerplate-

Explore source files, configuration surfaces, README documentation, and commit history.

TypeScriptOpen on GitHub
★ 0 stars⑂ 0 forksDefault · main

Source viewer

Select a file from the tree

Configuration files and source modules stream through the secure API proxy and render with the active theme accent.

README.md

engrsakib-boilerplate — Ultimate Full-Stack Monorepo Starter

Node pnpm Turborepo Next.js NestJS Prisma Docker License

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

NameMd. Nazmus Sakib
TitleSoftware Engineer and Researcher
Official URLengrsakib.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

ServiceTechnologyDefault PortRole
webNext.js 153000Customer-facing application
adminNext.js 153001Operations / administration UI
apiNestJS + Fastify4000REST API, Prisma, Redis
postgresPostgreSQL 15 Alpine5432Primary transactional datastore
redisRedis Alpine6379Cache and session state
nginxNginx Alpine80 / 443Reverse 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:

RequirementMinimum VersionNotes
Node.jsv20+LTS recommended (engines.node >= 20)
pnpm10.xEnforced via packageManager field
Docker DesktopLatest stableRequired 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.

SurfaceURL
Webhttp://localhost:3000
Adminhttp://localhost:3001
APIhttp://localhost:4000/api
API Healthhttp://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.example as the contract; inject production values via your secrets manager or Compose/K8s secret mounts.
  • Isolate NODE_ENV=production for application containers; keep developer .env files off shared hosts.
  • Point DATABASE_URL and REDIS_URL at 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 off to 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:

  1. Terminate TLS at Nginx with certificates from your ACME provider or corporate PKI.
  2. Enable HSTS once HTTPS is authoritative.
  3. Restrict admin ingress via IP allowlists, SSO gateway, or mTLS where policy requires it.
  4. Rate-limit /api/ at the edge for abuse resistance.
  5. 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

ScriptDescription
pnpm devConcurrent hot-reload development across apps
pnpm buildProduction builds via Turborepo
pnpm typecheckFull workspace TypeScript validation
pnpm lintESLint across packages and applications
pnpm db:generateGenerate Prisma Client
pnpm db:pushPush schema to the database (dev)
pnpm db:migrateRun Prisma migrations
pnpm db:studioOpen 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 foundation
  • nextjs.json — App Router / Bundler resolution
  • nestjs.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.

Back online.