Skip to content

Getting started

NestRS needs Rust 1.96+ (edition 2024). Install rustup if you don’t have it:

Terminal window
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then the CLI:

Terminal window
cargo install --locked nest-rs-cli

That’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.

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.

  1. Scaffold.

    Terminal window
    nestrs new hello
    cd hello
  2. Start the default app.

    Terminal window
    nestrs run dev hello

    Open http://localhost:3000/Hello World, served from crates/features/src/hello/. apps/hello/ only wires modules.

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):

Terminal window
$ curl http://localhost:3000/
Hello World

One thin controller over one service — the shape every feature follows:

src/controller.rs
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()
}
}

Edit the greeting in src/service.rs, save, and nestrs run dev hot-reloads — then curl again:

src/service.rs
fn greeting(&self) -> String {
"Hello, NestRS".to_string() // was "Hello World"
}
Terminal window
$ curl http://localhost:3000/
Hello, NestRS

That’s the loop — edit, save, curl. Every reference section builds on it.

  • Tutorial — add apps/blog/ with nestrs new blog and 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.