Skip to content

InternalCoreModule

reference
1 min readUpdated

Kind: Class

Source: packages/core/injector/internal-core-module/internal-core-module.ts

Part of: Core

InternalCoreModule is a framework-internal global module that registers core dependency-injection providers used by the application container. Its register() method returns a DynamicModule, allowing the framework to supply container-specific services during application initialization.

Methods

MethodSignatureReturns
register`register(providers: Array<ValueProviderFactoryProvider

Diagram

mermaid
graph LR
  A[Application Bootstrap] --> B[InternalCoreModule.register()]
  B --> C[DynamicModule]
  C --> D[Core DI Providers]
  D --> E[Application Injector / Container]
  E --> F[Framework Services]

Usage

ts
import { Module } from '@nestjs/common';
import { InternalCoreModule } from './injector/internal-core-module/internal-core-module';

@Module({
  imports: [
    // Normally registered internally by the framework bootstrap process.
    InternalCoreModule.register(),
  ],
})
export class AppModule {}

AI Coding Instructions

  • Treat InternalCoreModule as framework infrastructure; application modules should generally not import it directly.
  • Keep register() focused on returning a valid DynamicModule and registering only core container providers.
  • Ensure providers added during registration are compatible with the injector lifecycle and scope rules.
  • Preserve the module’s global/core role when changing exports or registered providers.
  • Prefer integrating new framework-level services through the bootstrap/container setup rather than manually instantiating them.

Relationships

  • IMPORTS → DynamicModule
  • IMPORTS → Global
  • IMPORTS → Module
  • IMPORTS → ExistingProvider
  • IMPORTS → FactoryProvider
  • IMPORTS → ValueProvider

Was this page helpful?

Download as PDF
InternalCoreModule — NestJS head-to-head