NestFactory is the entry point for every nestrs application. You call one of its static methods with a root module type parameter, and it builds the ProviderRegistry, wires controllers into an Axum Router, and returns either a NestApplication builder or a MicroserviceApplication handle that you configure and then start listening.
NestFactory::create
Creates an HTTP application from a static root module type.
The root module type. Must implement the
Module trait, which is generated by #[module(...)].M::build() runs at call time: it walks the module import graph, registers all providers into a ProviderRegistry, and registers all controllers into an Axum Router. The returned NestApplication is a builder; no network socket is opened until you call listen, listen_graceful, or listen_with_shutdown.
NestFactory::create_with_modules
Creates an HTTP application from a static root module plus a collection of runtime-selected DynamicModule instances.
The static root module type.
Zero or more dynamic modules to merge into the root module’s registry and router.
NestFactory::create_microservice (TCP)
Creates a microservice application using the TCP transport adapter. Requires the microservices feature.
The root module type. Must also implement
MicroserviceModule, generated when you declare microservices = [...] in #[module].TCP server configuration (host, port, and related settings).
NestFactory::create_microservice_nats
Creates a microservice application using the NATS transport adapter. Requires the microservices-nats feature.
NATS connection and subject configuration.
NestFactory::create_microservice_redis
Creates a microservice application using the Redis Pub/Sub transport adapter. Requires the microservices-redis feature.
Redis connection and channel configuration.
NestFactory::create_microservice_grpc
Creates a microservice application using the gRPC transport adapter. Requires the microservices-grpc feature.
The gRPC transport carries JSON-encoded payloads (pattern + payload_json) inside protobuf, matching the nestrs-microservices::wire module’s request/response shapes.
Bind address and TLS configuration for the tonic gRPC server.
NestFactory::create_microservice_rabbitmq
Creates a microservice application using the RabbitMQ transport adapter. Requires the microservices-rabbitmq feature.
AMQP connection URL, exchange, and queue configuration.
MicroserviceApplication builder methods
All create_microservice_* methods return a MicroserviceApplication. It exposes the following builder methods before you call listen: