Packages
NestRS is a monorepo of crates, not one fat dependency. Each concern — HTTP, GraphQL, queues, authorization, observability — is a separate package you import only when the binary needs it. A headless worker compiles no HTTP stack; an MCP-only assistant compiles no GraphQL schema.
The recommended install path is depending on the individual nest-rs-*
crates you need — it is what nestrs new scaffolds, what every exemplar
app in the Publish workspace does, and what each module’s adoption page
means by cargo add nest-rs-<crate>. The
nest-rs
umbrella (one dependency, surface crates behind Cargo features such as
features = ["http", "seaorm", "graphql"], plus nest_rs::prelude) is an
optional convenience for quick experiments — same crates underneath, less
control over the graph.
Umbrella
Section titled “Umbrella”| Crate | Cargo feature | What it is | Docs |
|---|---|---|---|
nest-rs | (always) | Re-exports core + optional surface crates; nest_rs::prelude for the common case | Getting started |
nest-rs-core | (via umbrella) | DI container, #[module], lifecycle hooks, boot-time access graph | Fundamentals |
Transports
Section titled “Transports”Each transport is a module you import in AppModule. HTTP-shaped surfaces
(GraphQL, OpenAPI, MCP, WebSocket gateways) mount on the same
HttpTransport — one port, one TLS config.
| Crate | Cargo feature | What it is | Docs |
|---|---|---|---|
nest-rs-http | http | HTTP transport — controllers, routes, extractors, built on poem | HTTP |
nest-rs-graphql | graphql | Resolver discovery, schema composition, async-graphql integration | GraphQL |
nest-rs-ws | ws | WebSocket gateways — self-mount on the HTTP transport | WebSockets |
nest-rs-openapi | openapi | OpenAPI 3 document + bundled Swagger UI from the route table | OpenAPI |
nest-rs-mcp | mcp | Model Context Protocol server over HTTP | MCP |
| Crate | Cargo feature | What it is | Docs |
|---|---|---|---|
nest-rs-database | database | ORM-agnostic executor seam — ambient request/job context any driver implements | Database · Writing a driver |
nest-rs-seaorm | seaorm | First-class SeaORM integration — DatabaseModule, Repo, transactions, dataloaders | Database |
nest-rs-resource | (direct dep) | #[expose] — one entity declaration for GraphQL + OpenAPI + CRUD helpers | CRUD · Relations |
nest-rs-storage | storage | S3-compatible object storage — injectable Storage, presigned URLs, via object_store | Storage |
Security
Section titled “Security”Authentication answers who; authorization answers what they may do.
Product-specific strategies and policies live in your features crate —
these crates are the engine.
| Crate | Cargo feature | What it is | Docs |
|---|---|---|---|
nest-rs-authn | authn | JWT service, pluggable Strategy, AuthGuard | Authentication |
nest-rs-authz | authz | CASL-style abilities — access gate, row-level filter, response masking | Authorization |
Request pipeline
Section titled “Request pipeline”Cross-cutting layers shared across HTTP, GraphQL, and WebSockets. Bind them
globally on App::builder() or per controller / resolver / gateway.
| Crate | Cargo feature | What it is | Docs |
|---|---|---|---|
nest-rs-guards | (direct dep) | The Guard trait — gates access before the handler runs | Guards |
nest-rs-pipes | (direct dep) | Stateless input validation and transformation at the edge | Pipes |
nest-rs-interceptors | (direct dep) | Wrap handler execution — logging, transactions, ability scope | Interceptors |
nest-rs-filters | (direct dep) | Map inner errors to transport responses | Exception filters |
nest-rs-exception-filters | (direct dep) | Typed exception filters — catch one concrete error type | Exception filters |
Background work
Section titled “Background work”| Crate | Cargo feature | What it is | Docs |
|---|---|---|---|
nest-rs-queue | queue | Backend-agnostic job contract + #[process] registry | Queue |
nest-rs-redis | redis | Redis-backed producer and worker (via apalis) | Queue wiring |
nest-rs-schedule | schedule | Cron-style scheduled jobs — #[scheduled] + ScheduleModule | Schedule |
nest-rs-events | events | Typed in-process event bus — #[listeners] / #[on_event] | Events |
nest-rs-worker | (direct dep) | Ambient job context seam for off-request transports | Queue · Writing a driver |
Platform
Section titled “Platform”| Crate | Cargo feature | What it is | Docs |
|---|---|---|---|
nest-rs-config | config | Namespaced env + file config bound to typed #[config] structs | Configuration |
nest-rs-health | health | Kubernetes-style liveness / readiness / startup probes | Health |
nest-rs-throttler | throttler | Per-route rate limiting via ThrottlerGuard | Throttler |
nest-rs-opentelemetry | opentelemetry | Logs, traces, metrics, W3C propagation, OTLP export | OpenTelemetry |
nest-rs-server-timing | server-timing | W3C Server-Timing response header (independent of OTel) | Server-Timing |
Developer tools
Section titled “Developer tools”| Crate | Cargo feature | What it is | Docs |
|---|---|---|---|
nest-rs-cli | (binary: nestrs) | Scaffold workspaces, generate features, project health checks | CLI |
nest-rs-testing | testing | In-process harness — boot the real DI graph, drive HTTP/GraphQL/MCP without a socket | Testing |
Typical binary profiles
Section titled “Typical binary profiles”These are composition patterns, not separate crates — they show which packages a deployable usually pulls in.
| Binary role | Packages you typically import |
|---|---|
| REST + OpenAPI API | http, openapi, config, seaorm, authn, authz, health, opentelemetry |
| GraphQL API | http, graphql, config, seaorm, authn, authz, opentelemetry |
| WebSocket live service | http, ws, config, seaorm, authn, authz |
| Queue worker | queue, redis, schedule, seaorm, config, opentelemetry |
| MCP assistant | http, mcp, config, authn, authz |
| Token issuer | http, config, seaorm, authn |
See The Publish workspace for six real apps that follow these profiles.
Not listed here
Section titled “Not listed here”Internal macro crates (nest-rs-*-macros, nest-rs-codegen) implement
the decorators — you never add them as direct dependencies; the surface crate
re-exports what you need. For a decorator index see
Decorators.
Your product’s features crate holds domain modules (entities, services,
controllers per transport). It is workspace-local and not published to
crates.io — copy crates/features/src/users/
as the exemplar.
Adding a crate to your app
Section titled “Adding a crate to your app”List the individual crates the binary needs — this is the real
apps/api/Cargo.toml (REST + GraphQL + DB + authz), trimmed to the
framework lines:
[dependencies]nest-rs-core.workspace = truenest-rs-config.workspace = truenest-rs-http.workspace = truenest-rs-graphql.workspace = truenest-rs-openapi.workspace = truenest-rs-seaorm = { workspace = true, features = ["http", "graphql", "health"] }nest-rs-authn.workspace = truenest-rs-authz = { workspace = true, features = ["http", "graphql"] }nest-rs-health.workspace = truenest-rs-opentelemetry = { workspace = true, features = ["http"] }In a fresh project outside this workspace, the same line is
cargo add nest-rs-<crate> — exactly what each module’s adoption page
shows. Then import the matching modules in AppModule — for example
HttpModule::for_root(...), DatabaseModule::for_root(...),
GraphqlModule, AuthzHttpModule. The Publish workspace and
Getting started walk through a full composition.
Prefer one dependency for a quick experiment? The umbrella collapses the list:
[dependencies]nest-rs = { version = "0.2", features = ["http", "seaorm", "graphql"] }Same crates underneath; switch to per-crate dependencies when the app hardens.