All docs pages
Docs

Local development

You can work on a Stackly project on your own machine, with your own editor or agent, and push the changes back. Stackly stays the host.

Install the CLI#

You need Node.js 22 or newer. Stackly serves the CLI itself:

npm install -g https://stackly-site.app/cli/stackly-cli.tgz
stackly --version
  • stackly upgrade updates it to the newest version. stackly doctor checks your setup.
  • Remove it with npm uninstall -g stackly-cli.
  • Install only from Stackly’s own address. The npm package called stackly is not Stackly’s, so do not run npx stackly.
  • The project’s Local dev tab shows every command below with your project filled in.

The steps#

  1. stackly login: opens Stackly, where you approve a code. Saves a 90-day token on your machine.
  2. stackly clone <project>: copies the source and its full history. Or stackly init <name> for a new one.
  3. stackly dev: builds the app and runs it locally with its own database and storage, as the draft runs.
  4. stackly push: sends your commits to the draft. stackly pull brings Stackly’s changes in.
  5. Publish in Stackly. stackly publish shows the state and opens the page; the click stays yours.

Working alongside Stackly’s AI#

You and Stackly’s AI share one history. Nothing you do overwrites the other side: a push that does not include Stackly’s newest changes is refused, so you always bring them in first.

  1. stackly status before you start. If Stackly has changes, stackly pull.
  2. Work and commit as usual.
  3. Before you push, stackly diff shows what the AI changed in the meantime. Add --patch to see the lines.
  4. stackly sync -m "what you did" commits your work, brings Stackly’s changes in (merging both sides), and pushes.
  5. If both sides changed the same lines, sync stops and names the files. Fix them, run git add and git commit, then stackly push. Or git merge --abort to go back.

A push waits while the AI is in the middle of a chat turn. stackly status tells you when it is.

Commands#

CommandWhat it does
status [--json]Commits to push, changes to pull, and whether Stackly’s AI is working.
diff [--patch]What changed on Stackly and here since the two sides parted. Merges nothing.
history [-n 20]Recent commits of both sides, marked live, draft, not pushed or not pulled.
sync [-m msg] [--wait]Commit, pull with a merge, then push, in one step.
pullBrings Stackly’s changes in.
push [-m msg] [--wait]Sends your commits to the draft. --wait waits for the build.
checkRuns the app format check, including the migration history.
migration new <name>Adds the next numbered migration file. --sql "…" fills it, checked against the rules first.
migration lsEach migration: new, on Stackly, changed since pushed, applied to the draft.
sample new <name>Adds the next numbered sample data file. Samples run in the draft only.
secrets [init]Which declared secrets .dev.vars sets, by name only. init adds empty lines and keeps the file out of git.
logs [--follow]The draft’s build and runtime logs.
schemaThe draft database’s tables, columns and migrations. Never rows.
outbox [--full]The requests the draft held instead of sending: emails, webhooks, payment calls.
open [project|draft|live]Opens the project in Stackly, the draft, or the live app.
dbTables and rows of the local database only.
storageFiles in local storage only.
doctorChecks Node.js, git, the login, the folder, secrets and the app format, and says what to fix.
upgradeInstalls the newest CLI from Stackly.
completion zsh|bash|fishPrints tab completion for your shell.
mcpRuns the CLI as an MCP server for your agent.

Using it with an agent#

Add the installed command to your agent’s MCP settings. It gives the agent tools to check the app, see what changed on each side, pull, sync and push, read the draft’s logs, schema and outbox, and add migrations. It has no publish tool and never reads a secret value.

{
  "mcpServers": {
    "stackly": { "command": "stackly", "args": ["mcp"] }
  }
}

When a push is refused#

  • Your working tree has uncommitted changes.
  • Your commits do not build on Stackly’s latest; run stackly pull first.
  • Stackly’s AI is in the middle of a chat turn.
  • The format check fails.

An accepted push rebuilds the draft only. Live never changes from a push.

stackly.json#

{
  "formatVersion": 1,
  "framework": "tanstack-start",
  "bindings": ["APP_DATABASE", "APP_STORAGE"],
  "secrets": [
    { "name": "STRIPE_SECRET_KEY", "description": "From the Stripe dashboard" },
    { "name": "SESSION_SECRET", "description": "Signs sessions", "generate": "random" }
  ],
  "outbound": ["api.stripe.com"]
}

Locally, secrets come from a .dev.vars file that you keep out of git. Credential files such as .env, *.pem and *.key are refused in the project.

Tokens#

  • Login token: from stackly login, reaches all your projects, lasts 90 days.
  • Project token: made in a project’s Local dev tab, reaches only that project.
  • Tokens can read and push source, read the draft’s logs, schema, releases and outbox, and (login tokens) create projects.
  • Tokens never read live data, secret values or settings, and cannot publish or make other tokens.
  • Revoke any token in a project’s Local dev tab at once. Keep tokens out of code and chat.