Generate an application
bun run generate:tanstack -- -i <model> -o <output dir> -n <name> [options]
The model can be a CEDM model (.cedm.yaml) or a model document (.eml.yaml).
Options
| Option | Default | What it does |
|---|---|---|
-i, --input <file> | required | The model |
-o, --output <dir> | required | Where to write the project |
-n, --name <name> | the output directory's name | The project name; the crate and database names derive from it |
--db <type> | postgres | postgres (self-hosted or managed) or neon |
--theme <theme> | neutral | The default theme: neutral, butter, chocolate, matcha, stone, gothic or y2k |
--dark-mode | off | Start the front end in dark mode |
--port <port> | 3000 | Backend port; the front end uses the next one |
--api-url <url> | The backend URL the front end calls | |
--force | Overwrite an existing output directory | |
--dry-run | List the files that would be written | |
--no-setup | Skip install, database creation, migration and seed | |
--no-tests | Skip the Bun test suites | |
--run-tests | Run the generated suites after setup | |
--skip-cli-scaffold | Build the backend from templates alone, without loco new (offline) |
Other commands
| Command | Does |
|---|---|
validate <model> | Checks a model: YAML, the schema and the checker, with line and column for every finding |
info <model> | Summarises entities and categories |
convert <model> | Converts between a CEDM model and a model document |
diff <a> <b> | Compares two models, entity by entity |
generate:entity | Generates the files for one entity |
Regenerating
Run the same command with --force. Generated files are rewritten. Your hook handlers, and rows an
administrator added in the running application, are kept. See
What regeneration keeps.
Neon
With --db neon, DATABASE_URL must be set: there is no local fallback, so a missing variable
fails loudly instead of migrating the wrong database. The generated .env.example includes
?sslmode=require, and setup skips createdb.