Skip to content

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.

CrateCargo featureWhat it isDocs
nest-rs(always)Re-exports core + optional surface crates; nest_rs::prelude for the common caseGetting started
nest-rs-core(via umbrella)DI container, #[module], lifecycle hooks, boot-time access graphFundamentals

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.

CrateCargo featureWhat it isDocs
nest-rs-httphttpHTTP transport — controllers, routes, extractors, built on poemHTTP
nest-rs-graphqlgraphqlResolver discovery, schema composition, async-graphql integrationGraphQL
nest-rs-wswsWebSocket gateways — self-mount on the HTTP transportWebSockets
nest-rs-openapiopenapiOpenAPI 3 document + bundled Swagger UI from the route tableOpenAPI
nest-rs-mcpmcpModel Context Protocol server over HTTPMCP
CrateCargo featureWhat it isDocs
nest-rs-databasedatabaseORM-agnostic executor seam — ambient request/job context any driver implementsDatabase · Writing a driver
nest-rs-seaormseaormFirst-class SeaORM integration — DatabaseModule, Repo, transactions, dataloadersDatabase
nest-rs-resource(direct dep)#[expose] — one entity declaration for GraphQL + OpenAPI + CRUD helpersCRUD · Relations
nest-rs-storagestorageS3-compatible object storage — injectable Storage, presigned URLs, via object_storeStorage

Authentication answers who; authorization answers what they may do. Product-specific strategies and policies live in your features crate — these crates are the engine.

CrateCargo featureWhat it isDocs
nest-rs-authnauthnJWT service, pluggable Strategy, AuthGuardAuthentication
nest-rs-authzauthzCASL-style abilities — access gate, row-level filter, response maskingAuthorization

Cross-cutting layers shared across HTTP, GraphQL, and WebSockets. Bind them globally on App::builder() or per controller / resolver / gateway.

CrateCargo featureWhat it isDocs
nest-rs-guards(direct dep)The Guard trait — gates access before the handler runsGuards
nest-rs-pipes(direct dep)Stateless input validation and transformation at the edgePipes
nest-rs-interceptors(direct dep)Wrap handler execution — logging, transactions, ability scopeInterceptors
nest-rs-filters(direct dep)Map inner errors to transport responsesException filters
nest-rs-exception-filters(direct dep)Typed exception filters — catch one concrete error typeException filters
CrateCargo featureWhat it isDocs
nest-rs-queuequeueBackend-agnostic job contract + #[process] registryQueue
nest-rs-redisredisRedis-backed producer and worker (via apalis)Queue wiring
nest-rs-schedulescheduleCron-style scheduled jobs — #[scheduled] + ScheduleModuleSchedule
nest-rs-eventseventsTyped in-process event bus — #[listeners] / #[on_event]Events
nest-rs-worker(direct dep)Ambient job context seam for off-request transportsQueue · Writing a driver
CrateCargo featureWhat it isDocs
nest-rs-configconfigNamespaced env + file config bound to typed #[config] structsConfiguration
nest-rs-healthhealthKubernetes-style liveness / readiness / startup probesHealth
nest-rs-throttlerthrottlerPer-route rate limiting via ThrottlerGuardThrottler
nest-rs-opentelemetryopentelemetryLogs, traces, metrics, W3C propagation, OTLP exportOpenTelemetry
nest-rs-server-timingserver-timingW3C Server-Timing response header (independent of OTel)Server-Timing
CrateCargo featureWhat it isDocs
nest-rs-cli(binary: nestrs)Scaffold workspaces, generate features, project health checksCLI
nest-rs-testingtestingIn-process harness — boot the real DI graph, drive HTTP/GraphQL/MCP without a socketTesting

These are composition patterns, not separate crates — they show which packages a deployable usually pulls in.

Binary rolePackages you typically import
REST + OpenAPI APIhttp, openapi, config, seaorm, authn, authz, health, opentelemetry
GraphQL APIhttp, graphql, config, seaorm, authn, authz, opentelemetry
WebSocket live servicehttp, ws, config, seaorm, authn, authz
Queue workerqueue, redis, schedule, seaorm, config, opentelemetry
MCP assistanthttp, mcp, config, authn, authz
Token issuerhttp, config, seaorm, authn

See The Publish workspace for six real apps that follow these profiles.

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.

List the individual crates the binary needs — this is the real apps/api/Cargo.toml (REST + GraphQL + DB + authz), trimmed to the framework lines:

apps/api/Cargo.toml
[dependencies]
nest-rs-core.workspace = true
nest-rs-config.workspace = true
nest-rs-http.workspace = true
nest-rs-graphql.workspace = true
nest-rs-openapi.workspace = true
nest-rs-seaorm = { workspace = true, features = ["http", "graphql", "health"] }
nest-rs-authn.workspace = true
nest-rs-authz = { workspace = true, features = ["http", "graphql"] }
nest-rs-health.workspace = true
nest-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.