Deploy and control your applications from the terminal

Sign in with a code in your browser, deploy any folder with one command, and reach logs, databases and workspaces from the same prompt, with output your scripts can read.

The Square Cloud CLI is open source and runs on macOS, Linux and Windows, on x86 and ARM. Its source code is on GitHub.

Install with one command

The install script and the npm package download the build for your system from the latest release and check its checksum before installing it.

macOS, Linux and WSL

curl -fsSL https://cli.squarecloud.app/install | bash

Installs to /usr/local/bin, so it may ask for your password.

Windows

npm i -g @squarecloud/cli

Needs Node.js with npm. The same command also works on macOS and Linux.

  • Checked against the release's SHA-256 checksums
  • Builds for x86 and ARM, Apple silicon included
  • To update, run the same command again
Other ways to install

Sign in without copying a key

The CLI shows a code, you approve it in your browser and the terminal gets a key of its own, the same way the VS Code extension connects.

  1. 1

    The terminal shows a code

    Run the login command and your browser opens on the approval page, while the terminal shows an eight-character code and a countdown.

  2. 2

    You approve it in the browser

    Type the code on the Square Cloud page and approve. Never enter a code that someone sent you.

  3. 3

    The CLI is signed in

    The terminal confirms your account and saves a key made for it, with only the permissions its commands use.

  • Each key lasts 90 days, and auth whoami shows until when
  • Asks before replacing another account on this machine
  • Over SSH, --no-browser prints the link to open anywhere
  • Have a key already? Use --token or --with-token

Deploy from any folder

Upload the folder you're in as a new application, send changes to one that already exists, or link a GitHub repository so every push deploys it.

  • Upload an application

    The CLI zips the current folder with your ignore rules, creates the application and prints the link to its page in the dashboard.

    uploadupload --file

    • Or send a zip you already have
    • Writes the new ID into squarecloud.app, if the project has one
  • Commit changes

    Send the folder, or a zip, to an application that already exists. It keeps its ID, domain and settings.

    commitcommit -rcommit --path

    • Restarts the application afterwards, if you ask
    • Can place the files in a folder of the application
  • Deploy on every push

    Link a repository and branch through the Square Cloud GitHub App, or create a webhook with a GitHub token, without leaving the terminal.

    app deploy github linkapp deploy webhookapp deploy list

One ignore file for the CLI and VS Code

upload, commit and zip leave out what squarecloud.ignore lists in the root of your project. The VS Code extension reads the same file, with the same rules.

  • The syntax of .gitignore

    # for comments, ! to bring a path back, dir/ for folders only, /build for the root only, and *, ?, [abc] and **. The last matching line wins, and case doesn't matter.

  • Sensible defaults

    node_modules, .git, .github, .vscode and the npm, pnpm and Yarn lockfiles stay out before your rules run. A line like !yarn.lock brings one back.

  • Check before you send

    squarecloud zip builds the same archive in your folder, so you can open it and see exactly what would go up.

Variables arrive exactly as you typed them

Your application loads its variables through a shell. Since version 3.1.1, the CLI sends values with spaces or characters such as $, & or ; in quotes, so the shell can't cut them short or expand them.

  • Set from the terminal

    Pass as many KEY=VALUE pairs as you like. The CLI takes the application from squarecloud.app or lets you pick it from a list.

    app env setapp env list

    • Single quotes, or double when the value has one
    • A value already in quotes is sent as written
  • Load a .env file

    Reads KEY=VALUE lines from a file and skips comments and blank lines. Lines that start with export and quoted values work too.

    --from-file .env

    • Works when you set or replace variables
    • The list shows them back as KEY=VALUE
  • Safe bulk changes

    Replace every variable at once, or remove them all. Both ask before changing anything, and a replace needs at least one new variable.

    app env replaceapp env remove --all-y

    • A flag answers yes for you in scripts
    • Answer no and nothing changes

Made for scripts and CI

Output a program can read, exit codes that mean what they say and a key that works without a browser.

  • JSON on request

    Commands that print data can answer in JSON, with only the result on stdout. The others refuse the flag with an error rather than print text a parser would trip on.

    --json

  • Honest exit codes

    Every failure exits with 1. When a confirmation can't be asked, with no terminal and no flag to answer it, the command fails and changes nothing.

    -y

  • A clean stdout

    Errors, questions and notices go to stderr, and so does the progress when you ask for JSON, so a pipe carries only the result.

    stdoutstderr

  • A key for pipelines

    Set a key from your account as an environment variable and every command uses it, with no login. When CI is true, the browser login won't start.

    SQUARECLOUD_API_KEYCI=true

  • Traces safe to share

    One variable prints the method, path, status and duration of each API call to stderr, never headers, query strings or bodies.

    SQUARECLOUD_DEBUG=1

  • GitHub Actions

    The Square Cloud Action installs the CLI on the runner, checks it against the release checksums and runs any command with your key.

    squarecloudofc/github-action@v2

The rest of the platform, too

Logs, metrics, files, snapshots, domains, databases and workspaces, each one a command away.

  • Logs and live stream

    Print the latest lines, or follow the output live along with each status change. Lines your application writes to stderr stay on stderr.

    app logsapp realtime

  • Status and metrics

    CPU, memory, disk and uptime for one application or a line for each of them, plus the last 24 hours of metrics.

    app status --allapp metrics

  • Remote files

    List, read, write, move and delete the application's files. Writing from a file keeps binaries intact, and reading into one asks before overwriting it.

    app file readapp file write

  • Snapshots

    Create a snapshot and download it, list its versions and restore one, for applications and databases.

    app snapshot createdb snapshot restore

  • Domains and traffic

    Set a custom domain, get the DNS records to create, read analytics, errors and performance from the edge, and purge the cache.

    app network domainapp network analytics

  • Databases

    Create MongoDB, MySQL, PostgreSQL and Redis databases, start or stop them, download the TLS certificate and rotate the password.

    db createdb credentials reset

Careful, open and in your language

  • In eight languages

    Messages, help and tables follow your system's display language on every run. LC_ALL picks another one for a single command.

  • No ID to memorize

    Most commands take the application from squarecloud.app, or list yours so you can pick one.

  • Asks before deleting

    Deleting, replacing every variable, restoring a snapshot or purging the cache asks first, and scripts can confirm with a flag.

  • Open source

    The code is on GitHub, and each release publishes its builds with SHA-256 checksums.

A plan for every stage of your project

Start small and scale when you need to, with no loyalty contracts.

4.9 out of 5 · 402 reviews on Google + TrustpilotTrustpilot

Hosted in a partner datacenter with certifications
Tier 3ISO 27001SOC 2 Type IIAlways-On DDoS Protection
Explore our infrastructure

Ready to scale your project?

Join the 500,000+ developers who have used Square Cloud to host their projects.

  • Predictable pricing
  • No billing surprises
  • Deploy in seconds
  • High availability
  • Scale with stability
  • Automatic restart
  • SSL and security included
  • Isolated containers