On this page

Install and log in

Install the stitchdb CLI, log in with an access token and link a folder to a project.

#Install

The CLI needs Node.js 18 or newer on macOS or Linux (on Windows, use WSL). Local development needs nothing else: no Docker. The first stitchdb start downloads a small native runtime once (about 40 MB).

Terminal
npm install -g stitchdb-cli
stitchdb --version

To run it without installing: npx stitchdb-cli --help. The same package is also at https://stitchdb.com/cli/stitchdb.tgz (a specific version: https://stitchdb.com/cli/stitchdb-<version>.tgz).

#Log in

The CLI uses a personal access token. Create one in the dashboard under Account → Access tokens, with read-write access if you want to push migrations or deploy functions.

Terminal
stitchdb login                  # asks for the token (and opens the tokens page)
stitchdb login --token sdb_pat_…  # non-interactive
stitchdb login --no-browser       # don't open the tokens page

The token is stored in ~/.stitchdb/credentials, readable only by you. In CI, set the STITCHDB_ACCESS_TOKEN environment variable instead; it always wins over the stored token. stitchdb logout removes the stored token (revoke it in the dashboard to make it unusable).

#Set up your app

Terminal
cd my-app
stitchdb init          # creates stitchdb/ (config.toml, migrations/, functions/, seed.sql)
stitchdb link --project-ref <project-ref>
PathWhat it is
stitchdb/config.tomlLocal ports, API schemas, Auth settings for local development, per-function settings
stitchdb/migrations/Schema changes, one SQL file each: <timestamp>_<name>.sql
stitchdb/functions/Edge Functions, one folder each; _shared/ for shared code
stitchdb/seed.sqlTest data for your local database and preview branches (never production)
stitchdb/.temp/The linked project and branch (not committed)

Commit everything in stitchdb/ except .temp/ and functions/.env (a .gitignore is created for you).