RFC-0008 CLI and Project Structure

Defines CLI commands and generated project layout.

Purpose

Developers interact with Bakend primarily through the bak executable. Projects follow a predictable directory layout so bak start works without configuration ceremony.

Project Layout

myapp/
  bakend.json
  .gitignore
  collections/       # Collection JSON definitions
  functions/         # TypeScript event handlers
  jobs/              # Scheduled TypeScript jobs
  bakend.db          # SQLite database (created on first start)
  storage/           # Uploaded files (created on first start)

bakend.json paths are relative to the config file directory.

Commands

CommandDescriptionStatus
bak init [name]Scaffold a new projectImplemented
bak start [--config <path>] [--watch]Start HTTP serverImplemented
bak dev [--config <path>]Start with hot reloadImplemented
bak versionPrint versionImplemented
bak functions listList function triggersImplemented
bak jobs listList jobsImplemented
bak jobs runs <name>Job run historyImplemented
bak migrate statusDiff JSON vs databaseImplemented
bak migrate applyApply JSON to databaseImplemented
bak migrate exportExport database to JSONImplemented
bak backup createBackup db + storageImplemented
bak backup restoreRestore from archiveImplemented
bak storage pruneRemove orphan filesImplemented

bak init

Creates:

  • bakend.json with generated auth.jwtSecret
  • .gitignore for bakend.db, storage/, .bakend-cache/
  • Empty collections/, functions/, jobs/ directories
  • README.md with quick start

Rules:

  • With name, creates name/ under the current directory
  • Without name, initializes the current directory if empty
  • Refuses non-empty target directories

Configuration

Default config file: ./bakend.json

See bakend.json.example and docs/user-guide/getting-started.md.

Status

Implemented โ€” Milestone 14