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 --versionstackly upgradeupdates it to the newest version.stackly doctorchecks your setup.- Remove it with
npm uninstall -g stackly-cli. - Install only from Stackly’s own address. The npm package called
stacklyis not Stackly’s, so do not runnpx stackly. - The project’s Local dev tab shows every command below with your project filled in.
The steps#
stackly login: opens Stackly, where you approve a code. Saves a 90-day token on your machine.stackly clone <project>: copies the source and its full history. Orstackly init <name>for a new one.stackly dev: builds the app and runs it locally with its own database and storage, as the draft runs.stackly push: sends your commits to the draft.stackly pullbrings Stackly’s changes in.- Publish in Stackly.
stackly publishshows 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.
stackly statusbefore you start. If Stackly has changes,stackly pull.- Work and commit as usual.
- Before you push,
stackly diffshows what the AI changed in the meantime. Add--patchto see the lines. stackly sync -m "what you did"commits your work, brings Stackly’s changes in (merging both sides), and pushes.- If both sides changed the same lines, sync stops and names the files. Fix them, run
git addandgit commit, thenstackly push. Orgit merge --abortto go back.
A push waits while the AI is in the middle of a chat turn. stackly status tells you when it is.
Commands#
| Command | What 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. |
pull | Brings Stackly’s changes in. |
push [-m msg] [--wait] | Sends your commits to the draft. --wait waits for the build. |
check | Runs 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 ls | Each 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. |
schema | The 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. |
db | Tables and rows of the local database only. |
storage | Files in local storage only. |
doctor | Checks Node.js, git, the login, the folder, secrets and the app format, and says what to fix. |
upgrade | Installs the newest CLI from Stackly. |
completion zsh|bash|fish | Prints tab completion for your shell. |
mcp | Runs 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.