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 usersController convenience aliases are route, router, and routes:
aponia g routes health --no-specOptions
| Option | Alias | Behavior |
|---|---|---|
--dry-run | -d | Report create and update operations without writing. |
--flat / --no-flat | — | Override whether the schematic gets its own directory. |
--spec / --no-spec | — | Override spec generation. |
--skip-import | — | Do not register the generated declaration in a module. |
--module <name> | — | Select the declaring module. |
--project <name> | -p | Select a project from aponia.json. |
--path <path> | — | Override the configured source root for this generation. |
--crud / --no-crud | — | Include 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 sharedThe 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
wsA 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.