An async provider uses an async factory function. NestJS awaits the returned Promise before completing the bootstrap sequence — guaranteeing that any provider depending on it receives the fully resolved value, never a pending Promise. If the factory rejects, the entire bootstrap fails.
Async providers solve the problem of dependencies that require asynchronous initialization — such as database connections, remote configuration loading, or SDK clients that need handshaking before use.
NestJS awaits the factory Promise before completing bootstrap — consumers always get a ready instance.
If the factory throws or rejects, bootstrap fails entirely — handle errors inside the factory for graceful recovery.
Async providers can inject other providers (sync or async) via the inject array.
The resolved value (not the Promise) is what gets injected into consuming classes.