README.md

March 23, 2026 ยท View on GitHub


Modern Developer Animation

๐Ÿš€ Ultimate TypeScript Express Boilerplate

A production-ready, industry-standard backend boilerplate designed for scale and developer experience.

Typing SVG

Tech Stack

TypeScript Express Node.js MongoDB PostgreSQL MySQL Redis RabbitMQ Apache Kafka Docker Kubernetes Swagger Vitest


โœจ Features

  • Unified Message Bus with transport-aware routing for BullMQ, Kafka, and RabbitMQ.
  • Parallel Worker Runtime with dedicated worker entrypoints for queue/event/command processing.
  • BullMQ by Default for delayed/retryable jobs with optional Kafka and RabbitMQ integrations.
  • Authentication + Security with JWT access/refresh rotation, refresh reuse detection, RBAC guard, and Redis-backed rate limiting.
  • Stripe Webhooks with signature verification, idempotency protection, and async dispatch via queue workflows.
  • Observability with OpenTelemetry tracing, Prometheus metrics, structured logging, and capability diagnostics.
  • OpenAPI + Contract Checks with Swagger docs export and Spectral linting.
  • Strict CI Quality Gate covering typecheck, lint, tests, contracts, and security audit.
  • Migration + Seeding Support with migrate-mongo and seed scripts.
  • Docker + Kubernetes Ready with local stack orchestration and production manifests.

โšก Quick Start

1. Prerequisites

Install the following:

2. Clone

git clone https://github.com/Nayem-Dev/TS_Backend.git
cd TS_Backend/TS_Boiler_Plate

3. Install

npm install

4. Configure Environment

cp .env.example .env

Set required values in .env:

DB_TYPE=mongodb
MONGODB_URL=mongodb://localhost:27017/ts_boilerplate
REDIS_URL=redis://localhost:6379

BULLMQ_ENABLED=true
KAFKA_ENABLED=true
RABBITMQ_ENABLED=true
STRIPE_ENABLED=false

5. Run

  • API only:
npm run dev
  • Full local stack (API + workers + infra via Docker):
npm run dev:stack

๐Ÿ“‚ Project Structure

TS_Boiler_Plate/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app.ts
โ”‚   โ”œโ”€โ”€ server.ts
โ”‚   โ”œโ”€โ”€ auth/
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ”œโ”€โ”€ jobs/
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ messaging/          # Unified message bus
โ”‚   โ”œโ”€โ”€ modules/
โ”‚   โ”œโ”€โ”€ observability/
โ”‚   โ”œโ”€โ”€ payments/
โ”‚   โ”œโ”€โ”€ queues/
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”œโ”€โ”€ workers/            # Dedicated worker entrypoints
โ”‚   โ””โ”€โ”€ utils/
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ k8s/
โ””โ”€โ”€ scripts/

๐Ÿ› ๏ธ Scripts Overview

CommandDescription
npm run devStart API in dev mode
npm run dev:stackStart API + workers + infra (Docker Compose)
npm run worker:bullmqRun BullMQ worker
npm run worker:kafkaRun Kafka consumer worker
npm run worker:rabbitmqRun RabbitMQ consumer worker
npm run typecheckRun strict TypeScript checks
npm run lintRun ESLint
npm run testRun Vitest suites
npm run check:contractsExport OpenAPI + run Spectral lint
npm run check:securityRun npm audit gate
npm run check:allRun full quality gate
npm run migrate:upApply Mongo migrations
npm run seedRun seed data

๐Ÿ”Ž Diagnostics Endpoints

  • GET /api/v1/health
  • GET /api/v1/ready
  • GET /api/v1/system/capabilities
  • GET /api/v1/system/pipeline-ready
  • GET /metrics

๐Ÿค Contributing

Contributions are welcome. Please ensure npm run check:all passes before opening a PR.

Built with โค๏ธ by the community. Stay awesome! ๐Ÿš€