CLI commands
Every gize command: what it generates, when to reach for it, and the flags it takes. The CLI follows the verb–subcommand shape defined in ADR-012.
Global flags
These apply to every generating command (gize new and gize make …). Generation is safe by default: nothing is overwritten unless you ask.
--dry-runPrint the planned file operations (create / skip / update) and write nothing.--forceOverwrite files that already exist; without it, existing files are skipped.Commands
gize new <name>AvailableScaffolds a new project into a directory named <name>: a compiling, servable app in seconds.
- Writes Cargo.toml, gize.toml, .env.example, .gitignore and the full src/ layout (app, config, database, middleware, shared, router.rs, state.rs, main.rs).
- By default also generates a built-in users resource (model, full CRUD and a migration with an is_admin flag) already wired into app/mod.rs and gize.toml.
- Pass --no-user to scaffold the bare skeleton without the users resource.
- Choose the database with --database postgres (default), sqlite or mysql; add --openapi for a spec + /docs UI, and --api-version 1 to mount every route under /api/v1.
- Pass --ws to scaffold a WebSocket module (src/app/ws/) with a typed echo endpoint at /ws.
gize new shop --database mysql --api-version 1gize make app <name>AvailableCreates an application module and wires it into the project.
- Generates the nine module files (mod, model, dto, repository, service, handler, routes, error, tests) with a placeholder route.
- Registers mod <name>; and .merge(<name>::routes()) in src/app/mod.rs and adds the module to gize.toml. All of this is idempotent, so re-running is a no-op.
gize make app productsgize make model <Name> field:Type …AvailableGenerates a model struct and its CREATE TABLE migration from inline field definitions.
- model.rs is an sqlx::FromRow struct; an id: Uuid primary key and created_at / updated_at timestamps are added for you.
- The table and module name are the pluralized snake_case of the model (User → users).
- Names are validated before anything is written: models are PascalCase, fields snake_case, and Rust keywords or SQL words reserved by your database are rejected (array on PostgreSQL, key or range on MySQL). Do not declare id, created_at or updated_at; Gize adds them.
gize make model User name:String email:Stringgize make crud <Name> field:Type …AvailableThe headline command: a complete, wired vertical slice for a resource.
- Generates model, dto, repository (SQLx), service, handler (Axum), routes, a typed error, tests and the migration.
- Registers the module in app/mod.rs and gize.toml, exposing working GET/POST/PUT/DELETE endpoints backed by the database.
- The list route is paginated: GET /products?page=2&per_page=50 returns { items, page, per_page, total }, with 25 per page by default and at most 100 (ADR-022).
gize make crud Product name:String price:i32 active:boolgize make migration [name]AvailableWithout a name, diffs your models against the migration history and generates the missing changes. With a name, creates a blank migration to fill in by hand.
- The diff replays the existing migrations in version order and emits ALTER statements for the database set in gize.toml (PostgreSQL, SQLite or MySQL), with backfill guidance when a new column is required.
- Type differences only warn and keep your custom SQL type. If the history contains SQL Gize cannot read, the diff stops and names the file instead of guessing.
- A named migration is the escape hatch for anything else: indexes, constraints, data backfills, intended type conversions.
gize make migration add_index_to_usersgize make adminAvailableGenerates a standalone React + TypeScript admin SPA (Vite) for every resource in the manifest.
- A dark-theme, Django-inspired dashboard: a changelist with search, per-field filters, pagination and bulk actions, plus a slide-over drawer for create/edit with foreign-key selects.
- A separate, deployable artifact under admin/ that talks to the API with the JWT via a Vite dev proxy, and is not coupled to the backend build (ADR-006).
gize make admingize migrate [--status]AvailableApplies pending SQL migrations from migrations/*.sql against DATABASE_URL.
- Uses the SQLx migrator, which records applied versions in _sqlx_migrations, ordered and idempotent. There is no risky runtime auto-migration.
- Pass --status to list applied [x] versus pending [ ] migrations instead of applying them.
gize migrate --statusgize createadminAvailableCreates the first admin user in the database: Gize's createsuperuser.
- Interactive by default (prompts for email, name and a hidden, confirmed password); non-interactive for CI with --email/--name and the password read from --password-env, never a raw argument.
- Hashes the password with Argon2id in the format the generated login verifies, sets is_admin, rejects a duplicate email, and works against Postgres, SQLite or MySQL (ADR-017).
gize createadmin --email admin@example.com --name Admin --password-env GIZE_ADMIN_PASSWORDgize serveAvailableRuns the generated application, and (when an admin exists) its admin dev server alongside it.
- Reads DATABASE_URL and PORT (default 8080) from the environment.
- When the project has a generated admin, it also starts the admin dev server: it detects a package manager (pnpm, npm or yarn), installs deps on first run, prints both URLs, and stops both on Ctrl-C.
- Select the mode with --api-only, --admin-only or --with-admin.
gize serve --api-onlygize syncAvailableReconciles the project from gize.toml: regenerates missing pieces and reports drift.
- Dry-run first and drift-aware: it never clobbers hand edits without --force. Add a [[module]] to gize.toml and sync scaffolds and wires it (ADR-009).
gize syncgize doctorAvailableSanity-checks your environment and project.
- Reports cargo / rustfmt availability, whether you are inside a Gize project (gize.toml), and whether DATABASE_URL is set.
gize doctorgize fmtAvailableFormats the project with rustfmt, a thin wrapper around cargo fmt --all.
- Runs across the whole workspace so generated and hand-written code stay consistent.
gize fmtgize checkAvailableLints the project with clippy, denying warnings.
- Wraps cargo clippy --all-targets -- -D warnings, the same quality gate CI enforces.
gize checkSafe by default: existing files are skipped unless you pass --force, and --dry-run previews the full plan without writing anything. Registry edits to app/mod.rs and gize.toml are idempotent. Since 0.9.0, model and manifest names are validated before any file is written, even with --force; an older gize.toml with invalid names still works with migrate, serve and check.