AponiaJSDocs
CLI

aponia generate

Generate files and register implemented AponiaJS components in modules.

Usage

aponia generate <schematic> <name> [options]
aponia g <schematic> <name> [options]

Run generation from an AponiaJS project root containing aponia.json:

aponia g module users
aponia g controller users
aponia g service users

Controller convenience aliases are route, router, and routes:

aponia g routes health --no-spec

Options

OptionAliasBehavior
--dry-run-dReport create and update operations without writing.
--flat / --no-flatOverride whether the schematic gets its own directory.
--spec / --no-specOverride spec generation.
--skip-importDo not register the generated declaration in a module.
--module <name>Select the declaring module.
--project <name>-pSelect a project from aponia.json.
--path <path>Override the configured source root for this generation.
--crud / --no-crudInclude or omit resource CRUD shapes.
--type <type>Select a resource transport.

CLI flags take precedence over project-specific generation defaults, which take precedence over global defaults.

Applications and libraries

Inside a configured workspace:

aponia g app admin-api
aponia g library shared

The application generator writes under apps/. The library generator writes a private Bun package under packages/.

Resources

The accepted resource types are:

rest
graphql-code-first
graphql-schema-first
microservice
ws

A REST CRUD resource generates a controller, service, module, entity, and a <name>.model.ts file whose @Validation() classes are used directly in the route slots. GraphQL and microservice resources generate a transport scaffold, and a ws resource generates a provider-registered WebSocket gateway with one @SubscribeMessage() handler per CRUD operation.

GraphQL and microservice transports are scaffolds

GraphQL and microservice transports are not implemented by the runtime. Those resources generate a class with conventional method names that no platform package discovers. REST and WebSocket resources are runnable: their handlers use the request parameter or gateway decorators the runtime discovers.

See schematics for the complete catalog and module registration for automatic imports.

On this page