Skip to content

nest-api features

Generated from templates/nest-api/template.json. With no flags you get every feature marked On; --all adds the opt-ins.

FeatureDefaultWhat it adds
prisma
Prisma ORM + Postgres
Always

PrismaService, multi-file schema, the .bin/db.ts env-aware wrapper, and the Prisma exception filters.

config
Zod-validated config service
Always

CustomConfigService wrapping @nestjs/config; app code never reads process.env directly.

auth
better-auth (email/password, OAuth, roles)
Always

Global AuthGuard so every route is authenticated by default, @AllowAnonymous to opt out, access-control statements and roles in lib/access.ts.

Requires prisma

cache
Redis cache
On

CacheService on ioredis, plus the key-namespacing helpers. Required by the queue, throttler and realtime layers.

Packages: ioredis

Files it owns (3)
  • src/common/services/cache.service.ts
  • src/common/utils/redis.keys.ts
  • src/common/__tests__/cache.service.spec.ts
queue
BullMQ background jobs
On

QueueModule.register(), the Bull Board dashboard at /dashboard behind basic auth.

Requires cache

Packages: @nestjs/bullmq, bullmq, @bull-board/api, @bull-board/express, @bull-board/nestjs, bullmq-otel

Files it owns (1)
  • src/common/modules/queue.module.ts
mail
Transactional email
On

MailService enqueuing onto the mail queue, a MailProcessor consumer, and React Email templates with a dev preview server.

Requires queue

Packages: @nestjs-modules/mailer, nodemailer, react, react-email, @react-email/components, @react-email/render, @types/nodemailer, @types/react

Files it owns (6)
  • src/common/services/mail.service.ts
  • src/common/processors/**
  • src/common/types/email.ts
  • emails/**
  • __mocks__/**
  • src/common/__tests__/mail.service.spec.ts
rate-limit
Two-layer rate limiting
On

ThrottlerGuard on a Redis Lua storage for app routes, plus better-auth's own limiter for /auth/* with per-endpoint rules.

Requires cache

Packages: @nestjs/throttler

Files it owns (6)
  • src/common/services/throttler-storage.service.ts
  • src/common/services/auth-rate-limit.storage.ts
  • src/lib/rate-limit.ts
  • src/common/utils/ip.ts
  • src/common/__tests__/throttler-storage.service.spec.ts
  • test/rate-limit.spec.ts
openapi
OpenAPI + Scalar reference
Always

Swagger document at /openapi and a Scalar UI at /docs (auth + main API), both behind basic auth. Core rather than optional: @ApiTags/@ApiProperty decorators are pervasive in the controller and entity conventions, so removing @nestjs/swagger would mean annotating hundreds of lines.

observability
Observability: OpenTelemetry and health checks
On

OpenTelemetry traces, logs and metrics pushed over OTLP (built for OpenObserve; set OPENOBSERVE_URL/ORG/TOKEN, or any OTEL_* backend), plus Terminus health checks with a Prisma indicator. Off at runtime until connected.

Requires http-client

Packages: @nestjs/terminus, @opentelemetry/api, @opentelemetry/core, @opentelemetry/sdk-node, @opentelemetry/auto-instrumentations-node, @opentelemetry/exporter-trace-otlp-proto, @opentelemetry/exporter-logs-otlp-proto, @opentelemetry/exporter-metrics-otlp-proto, @opentelemetry/sdk-logs, @opentelemetry/sdk-metrics, @opentelemetry/resources, @opentelemetry/semantic-conventions, @opentelemetry/instrumentation, @opentelemetry/instrumentation-express, import-in-the-middle, @prisma/instrumentation

Files it owns (6)
  • src/common/controllers/health.controller.ts
  • src/common/misc/prisma.indicator.ts
  • src/common/__tests__/health.controller.spec.ts
  • src/common/__tests__/prisma.indicator.spec.ts
  • src/instrumentation.ts
  • src/telemetry/**
users
Users module
On

Admin-style user listing/lookup gated by permissions, plus the authenticated user's own /me resource and avatar upload.

Requires auth

Files it owns (3)
  • src/users/**
  • test/users.spec.ts
  • test/current-user.spec.ts
media
File uploads (S3)
On

MediaService and S3Service for public and private uploads, with multipart decorators.

Requires auth, queue

Packages: @aws-sdk/client-s3, @types/multer

Files it owns (2)
  • src/media/**
  • src/users/dto/avatar.dto.ts
scheduler
Cron / interval scheduling
On

@nestjs/schedule wired at the root so modules can declare @Cron and @Interval jobs.

Packages: @nestjs/schedule

http-client
Outbound HTTP client
On

@nestjs/axios registered with a default timeout, for calling third-party APIs.

Packages: @nestjs/axios, axios

realtime
Socket.IO realtime layer
Opt-in

An authenticated gateway, Redis-backed presence, a Redis Socket.IO adapter for horizontal scale, and WS auth/permission guards. Opt-in.

Requires cache, auth

Packages: @nestjs/websockets, @nestjs/platform-socket.io, socket.io, @socket.io/redis-adapter

Files it owns (1)
  • src/realtime/**
notifications
Persistent user notifications
Opt-in

A Notification model plus dispatch/read endpoints. Pushes each new notification over the realtime layer when that feature is also on, and persists either way.

Requires auth

Files it owns (3)
  • src/notifications/**
  • prisma/schema/notification.prisma
  • test/notifications.spec.ts
feature-flags
GrowthBook feature flags
Opt-in

A session-aware FeatureFlagGuard and FeatureFlagService for gating routes on flags.

Requires cache, auth, scheduler

Packages: @growthbook/growthbook

Files it owns (2)
  • src/common/services/feature-flag.service.ts
  • src/common/guards/feature-flag.guard.ts
temporal
Temporal client
Opt-in

A TemporalService for starting and querying durable workflows (multi-step, long-waiting or crash-resumable work; BullMQ stays for fire-and-forget jobs), plus Temporal's dev server in compose.yml. Pair it with node-worker or py-worker built --with temporal to run the workflows. Connects lazily, so the API runs while Temporal is down.

Packages: @temporalio/client

Files it owns (2)
  • src/common/services/temporal.service.ts
  • src/common/__tests__/temporal.service.spec.ts
graphql
GraphQL endpoint
Opt-in

Code-first GraphQL via Apollo, registered alongside the REST controllers. Resolvers in any feature module are picked up automatically.

Packages: @nestjs/graphql, @nestjs/apollo, @apollo/server, @as-integrations/express5, graphql

Files it owns (1)
  • src/app.resolver.ts
testing
Vitest unit + e2e suites
On

Two Vitest projects, an AppFactory that boots the real app against real Postgres and Redis, and a test Docker stack.

Requires docker

Packages: vitest, @vitest/coverage-v8, @vitest/ui, @suites/di.nestjs, @suites/doubles.vitest, @suites/unit, @golevelup/ts-vitest, @nestjs/testing, supertest, @types/supertest, fishery, unplugin-swc, dotenv-cli

Files it owns (5)
  • test/**
  • src/**/__tests__/**
  • vitest.config.ts
  • compose.test.yml
  • .env.test.example
docker
Docker Compose + image
On

compose.yml running Postgres and Redis for local dev, a production Dockerfile, and the .bin/dc.ts stack wrapper.

Files it owns (4)
  • Dockerfile
  • .dockerignore
  • compose.yml
  • .bin/dc.ts
ci
Forgejo Actions CI
On

A workflow that spins up the test stack and runs both Vitest projects on pull requests.

Requires secrets

Files it owns (1)
  • .forgejo/**
secrets
Infisical secret sync
On

yarn secrets -e <env> pulls the matching .env file instead of passing secrets around by hand.

Files it owns (1)
  • .bin/secrets.ts
  • openapi is core: @ApiTags and @ApiProperty run through every controller and entity, so removing Swagger would mean rewriting hundreds of lines.
  • mail makes email verification mandatory: new email and password users can’t sign in until they click the link, so SMTP must work in development too.
  • media needs queue (file deletions are jobs). Uploads to folders not listed as private are public-read: the bucket must allow ACLs.
  • notifications stores notifications either way, and pushes each one to the recipient’s sockets when realtime is also on.
  • realtime needs WebSocket upgrades forwarded on /realtime by your reverse proxy.
  • feature-flags polls GrowthBook every 60 seconds (hence scheduler).
  • temporal adds a client only; pair it with a worker built --with temporal.
  • testing off also removes the test Docker stack and .env.test.