AponiaJSDocs
CLI

Module registration

Understand how generated declarations are added to the nearest AponiaJS module.

The generator can update an existing @Module() declaration after creating a file.

Registration rules

Generated shapeModule field
Controllercontrollers
Service or providerproviders
Gateway or resolver scaffoldproviders
Moduleimports
Resource moduleimports

Other schematic shapes are created without module registration.

Nearest module

By default, the CLI searches from the generated file directory toward the configured source root and selects a nearby *.module.ts file:

aponia g service users

Use --module when the intended owner is not the nearest module:

aponia g service users --module app

The selector accepts a module path or name without the .module.ts suffix. It fails when no matching module exists or when the name matches more than one module.

Skip registration

Create files without changing a module:

aponia g controller users --skip-import

The module update is computed before any file is written. If a create target already exists, the command stops rather than applying a partial update.

Registration does not add runtime capabilities

Registering a generated guard, gateway, resolver, or other scaffold as a provider does not make its Nest-style method run. Only implemented AponiaJS runtime contracts are discovered and executed.

On this page