> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# How Square Cloud Works: Applications, RAM, Deploys and What Is Kept

> The concepts behind Square Cloud on one page: what an application is, how your plan's RAM is shared, upload versus commit, what runs at each start and which files survive a restart, a commit and a restore.

Square Cloud runs your code in an isolated container that stays online around the clock. You send the project once, and from then on you manage one application: update it, restart it, read its logs. This page explains the few concepts everything else builds on.

## The pieces

| Piece | What it is |
| :- | :- |
| **Application** | Your code, running in its own isolated container with its own ID, RAM and 10 GB of disk. A bot, a website, an API and a worker are all applications. |
| **Database** | A managed [PostgreSQL, MySQL, MongoDB or Redis](https://docs.squarecloud.app/en/services/databases.md), with its own RAM and disk. Your application connects to it with a URL. |
| **Blob Storage** | [Object storage](https://docs.squarecloud.app/en/services/blob.md) for files such as uploads and media, outside of any application. |
| **Plan** | Sets the total RAM that your applications and databases share. See [how the RAM is shared](https://docs.squarecloud.app/en/platform/plans.md#how-the-ram-is-shared). |
| **Workspace** | Shares applications with the people on your team, from the Standard plan. |

## Two kinds of application

The `SUBDOMAIN` line of the [configuration file](https://docs.squarecloud.app/en/getting-started/config-file.md) decides which kind you create:

| | Without `SUBDOMAIN` | With `SUBDOMAIN` |
| :- | :- | :- |
| **Use it for** | Bots, workers, scheduled jobs | Websites and APIs |
| **Address** | None: nothing reaches it from the internet, it only opens connections of its own | `https://<subdomain>.squareweb.app`, or your own domain from the Standard plan |
| **What your code must do** | Just run | Listen on port `80` and host `0.0.0.0` |
| **Minimum RAM** | 256 MB | 512 MB |

HTTPS is handled for you: the certificate is issued and renewed by Square Cloud, and requests reach your server as plain HTTP on port 80.

> [!WARNING]
>
> The kind is chosen at the first upload. An application created without `SUBDOMAIN` can't become a website later, and a website can change its subdomain but can't lose it.

## The life of an application

**1. Upload creates it**

You send a `.zip` with your code and the configuration file. Square Cloud picks the runtime from `RUNTIME` or from the extension of `MAIN`, creates the container with the RAM you asked for and starts it. The application gets an ID that never changes.

**2. It runs until you stop it**

Applications don't sleep when idle. With `AUTORESTART=true`, an application that crashes is started again.

**3. A commit updates it**

A [commit](https://docs.squarecloud.app/en/getting-started/manage-your-app.md#update-your-code) sends new files to the same application. The ID, the address, the settings and the environment variables stay. The new code runs after a restart.

**4. Deleting it frees the RAM**

The RAM goes back to your plan's pool. A stopped application keeps its RAM reserved.

## What runs at each start

Every start, including a restart and an automatic restart, goes through the same three steps:

1. **Environment variables are loaded.** The ones you set, plus `PORT`, `HOST` and the others [Square Cloud sets for you](https://docs.squarecloud.app/en/platform/environment-variables.md#variables-square-cloud-sets-for-you).
2. **Dependencies are installed** from your dependency file: `package.json`, `requirements.txt` and so on. Node.js installs only when there is no `node_modules` folder yet, so the first start takes longer than the next ones.
3. **Your code starts,** with the `START` command or, without one, the default command of the runtime for your `MAIN` file.

There is no separate build phase and no shell to run commands in. A command that has to run on the server goes in `START`, and it runs at every start. The [runtimes page](https://docs.squarecloud.app/en/runtimes/introduction.md#how-a-deploy-works) lists the default command and the dependency file of each language.

## What is kept

| Event | The application's files | ID, address and settings |
| :- | :- | :- |
| **Restart, or stop and start** | Kept | Kept |
| **Commit** | The files you send replace the ones with the same name. The others are kept. | Kept |
| **Snapshot restore** | Replaced by the files of the snapshot | Kept |
| **A new upload** | A second application, created from the zip | New ID |
| **Delete** | Gone | Gone |

Environment variables are kept through restarts and commits.

Files your application writes while it runs, such as a SQLite file, a JSON file or uploaded images, live on its 10 GB disk and survive a restart. Two things take them away: a commit that sends a file with the same name, and a snapshot restore. So:

* Keep data in a [managed database](https://docs.squarecloud.app/en/services/databases.md) and files in [Blob Storage](https://docs.squarecloud.app/en/services/blob.md).
* If the application does write data files, list them in [`squarecloud.ignore`](https://docs.squarecloud.app/en/getting-started/squarecloud-ignore), so a commit from your machine doesn't replace the server's copy with an older one.
* Take a [snapshot](https://docs.squarecloud.app/en/getting-started/manage-your-app.md#snapshots) before a risky change.

## Resources and limits

* **RAM** is the one number you choose, with `MEMORY`. It comes out of your plan's pool and also sets the application's [vCPUs](https://docs.squarecloud.app/en/platform/limitations-and-restrictions.md#cpu-allocation) and [bandwidth](https://docs.squarecloud.app/en/platform/limitations-and-restrictions.md#network-limits).
* **Disk** is 10 GB per application and per database.
* **Square Shield** watches RAM, CPU, disk and the requests an application makes to external APIs. An application that goes over a limit is stopped, or has its requests limited, and its log says why. See the [limit statuses](https://docs.squarecloud.app/en/platform/limitations-and-restrictions.md#limit-exceeded-statuses).

## Pick your tool

Every tool below manages the same applications, so you can use the one that fits each task and mix them freely:

| Tool | Good for |
| :- | :- |
| [Dashboard](https://squarecloud.app/en/dashboard) | First deploys, settings, the realtime console, the Database Explorer |
| [CLI](https://docs.squarecloud.app/en/cli-reference/quickstart.md) | Deploying from the project folder, scripts and [CI](https://docs.squarecloud.app/en/cli-reference/ci-cd.md) |
| [VS Code extension](https://docs.squarecloud.app/en/vscode-extension/installation.md) | Commits and logs without leaving the editor |
| [REST API](https://docs.squarecloud.app/en/api-reference/introduction.md) and [SDKs](https://docs.squarecloud.app/en/sdks/introduction.md) | Your own automation, in JavaScript, Python, Go or plain HTTP |
| [MCP server](https://docs.squarecloud.app/en/mcp/overview.md) | Managing the account from an AI client |

## Next steps

> [card] [Quickstart](https://docs.squarecloud.app/en/getting-started/quick-start.md)
>
> Put a first application online in a few minutes.

> [card] [After your first deploy](https://docs.squarecloud.app/en/getting-started/manage-your-app.md)
>
> Update, restart, read logs and take snapshots.

> [card] [Plans and pricing](https://docs.squarecloud.app/en/platform/plans.md)
>
> How much RAM each plan gives you to share.

> [card] [Limits](https://docs.squarecloud.app/en/platform/limitations-and-restrictions.md)
>
> Minimum RAM, vCPUs, network, disk and the limit statuses.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.