Why nestrs exists
Large Rust web applications tend to grow into ad-hoc routing files and scattered shared state. nestrs gives you a principled way to organize that code: every feature lives in a module, handlers live in controllers, and shared logic lives in injectable providers. The framework handles wiring them together so you focus on business logic.Get started in minutes
Scaffold a new project with the CLI and hit your first endpoint in under 5 minutes.
Add nestrs to existing projects
Add the crate and configure Cargo feature flags for the capabilities you need.
Migrate from NestJS
Side-by-side mapping of NestJS decorators to nestrs macros and patterns.
Explore the ecosystem
GraphQL, OpenAPI, WebSockets, microservices, caching, scheduling, and more.
The module / controller / provider model
nestrs organises your application into three building blocks that map directly onto NestJS concepts.
A minimal application wires these together in a few dozen lines of Rust:
nestrs assumes comfort with Rust ownership,
async/await, and Cargo. It does not replicate NestJS’s TypeScript-first teaching path — it maps NestJS patterns onto idiomatic Rust.Key features
Dependency injection
Register providers once in a module; nestrs resolves and injects them automatically into your handlers.
Route macros
#[get], #[post], #[put], #[delete], and #[patch] decorators on handler functions inside a #[routes] impl block.DTO validation
#[dto] + #[IsEmail], #[Length], and other validation macros powered by the validator crate.Middleware pipeline
Tower middleware layers — CORS, rate limiting, request IDs, tracing, and compression — applied through the
NestApplication builder.API versioning
#[version(...)] on a controller and #[ver(...)] on individual routes for URI-segment versioning.Microservices
Transport adapters for NATS, Redis, Kafka, MQTT, RabbitMQ, and gRPC through the
microservices feature family.Observability
Built-in Prometheus metrics endpoint, request tracing, and OpenTelemetry export via the
otel feature.CLI scaffolding
nestrs new and nestrs generate create projects and resource skeletons in seconds.Ecosystem crates
nestrs is a thin façade over a set of focused crates. You can depend on them individually or pull them in through feature flags on the mainnestrs crate.