Rust · NestJS-style modules & decorators
The Rust framework for modular, scalable backends.
Measured on NestRS 7.0 against NestJS 12.4 on node:http, its fastest adapter, one core each, byte-identical contract — the harness is in the repo.
01 — NEW IN 7.0
The foundation the next releases build on
Section titled “The foundation the next releases build on”7.0 is the release the next ones stand on. Each concern has one way to be declared and one contract on every edge, and the boot refuses what would fail in production. What comes next adds to it: no minor or patch breaks what you build on top.
What 7.0 brings, part by part, each with the page that holds it. What’s new in 7.0 →
02 — SECURITY
The part you cannot forget
Section titled “The part you cannot forget”A controller that looks like any controller — the security is in what you don’t write. Two declarations, and every route is authenticated, tenant-scoped and field-masked.
Two guards on the struct. Every route below requires a valid token and an ability — forgetting one is a boot error, not a 3am incident.
The handlers are generated. No security code inside — rows are filtered and fields masked on the way out, automatically.
Policy lives in one place. Which rows, which fields, for whom — one ability rule, applied to every transport.
#[controller(path = "/users")]#[use_guards(AuthnGuard, AuthzGuard)]● 1pub struct UsersController { #[inject] svc: Arc<UsersService>,} #[crud(service = UsersService)]● 2impl UsersController {}
ab.can(Action::Read, user::Entity) .when(|p| p.eq(user::Column::OrgId, actor.org_id)) // your org only .fields([user::Column::Id, user::Column::Name]); // email never leaves● 3
❯ curl :3002/users -H "…Bearer $ADMIN"[{ "name": "Acme Admin", "email": "admin@acme.test", … }] ❯ curl :3002/users -H "…Bearer $MEMBER"[{ "id": "…", "name": "Acme Admin" }] # email masked, org-scoped ❯ curl :3002/users/<globex-id> -H "…$MEMBER"403 # cross-tenant read refused, by the framework
03 — PERFORMANCE
How fast, exactly
Section titled “How fast, exactly”NestRS 7.0 against NestJS 12.4 on node:http — the adapter NestJS recommends and
measures ahead of Express and Fastify, so the one worth racing. Same service,
byte-identical contract, one pinned core each, the regime that favours Node.
just bench in bench/ runs the protocol on your hardware.
04 — BATTERIES
Everything a backend needs
Section titled “Everything a backend needs”Not a router with plugins to assemble. Each concern is a module you import, shipped as a Cargo feature you can leave off — a headless worker compiles no HTTP stack.
31 capabilities, one dependency to install them. Packages →
05 — GUARANTEES
Why developers pick NestRS
Section titled “Why developers pick NestRS”Authn, row-level filtering, response masking, transaction scope — turned on by importing a module, never by remembering to call them.
The DI graph is checked at boot: a bad import fails startup with the missing wire named. No resolution error five minutes after deploy.
78 decorators expanding to plain Rust you can read with cargo expand — no reflection, no magic strings.
Rust types end to end — entity, DTO, handler, schema, OpenAPI doc. No any, no casts at the boundaries.
×2 NestJS on node:http, its fastest adapter, on a guarded route — with a sub-millisecond p99 and no GC pauses.
A native binary for a distroless image — ~10 MB under load, ~10 ms to boot, probes for the orchestrator.
06 — SCALABILITY
A modular monolith, deployed per workload
Section titled “A modular monolith, deployed per workload”Entities, services and policy live once in a shared features crate; each app
under apps/* is a thin composition root importing only the transports it
serves. Every workload scales on its own signal, and one app importing them all
is a plain monolith: microservice scaling without the distributed-systems tax.
Who runs where is a composition choice in each app's module.rs, not a fork of entities and services.
Same binary, more replicas, per app — a hot public surface follows demand, background apps follow queue depth. No single "scale the monolith" knob.
Service Weaver’s goal, with the queue and the database where it draws RPC. The architecture →
Start where you are
Section titled “Start where you are”Coming from NestJS, the vocabulary carries over. Coming from Rust, the drift-prone parts stop being yours to police.
❯ nestrs new helloGet started