Search documentation

Find a page in the Andurel docs.

Code Generation

Andurel generates application-owned code that you can edit after creation. Framework behavior is imported from versioned packages; project policy and domain code remain local.

Generate a resource

Start with the canonical SQL migration, then generate CRUD:

1andurel database migrate new create_products_table
2andurel database migrate up
3andurel generate scaffold Product

The scaffold includes a constructed model API, entity and data types, a synchronized factory, controller, typed routes, and views. Pass --inertia for pages using the configured adapter or --api for JSON handlers. See Generators for the Inertia payload, TypeScript, and route-helper flow.

Generate individual parts

1andurel generate model Product
2andurel generate model Product --mode read-only
3andurel generate factory Product
4andurel generate controller Product index show
5andurel generate controller Dashboard overview --model-name User
6andurel generate query SalesReport
7andurel generate job SendReceipt
8andurel generate email Receipt

Model modes are crud, read-only, and create-only. Model generation reads migration history, requires a supported primary key for CRUD operations, and updates models.Module so Fx can supply the new plural model API.

Keep generated state current

1andurel generate factories --check --json
2andurel generate factories --sync --json
3andurel generate view
4andurel generate queries
5andurel generate routes

Use --dry-run --diff --json before broad mutations. sqlc output under models/internal/queries and Templ-generated Go are derived files; models, factories, controllers, SQL query files, routes, and authored views are application code.