nestrs-cli repl introspects a nestrs crate by reading its source —
no need to launch the binary, no runtime hook required. Useful for:
- answering “what routes does this app expose?” without booting it
- auditing which module owns which providers / controllers
- generating a Markdown table of every DTO
- piping graph data into a script via
--format json
syn dependency). It recognises
#[module(...)], #[controller(prefix = "/...")], #[injectable],
#[dto] / mapped-type macros (#[partial_type], #[omit_type],
#[pick_type], #[intersection_type]), and HTTP-method macros
(#[get] / #[post] / #[put] / #[patch] / #[delete]). Struct names
are captured positionally — only types that immediately follow the
attribute are added to the graph.
Subcommands
nestrs-cli repl graph
Prints a tree of modules, their imports / controllers / providers,
and every controller’s routes.
nestrs-cli repl routes
Flattened, sorted route table — handy for piping into a Markdown
doc or an OpenAPI generation script.
nestrs-cli repl providers
Groups #[injectable] types by the module that declares them.
Providers that aren’t referenced by any module (orphan services)
fall under unassigned:.
nestrs-cli repl dtos
Lists every #[dto]-decorated struct (heuristic: name ends with
Dto, Entity, or Model).
nestrs-cli repl live
Dumps the running provider and route registries from an app that
enabled the admin feature and called use_admin. This is the
runtime counterpart of the static scanner: conditional
cfg!(feature = …) providers show up here because they actually
exist in the process.
curl:
GET {url}/__nestrs/providersGET {url}/__nestrs/routes
Authorization: Bearer <token> on the header. The token is
never accepted as a query string (URLs leak into access logs).
curl argv always places -- before the URL so a malformed URL cannot
be parsed as a flag. Requires curl on $PATH.
Enable the sidecar:
Flags
--path <dir>— source root to scan. Defaults to./src. Use this when your crate’s source lives somewhere non-standard (src-tauri/,services/<name>/src/, etc.).--format text|json—text(default) is human-readable;jsonis machine-readable and round-trips throughserde_json.
Examples
Limitations
- The scanner is static — it does not run your code. Conditional
providers (e.g.
if cfg!(feature = "x") { ... }) are not modelled. impl_routes!blocks that declare routes without#[get("/")]attributes are not extracted (rare in 1.0.0; the common#[controller] + impl + #[get]pattern is fully covered).- Multi-line
#[module(controllers = [\n Foo,\n Bar,\n])]lists parse correctly via[^]]*capture; nested generics in provider types are not parsed.
nestrs-cli repl live --url <admin> against a
running app with the admin feature, or inspect via your existing logging.