Skip to Content
🚀 APSO is now in public beta. Get started →

apso generate

Generate backend code from the .apsorc schema file in the current directory.

Usage

apso generate apso generate --language python apso generate --skip-format

Options

OptionDescriptionDefault
-l, --languageTarget language (typescript, python, go)(from .apsorc or prompted)
--skip-formatSkip Prettier formatting after generationfalse

What it generates

For each entity in your .apsorc, the CLI generates:

  • Entity class with ORM decorators and relationship mappings
  • CRUD controller with REST endpoints
  • Service class with data access logic
  • Create and Update DTOs with validation decorators
  • NestJS module wiring everything together
  • Enum type definitions (for any enum fields)

Additionally, if auth is configured:

  • Auth guard (JWT, session, or API key)
  • Scope guard (for multi-tenant data isolation)
  • Guards module and exports

Output structure

All generated files go in src/autogen/:

src/autogen/ User/ User.entity.ts User.controller.ts User.service.ts User.module.ts CreateUserDto.ts UpdateUserDto.ts Project/ Project.entity.ts ... guards/ auth.guard.ts scope.guard.ts guards.module.ts index.ts enums.ts app.module.ts

Files in src/autogen/ are overwritten on every run. Place custom code in src/extensions/.

Language resolution

The target language is resolved in this order:

  1. --language flag (if provided)
  2. language field in .apsorc (if set)
  3. Interactive prompt

Examples

Generate TypeScript code (default):

apso generate

Generate Python code:

apso generate --language python

Skip formatting (useful in CI or when Prettier is not installed):

apso generate --skip-format

Notes

  • Replaces the deprecated apso server scaffold command
  • Requires a valid .apsorc file in the current directory or a parent directory
Last updated on