forRoot() registers global configuration once. forFeature() registers feature-specific providers that depend on the global config — similar to how TypeORM works with entities. forFeature() relies on providers from forRoot() being already registered globally, so it can inject them via the DI container.
forRoot — registers infrastructure once globally: connections, global config, shared clients.
forFeature — registers per-module resources: entity repositories, feature-scoped services.
forFeature providers can inject forRoot providers because global providers are available app-wide.
This pattern is used by TypeOrmModule, MongooseModule, and SequelizeModule in the NestJS ecosystem.