CLI reference

The forgedb command-line tool — global flags and every subcommand for generating, building, and operating a ForgeDB database.

The forgedb CLI is the whole toolchain: it scaffolds a project, transpiles your .forge schema into tailored Rust/TypeScript/REST artifacts, builds them, and operates the database (migrations, compaction, backups, tenancy, and the multi-process commit coordinator).

forgedb <command> [flags]
forgedb --help

Global flags#

Accepted on every command.

FlagType / defaultMeaning
-v, --verbosebool (false)Enable verbose output.
-q, --quietbool (false)Suppress output.
-c, --config <PATH>string (nearest ancestor forgedb.toml)Path to the config file, overriding discovery outright. Without it, the nearest forgedb.toml at or above the schema's directory applies. It does not override which project a schema belongs to.

Config precedence

For resolvable defaults the order is: CLI flag > forgedb.toml > built-in default. A relative directory from either of the last two resolves against the schema's directory, not the working directory, so one config can govern several apps without them colliding. See configuration for the full set of tables and keys.

Commands#

CommandPurpose
initScaffold a new ForgeDB project.
generateTranspile the schema into code (Rust, REST API, OpenAPI, stubs, language runtimes).
validateParse and validate the schema (and optionally components).
buildValidate, generate, and compile production artifacts.
devWatch the schema and auto-regenerate on change.
lspRun the ForgeDB language server over stdio (used by the editor extension).
migrateRecord, build, and run schema migrations over data-at-rest.
compactDatabase statistics and analysis. Offline run/vacuum are deprecated.
backupCreate, restore, and inspect snapshot archives.
tenantManage dir-per-tenant data directories.
coordinateRun the Tier-3 MVCC multi-process commit coordinator.

Exit codes#

Commands exit 0 on success, non-zero on failure. The deprecated paths (compact run, compact vacuum) exit non-zero even though they are otherwise valid subcommands — see compact.

Search documentation

Find pages across the ForgeDB docs