Skip to content

nest-monorepo features

Generated from templates/nest-monorepo/template.json. Drop a default with --without, add an opt-in with --with.

FeatureDefaultWhat it adds
prisma
Prisma ORM + Postgres (shared packages/db)
Always

The schema, migrations and generated client live in packages/db and every app imports @scope/db/client. The client is generated as CommonJS and compiled, so the CommonJS API and the ESM worker load the same build. The API owns migrations; its db:* scripts run Prisma there.

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)
  • apps/api/src/common/services/cache.service.ts
  • apps/api/src/common/utils/redis.keys.ts
  • apps/api/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 (2)
  • apps/api/src/common/modules/queue.module.ts
  • apps/api/.claude/skills/add-job/**
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 (7)
  • apps/api/src/common/services/mail.service.ts
  • apps/api/src/common/processors/**
  • apps/api/src/common/types/email.ts
  • apps/api/emails/**
  • apps/api/__mocks__/**
  • apps/api/src/common/__tests__/mail.service.spec.ts
  • apps/api/.claude/skills/add-email/**
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)
  • apps/api/src/common/services/throttler-storage.service.ts
  • apps/api/src/common/services/auth-rate-limit.storage.ts
  • apps/api/src/lib/rate-limit.ts
  • apps/api/src/common/utils/ip.ts
  • apps/api/src/common/__tests__/throttler-storage.service.spec.ts
  • apps/api/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 from every app (built for OpenObserve; set OPENOBSERVE_URL/ORG/TOKEN, or any OTEL_* backend), plus Terminus health checks with a Prisma indicator in the API. 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 (7)
  • apps/api/src/common/controllers/health.controller.ts
  • apps/api/src/common/misc/prisma.indicator.ts
  • apps/api/src/common/__tests__/health.controller.spec.ts
  • apps/api/src/common/__tests__/prisma.indicator.spec.ts
  • apps/api/src/instrumentation.ts
  • apps/api/src/telemetry/**
  • apps/worker/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)
  • apps/api/src/users/**
  • apps/api/test/users.spec.ts
  • apps/api/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)
  • apps/api/src/media/**
  • apps/api/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 (2)
  • apps/api/src/realtime/**
  • apps/api/.claude/skills/add-realtime-event/**
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 (4)
  • apps/api/src/notifications/**
  • packages/db/prisma/schema/notification.prisma
  • apps/api/test/notifications.spec.ts
  • apps/api/.claude/skills/add-notification/**
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)
  • apps/api/src/common/services/feature-flag.service.ts
  • apps/api/src/common/guards/feature-flag.guard.ts
temporal
Temporal client
Opt-in

A TemporalService in the API that starts and queries durable workflows, Temporal's dev server in compose.yml, and (with app-worker) a Temporal worker running the workflows and activities in apps/worker/src/temporal. The worker image switches to Debian, since Temporal's native core does not load on Alpine.

Packages: @temporalio/client, protobufjs, @temporalio/activity, @temporalio/worker, @temporalio/workflow

Files it owns (4)
  • apps/api/src/common/services/temporal.service.ts
  • apps/api/src/common/__tests__/temporal.service.spec.ts
  • apps/worker/src/temporal/**
  • apps/worker/.claude/skills/add-workflow/**
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)
  • apps/api/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

Files it owns (6)
  • apps/api/test/**
  • apps/api/src/**/__tests__/**
  • apps/api/vitest.config.ts
  • compose.test.yml
  • apps/api/.env.test.example
  • .forgejo/workflows/test-e2e.yml
docker
Docker Compose + images
On

One compose.yml (Postgres, Redis) shared by every app, and a turbo-pruned production image per app built from the monorepo root, with a migrate target on the API image that runs prisma migrate deploy.

Files it owns (6)
  • apps/api/Dockerfile
  • .dockerignore
  • compose.yml
  • apps/api/.bin/dc.ts
  • apps/worker/Dockerfile
  • apps/worker/Dockerfile.dev
ci
Forgejo Actions CI
On

Root Forgejo workflows: lint, typecheck, test and build every workspace on branches, the API's e2e suite on pull requests, and every image built and pushed under one shared tag.

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.

Packages: @aurostack/secrets

Files it owns (2)
  • apps/api/infisical.jsonc
  • apps/worker/infisical.jsonc
worker-queue
Worker: BullMQ consumers
On

Worker processes pulling from the same Redis queues the API produces to. Only with app-worker.

Packages: bullmq, bullmq-otel, ioredis

Files it owns (3)
  • apps/worker/src/utils/worker.ts
  • apps/worker/src/workers/**
  • apps/worker/.claude/skills/add-worker/**
worker-browser
Worker: headless browser (Puppeteer)
Opt-in

For rendering or scraping pages that need JavaScript executed. Heavy: the worker image grows by roughly 800 MB (Chromium and its fonts). Only with app-worker.

Packages: puppeteer

Files it owns (1)
  • apps/worker/src/utils/browser.ts
worker-pm2
Worker: PM2 process manager
On

ecosystem.config.cjs, and pm2-runtime as the worker image's entrypoint. Only with app-worker.

Files it owns (1)
  • apps/worker/ecosystem.config.cjs
app-worker
Background worker app
On

apps/worker: a standalone TypeScript worker (BullMQ consumers, pino logging) reading and writing the API's database through the shared @scope/db client. The worker-* features only apply when it is on.

Files it owns (1)
  • apps/worker/**
  • The API’s features keep their names (queue, realtime, testing…) and do what they do in nest-api.
  • The worker’s are prefixed where a name would collide: worker-queue, worker-browser, worker-pm2. They only apply with app-worker; without it they are listed in stack.json but change nothing.
  • Shared features cover both apps. observability is the API’s OpenTelemetry setup and the worker’s telemetry; temporal is the API’s client and the worker’s Temporal worker; docker, ci and secrets cover every app.
  • temporal switches the worker image to node:24-bookworm-slim, as in node-worker: Temporal’s native core doesn’t load on Alpine.
  • app-worker off gives an API-only monorepo. stack add app-worker brings the worker in later, exactly as if it had been generated with it.