Skip to main content
Every database is a dedicated Postgres instance, isolated, scale-to-zero, with pooled and direct connections. Ask the AI to create one and it handles setup and credentials.

Creating a database

Tell the AI what the app needs. It should list existing databases first and reuse a suitable active database when one exists. It creates a new Postgres instance only when you ask for isolation or no existing database fits.

Credentials

Database credentials are managed through the vault.
  • View credentials - returns the current connection URIs for the database.
  • Regenerate credentials - resets the database password and creates new vault secrets. Use when credentials are missing, compromised, or need rotation. Old credentials stop working immediately.

Using credentials in an app

For generated apps, the AI wires database credentials into the process component with the db tool. App code reads normal env vars such as DATABASE_URL and DIRECT_DATABASE_URL. For manual local commands, run through the Kazzle CLI with the right collection and environment:
{
  "scripts": {
    "dev": "kazzle run --collection=my-saas --env=dev -- bun run server.ts"
  }
}
Do not put database URLs in frontend code or VITE_* variables.

Migrations

Schema changes go in SQL files in the app repo (e.g. migrations/001_create_todos.sql). Kazzle can run those migrations as part of your app’s deploy flow. If realtime sync is enabled, the AI also updates the related sync setup.

Enabling realtime sync

Ask the AI to enable sync on a database. It should wait until the database shows sync: ready before wiring a realtime app. See Realtime sync for how it works.

Deleting a database

Ask the AI to delete a database. Kazzle marks it as deleted first, and the database can be restored before permanent cleanup runs.

Example: setting up a database from scratch

  1. “Create a database called my-app-db”
  2. The AI reuses a suitable database or sets up Postgres and stores credentials in the vault
  3. “Create a todos table with id, text, done, and created_at”
  4. The AI runs the SQL
  5. “Wire it into my app” - the AI connects the database to the app’s process component
For realtime apps with offline support, the AI also turns on sync and sets up the client-side schema. See building a realtime app for the full flow.