Supported Apps
tsdevstack supports multiple application types within a single monorepo.
App types
NestJS Services
Backend API services built with NestJS. These are the core of most tsdevstack projects.
Services get:
- Auto-generated Kong gateway routes
- OpenAPI documentation from decorators
- Generated HTTP client libraries with DTOs
- Database connections (Postgres, Redis)
- Framework authentication
Workers
Workers process background jobs using BullMQ and Redis. They live inside a service's codebase and share its database access and dependencies, but run as their own process, which always runs.
A worker has three parts: a processor that handles jobs, a producer (any service code) that enqueues them, and a module that wires everything together.
Queue processors run only in workers, never inside a service. A service on GCP or Azure can scale to zero, and on GCP a service that does gets CPU only while it handles a request. A processor inside it would stop until the next request. A worker never stops.
A worker needs these files in its service. register-detached-worker (below) creates whichever are missing, and the two scripts; the processors are yours:
And two scripts in the service's package.json:
worker.ts calls startWorker() from nest-common, which bootstraps a NestJS application context (no HTTP server) with a health endpoint for container orchestration:
npm run dev starts every service and every worker. Locally the worker compiles into its own folder, so the worker and its service don't delete and rewrite each other's dist:
In the cloud, a worker runs once you register it as a detached worker. The framework then deploys a separate container from the same Docker image, with node dist/worker.js as the entrypoint:
It also creates the worker's files and scripts that its service doesn't have yet. It never overwrites a file, and it lists what it created and what it left alone. A new worker.module.ts has no queues: register each queue there with BullModule.registerQueue and add its processor to providers.
Detached workers get their own Cloud Run / ECS / Container Apps instance with CPU always allocated. Like services, workers are configurable in infrastructure.json: you can set minInstances, maxInstances, cpu, and memory. Workers run at least 1 instance (they must always be running to poll Redis queues).
The auth template comes with a worker, auth-worker, which sends the auth service's emails.
Enqueueing jobs
Any service code can dispatch jobs by injecting a queue:
The queue name must be registered in both the producer's module and the worker's module.
Next.js Frontend
Server-rendered React applications built with Next.js.
SPA Applications
Single-page applications built with any framework that uses Rsbuild.
The framework executes the Rsbuild build after registering the app, so any Rsbuild-compatible setup works.
Monorepo structure
All apps live in a single monorepo:
Generated HTTP clients
When you build a NestJS service, tsdevstack generates a typed HTTP client package:
These clients have separate exports for different use cases:
In frontend apps - import as an HTTP client:
In NestJS services - import the HTTP client and/or the DTOs directly:
This eliminates the need for separate shared type packages - all types flow from the OpenAPI spec.