Skip to main content

Overview

The Sutro CLI is the fastest way to build a SLang backend from your local editor. You write .slang files locally, and Sutro runs validation, preview, and publish workflows on the hosted Sutro backend. In this guide, you’ll:
  • Install the CLI.
  • Log in with your Sutro account.
  • Link a local folder to a Sutro Project and Application.
  • Run a remote dev session with live reload.
  • Validate and publish the backend.

Before you begin

You need:
  • Node.js 22 or later.
  • npm, pnpm, or yarn.
  • A Sutro account.
Publishing requires a payment method on file. You can add one in Sutro Studio or Sutro Console.

Steps

1

Install the CLI

Install the CLI globally:
npm install --global @sutro-dev/sutro-cli
Confirm that the sutro command is available:
sutro --version
2

Log in

Start the browser-based login flow:
sutro login
The CLI opens Sutro Studio in your browser. After login completes, the CLI stores a local session for future commands.If your environment cannot open a browser automatically, print the login URL instead:
sutro login --no-open
3

Create a local project

Create a new folder and initialize it with Sutro:
mkdir task-api
cd task-api
sutro init --name "Task API"
sutro init creates a remote Project and Application, writes sutro.config.json, and creates app.slang if it does not exist.To link an existing Application instead, pass its ID:
sutro init --application-id <APPLICATION_ID>
4

Write a SLang backend

Replace the generated app.slang with a small task API:
entity Task
  fields
    title: TEXT
    completed: BOOLEAN

action CreateTask(title: TEXT): Task
  body
    return create Task {
      title := title
      completed := false
    }

action ListTasks(): Page<Task>
  body
    return pageOf Task

trigger CreateTask on HttpRequest
  endpoint POST /tasks
  arguments
    title := @request.body.title

trigger ListTasks on HttpRequest
  endpoint GET /tasks
5

Start a remote dev session

Start the preview server:
sutro dev
The CLI creates a remote dev session, uploads your local .slang files, and prints a preview API URL:
Remote dev session ready.
  url:     https://dev-<SESSION_ID>.app.withsutro.com/api/latest/
  session: <SESSION_ID>
  version: 1.0.1
  files:   1
Keep this command running while you edit. When a .slang file or sutro.config.json changes, the CLI uploads the latest source and refreshes the remote preview.Press Ctrl + C to stop the dev session.
6

Call the preview API

Open a second terminal and call the URL printed by sutro dev:
export SUTRO_DEV_API="https://dev-<SESSION_ID>.app.withsutro.com/api/latest"

curl -X POST "$SUTRO_DEV_API/tasks" \
  -H "Content-Type: application/json" \
  -d '{"title":"Write CLI docs"}'

curl "$SUTRO_DEV_API/tasks"
Replace <SESSION_ID> with the value printed by sutro dev.
7

Validate the project

Run validation before publishing:
sutro validate
The CLI uploads the local SLang source to Sutro for validation and prints compiler diagnostics if the project does not compile.
8

Publish the backend

Publish the linked Application:
sutro publish
The CLI uploads the local SLang source, publishes the Application, and prints the published API URL and version.
9

Inspect the published app

Check the linked Application:
sutro status
Save the published OpenAPI spec:
sutro openapi --out openapi.json
You now have a local SLang project linked to Sutro, a remote dev preview, and a published backend API.

Learn more