Skip to Content
Project Init

Project Init

kalam init scaffolds a KalamDB project in the current directory (or --project-dir). It creates kalam.toml, a schema source, kalam/migrations/, generated-output paths, optional starter code from embedded templates, or a full example downloaded from the KalamDB repository. When TypeScript is selected, it runs your JavaScript package manager to install SDK dependencies.

Run this once per repository before kalam dev, kalam migration, or production rollout workflows.

For the full configuration reference, see kalam.toml Reference.

Quick start

BASH
mkdir my-app && cd my-appkalam initkalam dev

While kalam dev runs, open http://localhost:2900/ui  and sign in as root / kalamdb123, or use kalam --url http://127.0.0.1:2900 --user root --password kalamdb123 in another terminal.

For TypeScript projects, init detects npm, pnpm, yarn, or bun on PATH, prompts when more than one is installed, writes the choice to kalam.toml, and runs <manager> install after scaffolding.

Non-interactive bootstrap:

BASH
kalam init --yes \  --name chat-app \  --schema-mode sql \  --languages typescript \  --template simple-live \  --package-manager pnpm \  --server-mode local

What kalam init creates

ArtifactPurpose
kalam.tomlProject config: environments, schema mode, codegen targets, dev orchestration, optional package_manager
schema.sqlActive schema source when schema.mode = "sql" (from template or a starter stub)
kalam/migrations/Migration history directory (default path; omitted from kalam.toml when unchanged)
kalam/.schema-baseline.sqlCreated on first successful schema apply during kalam dev
kalam/.gitignoreIgnores local KalamDB state under kalam/ (server data, CLI logs, baselines)
kalam/server/server.tomlLocal server config when --server-mode local (includes auth.root_password)
Generated outputsPaths from [schema.targets.<language>] (for example src/generated/kalam.ts)
Template or example filesEmbedded TypeScript starter, or downloaded repository example when selected (default with --yes: simple-live)
package.json + lockfileTypeScript starter dependencies (when TypeScript is selected)
.env / .env.exampleSets KALAM_PROFILE=kalam-dev, KALAM_USER=root, and KALAM_PASSWORD=kalamdb123 for local server mode

kalam.toml stores URLs, namespaces, and toolchain choices only — no secrets. Authenticate with kalam login for remote servers, or let kalam dev bootstrap local root credentials on loopback.

Namespace naming

[connection.dev].namespace is derived from the project name using KalamDB identifier rules (for example chat-appchat_app). If normalization changes the name, init prints the namespace it chose.

Init flags

FlagDescription
--name <NAME>Project name (written to [project].name)
--schema-mode <sql|remote>Active schema source mode (remote is rejected until supported)
--languages <typescript,dart>Comma-separated codegen targets. Aliases: tstypescript
--template <id>Embedded TypeScript template or repository example id (default simple-live with --yes)
--package-manager <npm|pnpm|yarn|bun>JavaScript package manager for TypeScript projects
--server-mode <local|remote>Whether kalam dev starts a local server or uses an existing URL
--server-url <URL>KalamDB URL for remote mode (local defaults to http://localhost:2900)
--project-dir <PATH>Directory to initialize (default: current directory)
--yesSkip prompts; use defaults for unspecified values

Defaults with --yes

When a flag is omitted and --yes is set:

SettingDefault
Schema modesql
Languagestypescript
Templatesimple-live (TypeScript only)
Package managerFirst available in order: invoking tool from npm_config_user_agent (when present), then pnpm, bun, yarn, npm
Server modelocal
Server URLhttp://localhost:2900
Project nameCurrent directory name, or my-app

Interactive flow

When run in a TTY without --yes, kalam init walks through:

  1. Project name
  2. Schema mode — SQL file (schema.sql) or remote (coming soon)
  3. Language targets — multi-select TypeScript and/or Dart
  4. Project template — embedded starters plus repository examples such as chat-with-ai, react-ai-chat, and summarizer-agent
  5. Package manager — when TypeScript is selected and multiple of npm/pnpm/yarn/bun are on PATH
  6. Server mode — local (kalam dev starts or reuses a server) or remote
  7. Server URL — when server mode is remote

Menus support Up/Down, Space (multi-select), Enter to confirm, and Esc to cancel.

In CI or piped shells without a TTY, pass --yes and every flag you need (including --package-manager when multiple managers are installed).

TypeScript package managers

TypeScript scaffolding lives under the CLI’s ts/ SDK module. Init only runs a package manager when typescript is in --languages (or selected interactively).

BehaviorDetail
DetectionScans PATH for npm, pnpm, yarn, and bun
Single manager installedSelected automatically
Multiple installedInteractive prompt; with --yes, uses preference order above
Explicit flag--package-manager pnpm (or npm, yarn, bun)
PersistenceWritten to [project].package_manager in kalam.toml
Install stepRuns <manager> install in the project root after files are created
Dart-only projectsNo package manager field and no install step

If dependency install fails, project files remain on disk. The CLI prints command output and recovery steps (for example cd <project> && pnpm install, then kalam dev).

Example kalam.toml

This matches the default TypeScript scaffold (local server, SQL schema). TypeScript init automatically writes [dev.processes].app with the selected package manager’s dev command. See kalam.toml Reference for every field.

TOML
[project]name = "chat-app"default_env = "dev"package_manager = "pnpm" [connection.dev]url = "http://localhost:2900"namespace = "chat_app" [schema]mode = "sql"path = "schema.sql"watch = truelanguages = ["typescript"] [schema.targets.typescript]output = "src/generated/kalam.ts" [migrations]auto_create = true [dev]auto_start_db = trueapply_schema = truegenerate_types = truewatch = true # kalam dev starts this alongside the DB server and schema pipeline.# Logs are prefixed [app] to distinguish from [cli] and [server].[dev.processes]app = "pnpm dev" [logging]file = truecapture_process_output = true

Add more supervised processes with additional keys under [dev.processes] (for example worker = "cargo run --bin worker"). The log prefix always matches the key name.

After init, add or update named environments without re-running init:

BASH
kalam link --env staging --url https://staging-db.example.com --namespace app

kalam link updates [connection.<env>] in kalam.toml only. Login credentials stay in ~/.kalam/.

Schema commands (no database mutation for gen)

BASH
# Regenerate SDK artifacts from schema.sqlkalam schema gen # Limit to one languagekalam schema gen --languages typescript # Pull live schema into schema.sql (remote mode only)kalam schema pull

Inspect project state

BASH
kalam statuskalam status --env prod --namespace app

Reports resolved URL, namespace, schema mode, codegen targets, and migration counts.

Starters And Examples

TypeScript projects can start from embedded samples or repository examples.

Embedded samples live under cli/templates/typescript/* and are compiled into the CLI:

BASH
kalam init --languages typescript --template simple-live

simple-live is a live-subscription starter with sample schema.sql, src/index.ts, and SDK dependencies. Init scaffolds [dev.processes].app so kalam dev can supervise the starter automatically. List available samples interactively during kalam init, or pass --template with --yes.

Repository examples live under examples/. They appear in the same kalam init template menu even when you installed only the CLI. When selected, the CLI downloads the repository archive and copies the chosen example into your project directory:

BASH
kalam init --yes --languages typescript --template chat-with-aikalam dev

Available repository example ids include live-okf-context-sync, realtime-ops-feed, chat-with-ai, react-ai-chat, and summarizer-agent.

Troubleshooting

interactive setup needs a terminal (TTY)

Run in a regular terminal, or pass non-interactive flags:

BASH
kalam init --yes --name my-app --languages typescript --package-manager npm

No JavaScript package manager on PATH

Install Node.js (includes npm), pnpm , or bun , open a new terminal, then rerun init. For TypeScript with --yes, add --package-manager <name> once a manager is available.

Explicit package manager not found

If you pass --package-manager npm but only pnpm is installed, either install npm or choose an installed manager:

BASH
kalam init --yes --languages typescript --package-manager pnpm

Dependency install failed after scaffolding

Project files are already created. Finish manually:

BASH
cd my-apppnpm install   # or npm / yarn / bun installkalam dev

The CLI surfaces network, permission, Node version, and registry errors when it can infer them from the package manager output.

Project already exists

If kalam.toml is already present in the directory, init refuses to overwrite. Use a different --project-dir, or open the existing project and run kalam dev.

Next steps

  1. Local Development — run kalam dev
  2. kalam.toml Reference — full config field reference
  3. Migrations — draft, seal, and apply schema history
Last updated on