forgedb 0.3.1

ForgeDB — an application database generator. Compiles a declarative .forge schema into tailored Rust database code, a TypeScript SDK, and a REST API.
Documentation
---
title: "forgedb init"
description: "Scaffold a new ForgeDB project — schema, config, Rust server, and deploy files."
purpose: "reference"
---
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

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

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

## Flags

| Flag | Type / default | Meaning |
|---|---|---|
| `<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. |
| `--rust` | bool (false) | Include the Rust backend scaffold (also included by default unless `--api-only`). |
| `--api-only` | bool (false) | Generate the API scaffold only — skip the Rust server files and deploy artifacts. |

<Callout type="note" title="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.
</Callout>

## Examples

Scaffold a blog project and generate its Rust database:

```bash
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):

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

## Next steps

- Edit `schema.forge` — see the [schema language](/docs/schema/overview/).
- Run [`forgedb generate`](/docs/cli/generate/) to produce code.
- Configure runtime behavior in `forgedb.toml` — see [configuration](/docs/config/overview/).