This page is the index of every decorator the framework ships, grouped
by concern. Skim the table for the one you need, click through to the
page that explains it in context. Each row says where the decorator
goes (struct, impl block, method, field) so you can confirm the
position without leaving the page.
What counts as a decorator here: everything you write. That is the whole
inclusion rule, and it is wider than “an attribute macro”. Roughly half the
rows below — #[get], #[query], #[public], #[on_module_init] — are
inert tokens an orchestrator reads (#[routes], #[operations], #[hooks]),
not macros of their own, and they need no import. What decides a row is
whether you type it, not how the compiler resolves it.
| Decorator | Goes on | Summary | Read more |
|---|
#[module] | struct | Composes a binary: lists providers it owns and imports it depends on | Modules |
#[injectable] | struct | Marks a provider built from the container, with optional scope = request | transient | Providers |
#[inject] | field | Resolves the field from the container at construction | Providers |
#[hooks] | impl block | Orchestrates lifecycle methods on a provider | Lifecycle |
#[on_module_init] | method | Runs once after wiring, before serving | Lifecycle |
#[on_application_bootstrap] | method | Runs once after every module init, before serving | Lifecycle |
#[on_module_destroy] | method | Runs on shutdown after transports stop | Lifecycle |
#[before_application_shutdown] | method | Runs before the application begins shutting down | Lifecycle |
#[on_application_shutdown] | method | Runs last during shutdown, best-effort | Lifecycle |
| Decorator | Goes on | Summary | Read more |
|---|
#[controller] | struct | Mounts the struct as a controller with a base path and optional version | Controllers |
#[routes] | impl block | Wires methods to HTTP routes and emits the route table | Controllers |
#[get] #[post] #[put] #[patch] #[delete] | method | Binds the method to an HTTP verb at the given path | Controllers |
#[sse] | method | Binds a GET that answers a text/event-stream, with the keep-alive and the connection ceiling | Streaming |
#[http_code] | method | Overrides the default response status code | Responses |
#[response_header] | method | Appends a response header (repeatable) | Responses |
#[redirect] | method | Issues a redirect and discards the handler payload | Responses |
#[use_guards] | struct or method | Binds container-resolved Guards, first listed outermost | Guards |
#[use_interceptors] | struct or method | Binds container-resolved Interceptors | Interceptors |
#[use_filters] | struct or method | Binds error-mapping Filters (response mapping; the global pool runs at the transport band) | Exception filters |
#[use_exception_filters] | struct or method | Binds typed ExceptionFilters — downcast catch, the layer closest to the handler | Exception filters |
#[meta] | method | Attaches typed metadata read back via Reflector (repeatable) | Guards |
#[public] | method | Marks the route public so auth guards skip it | Guards |
#[interceptor] | struct | Marks a struct as a global HTTP interceptor | Interceptors |
#[version] | method | Narrows a route to one of the controller’s declared versions | Versioning |
#[force_guards] | struct or method | Re-runs a guard the broader scope already ran — the opt-out from dedup | Guards |
| Decorator | Goes on | Summary | Read more |
|---|
#[input] | struct | Shorthand for any type that crosses a wire: Serialize + Deserialize + Validate + JsonSchema + deny_unknown_fields | Extractors |
One decorator, one definition — an HTTP body, a GraphQL input, a queue
payload, a WS message and a tool’s arguments all take it. Every surface crate
re-exports it, so import it from the one the file already uses
(nest_rs::http::input, nest_rs::queue::input, nest_rs::mcp::input,
nest_rs::ws::input, or nest_rs::core::input) — they are the same macro.
| Decorator | Goes on | Summary | Read more |
|---|
#[resolver] | struct | Marks a resolver provider and declares its resolver-scope guards | GraphQL |
#[operations] | impl block | Orchestrates the block’s #[query] / #[mutation] / #[subscription] / #[entity] / #[field_resolver] methods | GraphQL |
#[query] | method | Root query operation; requires an access posture (#[authorize] or #[public]) | Queries and mutations |
#[mutation] | method | Root mutation operation; requires an access posture (#[authorize] or #[public]) | Queries and mutations |
#[subscription] | method | Root subscription over graphql-ws; same posture, gated at subscribe and masked per item | Subscriptions |
#[entity] | method | Federation entity resolver — the router resolves it by reference through _entities; same mandatory posture, and its arguments are the @key | Federation |
#[authorize] | method | Access posture: gates the operation by ability (Action, Entity) and masks the response | Queries and mutations |
#[public] | method | Access posture: deliberately ungated operation — no gate, no mask | Queries and mutations |
#[field_resolver] | method | Custom field resolver on a wire type; takes no posture attribute | Field resolvers |
#[dataloader] | impl block on service | Batches a method into a request-scoped DataLoader | Dataloader |
| Decorator | Goes on | Summary | Read more |
|---|
#[gateway] | struct | Mounts a WebSocket gateway at a path on the HTTP transport | WebSockets |
#[messages] | impl block | Binds gateway message handlers and lifecycle hooks | Messages |
#[subscribe_message] | method | Handles one event in the { event, data } envelope | Messages |
#[on_connect] | method | Runs after the socket upgrades | Rooms |
#[on_disconnect] | method | Runs after the socket closes | Rooms |
| Decorator | Goes on | Summary | Read more |
|---|
#[queue] | unit struct | Declares a queue’s wire name and payload type in one artifact both producer and consumer import | Queue |
#[processor] | impl block | Orchestrates queue consumers on a provider | Queue |
#[process] | method | Binds the method to a queue with an optional retries budget and transactional settling | Queue |
| Decorator | Goes on | Summary | Read more |
|---|
#[scheduled] | impl block | Orchestrates scheduled methods on a provider | Schedule |
#[every] | method | Fires the method on a fixed interval, optional transactional | Schedule |
#[cron] | method | Fires the method on a cron expression, optional tz and transactional | Schedule |
#[after] | method | Fires the method once after a delay from boot, optional transactional | Schedule |
| Decorator | Goes on | Summary | Read more |
|---|
#[listeners] | impl block | Orchestrates event listeners on a provider | Events |
#[on_event] | method | Subscribes the method to its second-parameter event type | Events |
| Decorator | Goes on | Summary | Read more |
|---|
#[mcp] | struct | Mounts an MCP endpoint over HTTP, at /mcp or a declared path | MCP |
#[tools] | impl block | Serves the block’s #[tool] and #[prompt] methods, deriving the advertised capabilities | MCP |
#[tool] | method | Exposes the method as an MCP tool; description = "…", or the doc comment as a fallback | MCP |
#[prompt] | method | Exposes the method as an MCP prompt; description = "…", or the doc comment as a fallback | Resources and prompts |
| Decorator | Goes on | Summary | Read more |
|---|
#[indicators] | impl block | Orchestrates health checks on a provider | Indicators |
#[liveness] | method | Binds the method to the liveness probe | Indicators |
#[readiness] | method | Binds the method to the readiness probe | Indicators |
#[startup] | method | Binds the method to the startup probe | Indicators |
| Decorator | Goes on | Summary | Read more |
|---|
#[config] | struct | Marks a struct as a namespaced configuration loaded from env and files | Configuration |
| Decorator | Goes on | Summary | Read more |
|---|
#[expose] | struct + field | Exposes a SeaORM entity to GraphQL and OpenAPI from one declaration | Database |
#[wire_enum] | enum | Carries the wire derives for an entity’s enum column, so an #[expose]d field of that type crosses GraphQL and OpenAPI | Entities |
#[crud] | impl block | Generates standard CRUD operations on a controller or resolver | CRUD |
| Decorator | Goes on | Summary | Read more |
|---|
#[api] | method | Enriches the OpenAPI operation with summary, description, and tags | OpenAPI |