# Nestrs > Nestrs brings the familiar NestJS module/controller/provider model to Rust with full Axum and Tower performance. Build fast, structured APIs in Rust. - [What is nestrs? NestJS architecture for Rust](https://nestcrate.dev/introduction.md): nestrs brings the NestJS module/controller/provider model to Rust, built on Axum and Tower for full async performance without sacrificing structure. - [Get started with nestrs in under 5 minutes](https://nestcrate.dev/quickstart.md): Scaffold a new nestrs project with the CLI, run the server, and make your first HTTP request — step by step from zero to a working API. - [Install nestrs and configure Cargo features](https://nestcrate.dev/installation.md): Add nestrs to your Cargo.toml, set up the tokio async runtime, choose optional feature flags, and configure release profile settings for production builds. - [nestrs modules: organize your application](https://nestcrate.dev/concepts/modules.md): Learn how the #[module] macro organizes controllers and providers into composable feature modules, and how the module lifecycle drives startup and shutdown. - [Controllers and HTTP routing in nestrs](https://nestcrate.dev/concepts/controllers.md): Define route handlers with #[controller] and #[routes], use HTTP method macros, extract path and query parameters, and inject services via Axum's State extractor. - [Providers and services in nestrs](https://nestcrate.dev/concepts/providers.md): Mark types as injectable with #[injectable], register them in modules, inject via State>, and use custom factory providers for advanced construction. - [Dependency injection in nestrs](https://nestcrate.dev/concepts/dependency-injection.md): Understand how nestrs resolves providers at runtime through ProviderRegistry and ModuleRef, the three injection scopes, and how to use request-scoped providers. - [Middleware pipeline: guards, pipes, and interceptors](https://nestcrate.dev/concepts/middleware-pipeline.md): Learn the nestrs cross-cutting pipeline — exception filters, guards, interceptors, and pipes — and how to apply them at route, controller, and global scope. - [Server-Sent Events — `nestrs_core::sse`](https://nestcrate.dev/concepts/sse.md): Stream events to the browser with `SseResponse`, `IntoSseEvent`, and `serialize_to_event`. One wrapper, no axum dep at the handler site. - [Async-local-storage — `#[als]` and `nestrs_core::als`](https://nestcrate.dev/concepts/als.md): Carry per-request context through every .await with #[als] generated cells and FromRequestParts extractors. - [Validate request data with DTOs in nestrs](https://nestcrate.dev/guides/validation.md): Define validated request shapes with #[dto] and field attributes. Bind them to handlers via ValidatedBody, ValidatedPath, and ValidatedQuery extractors. - [Configuration — `ConfigModule` and `ConfigService`](https://nestcrate.dev/guides/configuration.md): Layered config from files + env + inline, namespaced typed structs, hot-reload watcher — the Rust analogue of @nestjs/config. - [Authorization: abilities, guards, and row-level policies](https://nestcrate.dev/guides/authorization.md): Deny-by-default, CASL-style authorization for nestrs: build Abilities with AbilityBuilder, guard routes with PoliciesGuard and #[check_policies], enforce per-row rules with RowPredicate and the authorized repository methods, and strip unauthorized fields from responses with the masking interceptor. - [CRUD controllers with #[crud]](https://nestcrate.dev/guides/crud.md): Generate a full 5-verb REST or GraphQL CRUD controller from one attribute on a struct holding an Arc — list, read, create, update, delete, with pagination, filter, sort, and search out of the box. - [OAuth2: client, resource server, and social login](https://nestcrate.dev/guides/oauth2.md): Use nestrs-oauth2 for the authorization-code + PKCE flow, client-credentials and refresh grants, a JWKS-backed resource server, social providers (Google, GitHub, Microsoft, Apple), and route protection with OAuth2Guard and the OAuth2Principal extractor. - [Password hashing — `nestrs_oauth2::password` + `#[derive(HashOnNew)]`](https://nestcrate.dev/oauth2/hashing.md): Hash and verify passwords with Bcrypt or Argon2id, auto-detect the algorithm from the hash prefix, and use the `HashOnNew` derive to construct rows whose marked fields are hashed on insert. - [Secure your nestrs API](https://nestcrate.dev/guides/security.md): Configure security headers, CORS, rate limiting, CSRF, cookies, and auth guards to harden your nestrs API. Includes a pre-production security checklist. - [Cookies, sessions, and CSRF protection](https://nestcrate.dev/guides/cookies-sessions-csrf.md): Opt-in browser-facing state with `use_cookies`, `use_session_memory`, `use_session_redis`, and `use_csrf_protection` — the @nestjs/csrf analogue built on tower-cookies + tower-sessions. - [Throttling — `nestrs-throttle` crate](https://nestcrate.dev/guides/throttling.md): Per-route rate limits with pluggable key generators, skipper, and backend (in-memory or Redis) — the @nestjs/throttler analogue. - [Add metrics and tracing to nestrs apps](https://nestcrate.dev/guides/observability.md): Wire up structured request logs, Prometheus RED metrics, and optional OpenTelemetry trace/metric/log export in a few builder calls on NestApplication. - [Health checks — `nestrs-health` crate](https://nestcrate.dev/guides/health.md): Liveness / Readiness / Startup probes with pluggable indicators, 5s TTL caching, and in-flight coalescing — the @nestjs/terminus analogue. - [Version your nestrs API routes](https://nestcrate.dev/guides/api-versioning.md): nestrs supports URI, header, and media-type versioning. Annotate individual routes with #[ver] or #[version] to control which version each handler responds to. - [Build microservices with nestrs transports](https://nestcrate.dev/guides/microservices.md): Run nestrs microservice servers over TCP, NATS, Redis, Kafka, MQTT, RabbitMQ, or gRPC. Connect services with ClientsModule and the #[message_pattern] macros. - [GraphQL and WebSocket APIs with nestrs](https://nestcrate.dev/guides/graphql-websockets.md): Add a GraphQL endpoint with nestrs-graphql and async-graphql, or build real-time WebSocket gateways using nestrs-ws, #[ws_gateway], and #[subscribe_message]. - [SDL export — `export_schema_sdl` and `nestrs-cli graphql sdl`](https://nestcrate.dev/graphql/sdl-export.md): Export your GraphQL schema as SDL for CI, federation gateways, and codegen. - [Federation v2 — `export_subgraph_v2_sdl` and `nestrs-cli graphql federation export`](https://nestcrate.dev/graphql/federation-v2.md): Emit and validate federation v2 subgraph SDLs for Apollo Router / GraphOS. - [Connect an AI editor to your nestrs project](https://nestcrate.dev/guides/mcp.md): Install nestrs-mcp, wire it into Claude Code, Cursor, VS Code, or Codex CLI, embed the tool handlers in your own binary, and expose project structure, live runtime, scaffolding, docs search, prompts, resources, elicitation, and tasks to the model. - [nestrs ecosystem: optional modules and features](https://nestcrate.dev/ecosystem/overview.md): nestrs optional modules cover caching, scheduling, queues, i18n, and databases. Enable each with a Cargo feature flag and register it like any other module. - [Database integration with nestrs](https://nestcrate.dev/ecosystem/database.md): nestrs supports SQL via SqlxDatabaseModule for direct AnyPool queries or nestrs-prisma for Prisma-style schema-driven access. MongoDB support is also available. - [Add caching to nestrs with CacheModule](https://nestcrate.dev/ecosystem/caching.md): CacheModule gives you an injectable CacheService with get, set, del, and ttl. Swap the in-memory default for Redis by enabling the cache-redis Cargo feature. - [Schedule recurring tasks in nestrs](https://nestcrate.dev/ecosystem/scheduling.md): ScheduleModule runs cron jobs and interval tasks inside nestrs. Declare scheduled work with #[cron] and #[interval] macros on a #[schedule_routes] impl block. - [Generate OpenAPI docs for your nestrs API](https://nestcrate.dev/ecosystem/openapi.md): nestrs-openapi serves an OpenAPI 3.1 JSON document and Swagger UI for all routes registered via #[routes]. Enable it with one method call on NestApplication. - [Adapter crates](https://nestcrate.dev/adapters/overview.md): Companion crates for NestJS surfaces that do not fold into Axum: Socket.IO, Lambda, Passport, Better Auth, BullMQ, SAML, LDAP, and SeaORM. - [nestrs-socketio](https://nestcrate.dev/adapters/socketio.md): Mount Socket.IO on a nestrs Axum router with socketioxide — NestJS @nestjs/platform-socket.io analogue. - [nestrs-lambda](https://nestcrate.dev/adapters/lambda.md): Run a nestrs Axum router on AWS Lambda and API Gateway — NestJS serverless analogue without Fastify or Express. - [nestrs-auth-strategy](https://nestcrate.dev/adapters/auth-strategy.md): Passport-style JWT bearer and HTTP Basic strategies on nestrs AuthStrategy — NestJS @nestjs/passport analogue. - [nestrs-better-auth](https://nestcrate.dev/adapters/better-auth.md): Nest the better-auth.rs Axum router into nestrs and guard routes with the Better Auth session cookie. - [nestrs-bullmq](https://nestcrate.dev/adapters/bullmq.md): Enqueue jobs using the BullMQ Redis key layout so Node @nestjs/bullmq workers can consume them. - [nestrs-saml](https://nestcrate.dev/adapters/saml.md): SAML 2.0 service-provider redirect and assertion validator trait — NestJS passport-saml analogue. - [nestrs-ldap](https://nestcrate.dev/adapters/ldap.md): LDAP simple bind authentication for nestrs — NestJS passport-ldap analogue. - [nestrs-sea-orm](https://nestcrate.dev/adapters/sea-orm.md): SeaORM Repo, Bind, ambient transactions, expose schemas, and deny-closed row authz — NestJS TypeORM / NestRS data-layer analogue. - [nestrs CLI: scaffold and manage projects](https://nestcrate.dev/cli/overview.md): Install nestrs-scaffold, create new projects with nestrs-cli new, generate code with nestrs-cli generate, and diagnose your setup with nestrs-cli doctor. - [CLI scaffolder — nestrs-cli new](https://nestcrate.dev/cli/scaffolder.md): nestrs-cli new app | lib | resource — generate binary crates, library crates, and full resource modules. - [CLI REPL — nestrs-cli repl](https://nestcrate.dev/cli/repl.md): Static DI graph explorer — modules, controllers, routes, providers, and DTOs from your crate's source. - [Generate code with nestrs-cli generate](https://nestcrate.dev/cli/generate.md): Use nestrs-cli generate (or nestrs-cli g) to scaffold services, controllers, modules, DTOs, guards, pipes, filters, interceptors, and full CRUD resources. - [Migrate from NestJS to nestrs](https://nestcrate.dev/migration/from-nestjs.md): A comprehensive side-by-side mapping of NestJS concepts—decorators, modules, guards, pipes, and more—to their nestrs equivalents in Rust. - [Backend stack recipes](https://nestcrate.dev/recipes/overview.md): Choose a recipe for REST + Prisma, MongoDB, GraphQL, gRPC microservices, message brokers, and event-driven patterns. Copy-paste Cargo.toml, bootstrap, and CRUD examples. - [Recipe A — REST + PostgreSQL + Prisma](https://nestcrate.dev/recipes/rest-prisma.md): HTTP APIs with nestrs-prisma PrismaService, prisma_model!, REST CRUD, SQLite/Postgres/MySQL variants, hello-app demo. - [Recipe B — REST + MongoDB](https://nestcrate.dev/recipes/rest-mongo.md): MongoModule bootstrap, BSON ProfileDoc, indexes, CRUD routes, Docker, and GraphQL pairing (Recipe D). - [Recipe C — GraphQL + PostgreSQL + Prisma](https://nestcrate.dev/recipes/graphql-prisma.md): async-graphql with PrismaService, nestrs-graphql limits, mutations, CRUD resolvers, global prefix and batch POST. - [Recipe D — GraphQL + MongoDB](https://nestcrate.dev/recipes/graphql-mongo.md): GraphQL resolvers over MongoService, SimpleObject mapping, single-file bootstrap, BSON mutations. - [Recipe E — gRPC microservice + Prisma](https://nestcrate.dev/recipes/grpc-microservice.md): micro_routes message_pattern handlers over gRPC JSON wire, PrismaService, hybrid also_listen_http, TCP alternative. - [Recipe F — Microservices + message brokers](https://nestcrate.dev/recipes/message-brokers.md): NATS, Redis, RabbitMQ listeners via NestFactory; ClientProxy callers; Kafka listener notes; ClientsModule multi-broker HTTP apps. - [Recipe G — Event-driven architecture](https://nestcrate.dev/recipes/event-driven.md): emit vs send, event_pattern handlers, EventBus and on_event, outbox pattern, CQRS read models, idempotency. - [MongoDB with nestrs-mongodb](https://nestcrate.dev/recipes/mongodb.md): Mongoose-style adapter — MongoModule, Document derive, MongoRepository, for_feature model registration. - [Drizzle ORM with nestrs-drizzle](https://nestcrate.dev/recipes/drizzle.md): Typed SQL query builder for nestrs — DrizzleModule, DrizzleService, table! macro re-exports. Pick postgres / mysql / sqlite via feature flags. - [Outbound HTTP with nestrs-http](https://nestcrate.dev/recipes/http-client.md): HttpModule / HttpService / HttpServiceOptions — shared reqwest client with sane default timeouts (30s whole-request, 10s connect). - [NestFactory: bootstrap your nestrs application](https://nestcrate.dev/api/nest-factory.md): Reference for all NestFactory methods that create HTTP applications, microservice servers, and hybrid processes across every transport adapter. - [NestApplication: configure and launch your server](https://nestcrate.dev/api/nest-application.md): Complete reference for every NestApplication builder method—routing, security, performance, observability, and launch—grouped by category. - [HTTP routing macros in nestrs](https://nestcrate.dev/api/macros/routing.md): Reference for every HTTP routing macro in nestrs: controller, routes, HTTP method macros, response shaping, versioning, SSE, and impl_routes!. - [Dependency injection macros in nestrs](https://nestcrate.dev/api/macros/di.md): Reference for the nestrs DI macros: #[module], #[injectable] with scope variants, #[set_metadata], and #[roles] for handler metadata. - [DTO validation macros in nestrs](https://nestcrate.dev/api/macros/validation.md): Reference for #[dto], the NestDto trait, and all field validation attributes including IsEmail, Length, Min, Max, ValidateNested, and more. - [DTO mapped types in nestrs](https://nestcrate.dev/api/macros/mapped-types.md): Reference for #[partial_type], #[omit_type(...)], #[pick_type(...)], and #[intersection_type] — the nestrs equivalents of @nestjs/mapped-types. - [nestrs-core: DI container and module runtime](https://nestcrate.dev/api/crates/nestrs-core.md): Reference for nestrs-core: ProviderRegistry, ModuleRef, DiscoveryService, ExecutionContext, RouteRegistry, MetadataRegistry, and all core traits. - [nestrs-microservices: transport adapters](https://nestcrate.dev/api/crates/nestrs-microservices.md): Reference for nestrs-microservices: available transports, feature flags, ClientProxy, ClientsModule, EventBus, and message handler patterns. - [nestrs-openapi: OpenAPI and Swagger UI](https://nestcrate.dev/api/crates/nestrs-openapi.md): Reference for nestrs-openapi: OpenApiOptions, enable_openapi, the #[openapi] macro, security scheme documentation, and the generated JSON spec endpoint. - [nestrs-mcp: Model Context Protocol server](https://nestcrate.dev/api/crates/nestrs-mcp.md): Reference for nestrs-mcp: NestrsMcpServer, the four tool handlers, McpSurfaces (prompts, resources, completion, subscriptions, cache hints), elicitation, tasks, authz, the AdminClient, the source parser, and the setup wizard. - [AGENTS](https://nestcrate.dev/AGENTS.md) - [Local development](https://nestcrate.dev/deployment.md): Run the Mintlify dev server to preview documentation before you push. - [nestrs: NestJS-style framework for Rust](https://nestcrate.dev/index.md): nestrs brings the familiar NestJS module/controller/provider model to Rust with full Axum and Tower performance. Build fast, structured APIs in Rust.