nestrs: a NestJS-style framework for Rust built on Axum and Tower
โ Rust ๐ 2026-04-21 ๐ค surdeus ๐๏ธ 2I've been building nestrs, a framework that brings the NestJS module/controller/provider model to Rust, running on top of Axum and Tower.
The motivation was simple: I wanted the structure and ergonomics of NestJS without leaving Rust. Instead of manually wiring Axum routers, state, and middleware across a growing codebase, nestrs gives you a familiar architecture with proc macros doing the heavy lifting.
Here is what a basic controller looks like:
#[module(controllers = [UserController], providers = [UserService])]
struct UserModule;
#[controller(prefix = "/users")]
struct UserController;
#[routes(state = UserService)]
impl UserController {
#[get("/:id")]
async fn find_one(
Path(id): Path<u32>,
State(svc): State<Arc<UserService>>,
) -> impl IntoResponse {
svc.find(id).await
}
}
What is included:
- Module/controller/provider architecture with proc macros
- DI container and application context
- Guards, pipes, interceptors, exception filters
- DTO validation pipeline (
#[dto]with validator-style ergonomics) - Production controls: backpressure, rate limiting, request tracing, metrics, graceful shutdown
- Optional crates for OpenAPI, GraphQL, WebSockets, microservices (Kafka, gRPC, NATS, MQTT, RabbitMQ), Prisma/SQLx integration, and CQRS
- Scaffolding CLI (
nestrs-scaffold) for generating modules and resources
Currently at v0.3.8, still pre-1.0. The core HTTP layer and DI are stable enough to build on, but the API can still shift before 1.0.
Repo: GitHub - Joshyahweh/nestrs: Nestrs is a Rust web framework that lets you build structured APIs using the same architectural patterns as NestJS โ modules, controllers, providers, and dependency injection โ while running on Axum and Tower. If your team already knows NestJS, nestrs gives you the same mental model with Rustโs performance and safety guarantees. โ ยท GitHub
Docs: https://nestrs.mintlify.app/
I would really value feedback from this community, especially on API design, ergonomics, anything that looks wrong from an idiomatic Rust perspective, or things you would prioritise differently. Still early, so honest criticism is more useful than encouragement right now.
5 posts - 3 participants
๐ท๏ธ Rust_feed