Getting started

Get a key, create an app, push a function, try it on a sandbox, then make it live and call it.

Docs menu

You need the CLI (substrio) and Node 18 or later. To move an existing backend instead, read bring-your-project.md after step 3.

npm install -g @substrio/cli
substrio --help

1. Get a key

Sign up at substrio.com and copy a key from the console, or do it from the terminal: substrio signup --url https://mcp.substrio.com --tenant IDENTITY_APP --email [email protected] proves your email with a mailed code, makes you an account and saves its first key as a profile (--tenant is the identity app's slug; substrio.com tells you which one to use). See quickstart.md for the full substrio signup walkthrough.

2. Log in

substrio login --key - < key.txt

substrio login reads the key from stdin and saves it to a profile. With no --url the profile points at https://mcp.substrio.com; pass --url for an app's own host. substrio signup already saved a profile for you, so you only need substrio login for a key you got another way (the console, a teammate).

3. Create or pick an app

substrio app create myapp
substrio app list

substrio app create NAME makes an app under your account and saves its key to a profile named after it; substrio app list shows the apps you already have, and substrio app get reads the record of the profile's own app (app.get: its hosts, domains, state and limits). Everything you push and call next targets the app named by your current profile (accounts-and-apps.md).

4. Write and push a function

mkdir myapp && cd myapp
substrio init --yes

substrio init writes substrio.toml, functions/, public/ and a sample functions/hello.js. substrio.toml never holds a key; it names a profile. The file is explained in project-files.md.

substrio push -m "first version"

substrio push builds the project, uploads it as a new version and runs it in the app's dev sandbox; you see the sandbox's address.

5. Try it on a sandbox or test host

substrio push prints the dev sandbox's own host, for example myapp--dev.substrio.com: call your function there before anyone else sees it.

curl https://myapp--dev.substrio.com/v1/functions/hello/_invoke \
  -H "Authorization: Bearer $SUBSTRIO_KEY" -d '{"name":"world"}'

Bind a sandbox to a hostname of your own for a longer-lived preview: test-hosts.md.

6. Make it live

substrio promote

substrio promote makes the pushed version live (the data is backed up first). substrio rollback undoes a promote.

7. Call it

curl https://myapp.substrio.com/v1/functions/hello/_invoke \
  -H "Authorization: Bearer $SUBSTRIO_KEY" -d '{"name":"world"}'
mcp() { curl -s https://myapp.substrio.com/mcp -H "Authorization: Bearer $SUBSTRIO_KEY" \
  -H 'content-type: application/json' -d "$1"; }
mcp '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"substrio_function_invoke","arguments":{"name":"hello","event":{"name":"world"}}}}'

Every function is also callable over MCP with substrio_function_invoke, by the same key. See mcp.md and agents.md for connecting an agent instead of curl.

Next