Case study / 06

Microservices Starter Kit

A production-ready microservices architecture with 5 NestJS services (API Gateway, Auth, Users, Products, Payments) communicating entirely through RabbitMQ events, each with its own PostgreSQL database, deployed on Kubernetes with full CI/CD.

Status
Selected work
System context
TypeScript, NestJS, Prisma, PostgreSQL
Source
Public repository

01 / System behavior

Interactive proof

A project-specific technical mechanism based on the recorded architecture and implementation context.

Interactive proofMicroservices Starter Kit
RabbitMQ topic exchange
Gateway
Isolated data
Auth
Isolated data
Users
Isolated data
Products
Isolated data
Payments
Isolated data

Context and intent

This project builds the complete microservices picture - not a toy demo, but a production-shaped system with real event-driven communication, database isolation, health checks, and CI/CD.

Five NestJS services run independently, each with its own Prisma schema, migrations, and PostgreSQL database. The API Gateway is the single entry point - it doesn't contain business logic, only routing, JWT authentication, rate limiting (100 req/min), and health aggregation. It proxies requests to downstream services and reports aggregate health: healthy (all up), degraded (some down), or unhealthy (all down).

03 / Architecture record

Architecture

A structured reading of the architecture recorded with this project.

Architecture recordMicroservices Starter Kit
API Gateway
Auth Service
User Service
Product Service
Payment Service
Read the full architecture record

Five NestJS services in a Turborepo monorepo, each running on its own port:

• API Gateway (3000) - Routing, JWT validation, rate limiting, request aggregation, health check aggregation • Auth Service (3001) - Registration, login, JWT tokens, password reset, Passport.js strategies • User Service (3002) - Profiles, preferences, addresses; listens for auth.user.registered events • Product Service (3003) - Catalog, categories, inventory; publishes inventory.low_stock alerts • Payment Service (3004) - Orders, payments, refunds; maintains denormalized product cache from product events

All inter-service communication flows through a RabbitMQ topic exchange (microservices.events). Events follow the {service}.{entity}.{action} naming convention. Shared packages ensure publisher and consumer always agree on routing key strings.

Infrastructure: Docker Compose for local development (PostgreSQL, Redis, RabbitMQ, Adminer), Kubernetes manifests for production deployment with readiness/liveness probes.

How the system is shaped

Services communicate asynchronously via RabbitMQ with a topic exchange. When a user registers, the Auth Service publishes auth.user.registered - the User Service creates a profile, the Email Service sends a welcome email, the Analytics Service tracks the signup. The Auth Service has no idea who's listening. Event payloads follow a standardized format: eventType, data, timestamp, service, version. All messages are persistent JSON buffers with unique message IDs.

Each service's EventService implements connection resilience: if RabbitMQ is unavailable at startup, the service retries every 5 seconds. Services start and operate even if the message broker is temporarily down - they just can't publish events until the connection recovers.

Health checks are three levels deep: /health (full check with database connectivity), /health/ready (readiness probe), and /health/live (liveness probe). Kubernetes manifests reference these for pod management.

05 / Selected highlights

Selected implementation notes

The decisions and workflows that carry the most explanatory weight.

  1. 5 independent NestJS services with clear domain boundaries: API Gateway, Auth, Users, Products, and Payments
  2. Event-driven communication via RabbitMQ topic exchange - services publish domain events, consumers subscribe by routing key patterns (*.user.*)
  3. Database-per-service pattern - each service has its own Prisma schema, migrations, and PostgreSQL database for independent deployability and failure isolation
  4. Connection resilience - EventService retries RabbitMQ connection every 5 seconds, services operate gracefully when the broker is temporarily down
  5. Standardized event payload format with eventType, data, timestamp, service, and version fields - persistent JSON buffers with unique message IDs survive broker restarts
  6. API Gateway with JWT validation, rate limiting (100 req/min), request proxying, and aggregate health reporting (healthy/degraded/unhealthy)

06 / Supported metrics

Verified project record

Independent Services
5
Databases
4
Event Types
15+
Swagger Endpoints
5
Health Check Levels
3
Direct Inter-Service Calls
0

Technology in context

TypeScript, NestJS, Prisma, PostgreSQL, RabbitMQ, Redis, Docker, Kubernetes, Turborepo, GitHub Actions, Fastify, Swagger/OpenAPI, Passport.js, JWT

View source repository