nest-monorepo features
Generated from templates/nest-monorepo/template.json. Drop a default with
--without, add an opt-in with --with.
| Feature | Default | What it adds |
|---|---|---|
prismaPrisma 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. |
configZod-validated config service | Always | CustomConfigService wrapping @nestjs/config; app code never reads process.env directly. |
authbetter-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. |
cacheRedis cache | On | CacheService on ioredis, plus the key-namespacing helpers. Required by the queue, throttler and realtime layers. Files it owns (3)
|
queueBullMQ background jobs | On | QueueModule.register(), the Bull Board dashboard at /dashboard behind basic auth. Files it owns (2)
|
mailTransactional email | On | MailService enqueuing onto the Files it owns (7)
|
rate-limitTwo-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. Files it owns (6)
|
openapiOpenAPI + 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. |
observabilityObservability: 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. Files it owns (7)
|
usersUsers module | On | Admin-style user listing/lookup gated by permissions, plus the authenticated user's own /me resource and avatar upload. Files it owns (3)
|
mediaFile uploads (S3) | On | MediaService and S3Service for public and private uploads, with multipart decorators. Files it owns (2)
|
schedulerCron / interval scheduling | On | @nestjs/schedule wired at the root so modules can declare @Cron and @Interval jobs. |
http-clientOutbound HTTP client | On | @nestjs/axios registered with a default timeout, for calling third-party APIs. |
realtimeSocket.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. Files it owns (2)
|
notificationsPersistent 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. Files it owns (4)
|
feature-flagsGrowthBook feature flags | Opt-in | A session-aware FeatureFlagGuard and FeatureFlagService for gating routes on flags. Files it owns (2)
|
temporalTemporal 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. Files it owns (4)
|
graphqlGraphQL endpoint | Opt-in | Code-first GraphQL via Apollo, registered alongside the REST controllers. Resolvers in any feature module are picked up automatically. Files it owns (1)
|
testingVitest unit + e2e suites | On | Two Vitest projects, an AppFactory that boots the real app against real Postgres and Redis, and a test Docker stack. Files it owns (6)
|
dockerDocker 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 Files it owns (6)
|
ciForgejo 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. Files it owns (1)
|
secretsInfisical secret sync | On |
Files it owns (2)
|
worker-queueWorker: BullMQ consumers | On | Worker processes pulling from the same Redis queues the API produces to. Only with app-worker. Files it owns (3)
|
worker-browserWorker: 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. Files it owns (1)
|
worker-pm2Worker: PM2 process manager | On | ecosystem.config.cjs, and pm2-runtime as the worker image's entrypoint. Only with app-worker. Files it owns (1)
|
app-workerBackground 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)
|
- 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 withapp-worker; without it they are listed instack.jsonbut change nothing. - Shared features cover both apps.
observabilityis the API’s OpenTelemetry setup and the worker’stelemetry;temporalis the API’s client and the worker’s Temporal worker;docker,ciandsecretscover every app. temporalswitches the worker image tonode:24-bookworm-slim, as in node-worker: Temporal’s native core doesn’t load on Alpine.app-workeroff gives an API-only monorepo.stack add app-workerbrings the worker in later, exactly as if it had been generated with it.