Getting started
Prerequisites
Section titled “Prerequisites”NestRS needs Rust 1.96+ (edition 2024). Install rustup if you don’t have it:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shThen the CLI:
cargo install --locked nest-rs-cliThat’s the only thing you install by hand. The first time you run a task with
nestrs run, the CLI installs the dev toolchain it drives —
just for the recipes, bacon for watch mode,
cargo-nextest for tests — once, then never again. Set NESTRS_NO_BOOTSTRAP=1
(or pass --no-bootstrap) on CI to opt out and install them yourself.
Budget a few minutes for the first build: cargo install nest-rs-cli and your
first nestrs run compile the CLI and the framework from source. Every build
after that is an incremental, sub-second rebuild.
Scaffold and start
Section titled “Scaffold and start”Pick a layout — a workspace (monorepo: shared crates/features/, one binary
per app under apps/) or a standalone crate (everything in src/).
Either way the scaffold depends on the individual nest-rs-* crates it
needs — that is the recommended install path throughout these docs (each
module page adds one cargo add nest-rs-<crate> line). The nest-rs
umbrella crate is an optional shortcut; see Packages.
-
Scaffold.
Terminal window nestrs new hellocd hello -
Start the default app.
Terminal window nestrs run dev helloOpen http://localhost:3000/ —
Hello World, served fromcrates/features/src/hello/.apps/hello/only wires modules.
-
Scaffold.
Terminal window nestrs new hello --standalonecd hello -
Start it.
Terminal window nestrs run devOpen http://localhost:3000/ —
Hello World, fromsrc/.
Hello World needs nothing else — no database, no containers, no config.
Verify it, then look at what you got (bare nestrs run lists every recipe):
$ curl http://localhost:3000/Hello WorldWhat you just generated
Section titled “What you just generated”One thin controller over one service — the shape every feature follows:
use std::sync::Arc;
use nest_rs_http::{controller, routes};
use crate::service::HelloService;
#[controller(path = "/")]pub struct HelloController { #[inject] svc: Arc<HelloService>,}
#[routes]impl HelloController { #[get("/")] async fn hello(&self) -> String { self.svc.greeting() }}Make your first change
Section titled “Make your first change”Edit the greeting in src/service.rs, save, and nestrs run dev hot-reloads —
then curl again:
fn greeting(&self) -> String { "Hello, NestRS".to_string() // was "Hello World"}$ curl http://localhost:3000/Hello, NestRSThat’s the loop — edit, save, curl. Every reference section builds on it.
Going further
Section titled “Going further”- Tutorial — add
apps/blog/withnestrs new blogand build posts over HTTP. - The demo apps (Publish) — the multi-tenant publishing platform all the reference apps build.
- CLI — scaffold apps, features, and transport adapters.
- Fundamentals — modules, providers, guards, pipes, interceptors, filters.