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).
npm install -g stitchdb-cli
stitchdb --versionTo 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.
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 pageThe 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
cd my-app
stitchdb init # creates stitchdb/ (config.toml, migrations/, functions/, seed.sql)
stitchdb link --project-ref <project-ref>| Path | What it is |
|---|---|
stitchdb/config.toml | Local 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.sql | Test 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).