Skip to main content

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​

OptionDefaultWhat it does
-i, --input <file>requiredThe model
-o, --output <dir>requiredWhere to write the project
-n, --name <name>the output directory's nameThe project name; the crate and database names derive from it
--db <type>postgrespostgres (self-hosted or managed) or neon
--theme <theme>neutralThe default theme: neutral, butter, chocolate, matcha, stone, gothic or y2k
--dark-modeoffStart the front end in dark mode
--port <port>3000Backend port; the front end uses the next one
--api-url <url>The backend URL the front end calls
--forceOverwrite an existing output directory
--dry-runList the files that would be written
--no-setupSkip install, database creation, migration and seed
--no-testsSkip the Bun test suites
--run-testsRun the generated suites after setup
--skip-cli-scaffoldBuild the backend from templates alone, without loco new (offline)

Other commands​

CommandDoes
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:entityGenerates 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.