CLI
The covara CLI scaffolds projects, runs a dev loop that streams schema changes to your database, manages database connection profiles, and browses/imports/exports data.
covara create
npx covara create my-app # Node + SQLite (default), backend only
npx covara create my-app --frontend react # + a live React SPA, served by the backend
npx covara create my-app --template cloudflare # Cloudflare Workers + D1
npx covara create my-app --db postgres # PostgreSQL
| Flag | Values | Default |
|---|---|---|
--template | node, cloudflare | node |
--db | sqlite, postgres | sqlite |
--frontend | react, none | none |
--no-install | skip dependency install | — |
Generated projects are deploy-ready. Alongside your source and schema, the scaffolder writes:
- Node: a
Dockerfileanddocker-compose.yml(app + Redis, plus a Postgres service when--db postgres) and a.dockerignore. - Cloudflare: a complete
wrangler.toml—nodejs_compat, a[[d1_databases]]binding, a commented[[kv_namespaces]]block, and theCovaraKVDurableObjectDurable Object KV binding + migration. - A GitHub Actions CI workflow (
.github/workflows/ci.yml) that installs, lints, tests, and builds. - Node: a typed
createEnvschema insrc/env.ts— the generated server reads config viaenv.X, neverprocess.env. .env.exampledocumenting the expected environment variables.- An
AGENTS.mdorienting AI coding agents — project layout, how resources map to endpoints, the commands, and links to these docs plus the machine-readablellms.txt/llms-full.txt.
cd my-app
npm run dev # start the server — covara dev creates/updates tables automatically
npm run dev (which runs covara dev) auto-applies additive schema changes on start, so it creates your tables on first run — there's no separate npm run db:push. Run db:push yourself only for destructive changes or in CI.
--frontend react
Scaffolds a live React SPA (under frontend/) wired to the generated todos resource with useLiveList, served by the backend itself — one process, one port, no separate build step:
npm run devruns a single process that serves the SPA with Vite HMR and the API (/api) and admin UI (/__covara) on the same origin (no proxy), whilecovara devlive-applies schema changes and regenerates the typed client intofrontend/src/generated/api-types.ts.npm run buildbuilds the SPA intodist/public/and compiles the backend intodist/, sodist/is a self-contained deployable;npm startserves the built SPA with an SPA fallback that excludes/apiand/__covara.- On Cloudflare, the SPA is served via Wrangler
[assets]withrun_worker_firstfor/api+/__covara; runnpm run dev:webfor Vite HMR alongsidewrangler dev.
The starter uses the generic typed hook with a hand-written Todo interface so it compiles before any codegen; run npm run types (or just npm run dev) to generate the full typed client and switch to createTypedClient.
covara generate
Scaffold incrementally inside an existing project.
npx covara generate resource invoices # writes a Drizzle table + a registration snippet
npx covara generate migration # runs drizzle-kit generate (pass -- to forward args)
| Command | What it does |
|---|---|
generate resource <name> | Adds a Drizzle table and a .resource(...) registration snippet. |
generate migration | Runs drizzle-kit generate (forward args after --). |
covara dev
The continuous development loop. It runs your server under tsx watch, watches your Drizzle schema, and on every save auto-applies additive changes to the database (new tables, columns, indexes) so you never push by hand. Destructive changes (dropping/renaming a column, narrowing a type) are not auto-applied — they're printed with a hint to run covara push --force. With --types-out, it also regenerates the typed client after each successful change.
npx covara dev # auto-detects the server entry
npx covara dev src/main.ts --types-out frontend/src/api-types.ts
npx covara dev --no-server # only watch + push schema
| Flag | Default |
|---|---|
[entry] / --entry | auto-detected (src/main.ts, src/index.ts, …) |
--types-out <path> | off (skip type regen) |
--server-url <url> | http://localhost:$PORT |
--profile <name> | active profile |
--no-server | run only the schema watcher |
Loading TypeScript: schema-aware commands (
dev,push,studio,data,import/export) run a worker via your project'stsx, so the framework stays dependency-light and your.tsschema/config load natively.tsxships in scaffolded projects.
Schema & database
npx covara push # apply schema (additive auto; prompts on destructive)
npx covara push --force # apply even destructive changes (non-interactive)
npx covara migrate # apply migration files (drizzle-kit migrate)
npx covara studio # open Drizzle Studio for the active profile
push computes the diff with drizzle-kit and classifies it: additive diffs apply immediately; destructive diffs (with possible data loss) require confirmation or --force.
Connection profiles — covara db
Named profiles let you switch between local, staging, and remote databases (libsql/Turso URL + token, or a Postgres URL). Profiles live in .covara/config.json; the active one (or DATABASE_URL/DB_FILE_NAME) is used by every schema/data command, and an explicit --profile <name> or --url <url> overrides it.
npx covara db add local --url 'file:./dev.db'
npx covara db add prod --url 'libsql://app.turso.io' --token "$TURSO_TOKEN"
npx covara db use prod
npx covara db list # * marks the active profile
npx covara db current
npx covara push --profile local
Data
npx covara data todos --limit 20 # browse rows (JSON)
npx covara export todos --out todos.csv --format csv
npx covara import todos --file todos.jsonl # json | jsonl | csv
npx covara seed # run src/db/seed.ts via tsx
Other
npx covara run todos.markDone '{"id":"abc"}' # invoke an RPC on a running server
npx covara types --out src/generated/api-types.ts --server-url http://localhost:3000
npx covara env set DB_FILE_NAME dev.db # manage the project .env
npx covara env list
| Command | What it does |
|---|---|
run <resource>.<rpc> [json] | POSTs to a running server's RPC route (--base/--server-url to override). |
types [--out <path>] | Generates the TypeScript client types from a running API. |
env <list|get|set|remove> | Reads/writes the project .env. |