OSS Rust Web framework inspired by Nest.js

Vicbona1 pts0 comments

Nidus Rust backend framework

Rust backend framework · 1.0.4

Nidus

A modular Rust backend framework for explicit services: typed dependency injection, module graphs, Axum routes, Tower middleware, validation, OpenAPI, observability, testing, and installable adapters.

Get started<br>Docs<br>Examples<br>GitHub

Typed DI<br>Axum routes<br>OpenAPI<br>Production defaults<br>Release 1.0.4

Starter flow<br>cargo install cargo-nidus --version 1.0.4<br>cargo nidus new hello-nidus<br>cd hello-nidus<br>cargo run

Copy

use nidus::prelude::*;

#[controller("/users")]<br>struct UsersController {<br>service: Inject,

#[module(<br>providers(UsersService),<br>controllers(UsersController)<br>)]<br>struct AppModule;

Evaluation path

A senior Rust engineer should know where to start in under a minute.

01<br>Install<br>Get the CLI and facade dependency shape.

02<br>Mental model<br>See what happens at build time, startup, and per request.

03<br>Examples<br>Jump to runnable services, including launchpad-api.

04<br>Production<br>Inspect HTTP defaults and deployment boundaries.

Core model

Framework structure without hidden runtime magic.

01<br>Module graph

Declare imports, providers, controllers, and exports in Rust. The graph stays visible to source inspection.

02<br>Typed providers

Register dependencies by type with singleton, transient, request-scoped, lazy, optional, and factory patterns.

03<br>HTTP boundary

Compose Axum routers, Tower layers, guards, validation pipes, OpenAPI metadata, and error envelopes.

04<br>Runtime proof

Use CLI inspectors and TestApp to verify route shape, module graph, OpenAPI output, and request behavior.

Framework surfaces

The 1.0 surface is broad, but not blurry.

Modules<br>Explicit imports, providers, controllers, exports, and graph validation.

Controllers<br>Axum-backed route composition with Nidus metadata where it matters.

Dependency injection<br>Typed providers, factories, request scope, optional dependencies, and overrides.

Guards<br>Authorization boundaries as Rust types instead of hidden decorators.

Validation<br>garde-backed DTO validation and stable error responses.

OpenAPI<br>Inspectable route metadata and generated documents from source.

Lean core

The facade stays narrow. Adapters opt in.

Nidus does not smuggle vendor dependencies into every app. SQLx and cache support live in official crates with direct access to the underlying ecosystem clients.

nidus<br>nidus-core<br>nidus-http<br>nidus-openapi<br>nidus-validation<br>nidus-sqlx<br>nidus-cache<br>cargo-nidus

Examples

Learn the framework from runnable services.

The examples move from a first controller to production-shaped services, adapter wiring, and external app templates. Use them as a guided tour of the public crates before choosing your own service shape.

View all examples

Start small

hello-world and launchpad-api show the first controller, module, and server loop.

Build real services

realworld-api and production-api cover validation, health, metrics, guards, limits, events, and jobs.

Add adapters

sqlx-app, cache-app, and integrations-production show optional official crates without bloating core.

Copy from outside

external-support-desk and external-commerce use crates.io-style manifests for app-shaped examples.

Benchmark evidence

Measured against production-shaped peers, with bounded claims.

A homelab Kubernetes run compared Rust/Nidus, FastAPI, Spring Boot, and Express against the same PostgreSQL-backed endpoint contract. The run is intentionally conservative, but the latency story is clear.

Read the full benchmark breakdown

Fastest ping latency<br>423.72us<br>Rust/Nidus average on the read-only ping profile.

Zero failed requests<br>0.00% failed<br>Every stack completed the k6 profiles without HTTP failures.

Best write-heavy profile<br>423.94/s<br>Rust/Nidus on the projects flow under the paced workload.

Release proof

Trust comes from bounded claims.

Install path<br>CLI install, facade dependency, and adapter crates are separated in docs.

Runtime defaults<br>Request IDs, context, health, metrics, CORS, limits, timeouts, security headers, tracing.

Examples<br>launchpad-api and realworld-api exercise modules, validation, OpenAPI, health, metrics, events, and jobs.

Release boundary<br>Local dry-runs prove packageability; crates.io, docs.rs, and Pages deployment stay explicit external steps.

Nidus 1.0.4<br>Apache-2.0 OR MIT<br>Source

nidus rust validation framework openapi examples

Related Articles