NestJS BackendNestJS 11REST + GraphQLDocker ComposeOpen Source Template

NestJS Backend

A reference NestJS template you can clone and ship on: dual APIs, serious auth surface, Docker Compose infra, and docs that live next to the API.

Six months of hardening later — health checks, Graylog, CQRS-ready repos, and a wiki that ships with the same container as Swagger.

Live stack

nest.lacorte.dev

docs

nest.lacorte.dev

api

Swagger UI

GET /health → ok

compose

docker compose up -d --build

APIs

REST + GraphQL

Infra

Compose one-liner

Coverage gate

≥80% Jest

Capabilities

What you get

1

Auth that covers the real world

JWT login/register/refresh, on-prem Active Directory (LDAP/LDAPS), and a long list of social providers — Google through Apple, Steam, MetaMask, and more.

2

REST and GraphQL together

Versioned REST under `/api/v1` plus Apollo GraphQL on the same Fastify app, with Swagger for the HTTP surface.

3

CQRS-ready persistence

Repository pattern with PostgreSQL (TypeORM) as the default users store and a MongoDB repository kept ready if you split commands and queries later.

4

Messaging and object storage

Redis cache, Apache Kafka, and MinIO ship in Compose so queues and files are not weekend projects.

5

Observability baked in

Terminus health at `/health`, structured GELF logs into Graylog/OpenSearch, MailHog for local email, and a built-in wiki next to the API.

6

Tests that gate commits

Jest unit suite with a global ≥80% coverage threshold and a Husky pre-commit hook that refuses soft passes.

How it works

From clone to healthy API in three moves

1

Compose the kitchen sink

One `docker compose --env-file .env.docker up -d --build` brings up Postgres, Mongo, Redis, Kafka, MinIO, Graylog, and the API.

2

Probe the live surface

Hit Swagger, GraphQL, and the wiki on the same origin — no “docs over here, API somewhere else.”

3

Trust the health gate

`GET /health` checks Postgres, Mongo, Redis, Kafka, and heap. Compose uses it as the container HEALTHCHECK.

Try it

Tour the demo or clone the template

  1. 1Open the live docs at nest.lacorte.dev and skim the install walkthrough.
  2. 2Explore the interactive API at /swagger — same origin as the wiki.
  3. 3Clone the GitHub repo and bring the full stack up with Compose.
  4. 4Confirm `/health` is green before you start deleting modules you do not need.

Implementation

Stack at a glance

Runtime

NestJS 11, TypeScript, Fastify

APIs

REST, GraphQL (Apollo), Swagger

Data

PostgreSQL, MongoDB, Redis

Platform

Kafka, MinIO, Graylog, Docker Compose

FAQ

Common questions

Is this production-ready or a demo?+
It is a clone-ready reference template with a live demo. Expect to delete modules you do not need, then ship the rest with Compose or your own orchestration.
Do I need every service in Compose?+
No. Compose brings the full kitchen sink for local realism. Trim Kafka, MinIO, or Graylog when your use case is thinner — health checks adapt to what you keep.
REST or GraphQL — which is primary?+
Both ship. Most people start at Swagger for the HTTP surface; GraphQL stays at `/graphql` if that is your religion.
Where do the docs live?+
On the same origin as the API: nest.lacorte.dev for the wiki, /swagger for the interactive contract.

Clone it. Compose it. Cut what you do not need.

The plumbing drains. Start from the live demo or the GitHub template.