forgedb init

Scaffold a new ForgeDB project — schema, config, Rust server, and deploy files.

Scaffold a new ForgeDB project directory: a starter schema.forge, a forgedb.toml, a .gitignore, a README.md, and (unless --api-only) an env-driven Rust server plus the container and systemd deploy files.

Synopsis#

forgedb init <project_name> [--template <name>] [--rust] [--api-only]

<project_name> becomes the new directory; init refuses to run if it already exists.

Flags#

FlagType / defaultMeaning
<project_name>string (required)Project directory to create.
-t, --template <name>string (blank)Starter schema: blog, ecommerce, todo, or blank. An unknown value falls back to blank with a warning.
--rustbool (false)Include the Rust backend scaffold (also included by default unless --api-only).
--api-onlybool (false)Generate the API scaffold only — skip the Rust server files and deploy artifacts.

What gets created

Every project gets schema.forge, forgedb.toml, .gitignore, README.md, and a generated/ + data/ layout. Unless --api-only, init also writes src/main.rs (a 12-factor, env-driven, process-per-tenant server), a Cargo.toml pinning the substrate crates, a multi-stage Dockerfile, .dockerignore, docker-compose.yml, and a deploy/ directory with a systemd unit + env file.

Examples#

Scaffold a blog project and generate its Rust database:

forgedb init my-blog --template blog
cd my-blog
forgedb generate rust
forgedb build

Scaffold an API-only project (no Rust server or deploy files):

forgedb init my-api --template ecommerce --api-only

Next steps#

Search documentation

Find pages across the ForgeDB docs