> ## 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.

# squarecloud.app Configuration File Reference

> Configure your app with the squarecloud.app file: MAIN, MEMORY, VERSION, DISPLAY_NAME, RUNTIME, START, SUBDOMAIN and AUTORESTART, with bot and site examples.

## What is the configuration file?

The configuration file tells Square Cloud how to run your application: which file to start, how much memory to reserve, which runtime version to use and, for a website, which subdomain to publish. It is a plain text file with one `KEY=VALUE` pair per line.

```systemd squarecloud.app theme={"system"}
MAIN=index.js
MEMORY=512
VERSION=recommended
DISPLAY_NAME=My first app
```

## Creating the configuration file

Create a file named `squarecloud.app` or `squarecloud.config` at the root of your project. Both names work the same way. When you upload a zip, the file must sit at the top level of the zip, not inside a subfolder, or the deploy fails with `MISSING_CONFIG`.

<Info>On **macOS**, we recommend the `squarecloud.config` name.</Info>

<Tip>The [VS Code extension](/en/vscode-extension/features#config-file-intellisense) autocompletes every key below and underlines invalid values as you type.</Tip>

## Configuration parameters

`MEMORY`, `VERSION` and `DISPLAY_NAME` are always required. `MAIN` is required unless you set `RUNTIME`.

| Parameter | Required | Editable after deploy | Limit | Purpose |
| - | - | - | - | - |
| [`MAIN`](#main) | Unless `RUNTIME` is set | No | 32 characters | File that starts the application. |
| [`MEMORY`](#memory) | Yes | Yes | Your plan's free RAM | RAM reserved for the application, in MB. |
| [`VERSION`](#version) | Yes | No | `recommended` or `latest` | Runtime version. |
| [`DISPLAY_NAME`](#display_name) | Yes | Yes | 32 characters | Name shown in the dashboard. |
| [`DESCRIPTION`](#description) | No | Yes | 280 characters | Short description. |
| [`AUTORESTART`](#autorestart) | No | Yes | `true` or `false` | Restart the application after a crash. |
| [`SUBDOMAIN`](#subdomain) | No | Only on websites | 63 characters | Publishes the application as a website. |
| [`RUNTIME`](#runtime) | No | No | See the table | Runtime, when `MAIN` can't tell it. |
| [`START`](#start) | No | Yes | 256 characters | Custom start command. |

Editable parameters can be changed in the dashboard after the deploy. Changing a non-editable parameter requires uploading the application again.

### MAIN

The file that starts your application, relative to the project root.

```systemd theme={"system"}
MAIN=index.js
```

```systemd theme={"system"}
MAIN=src/bot/main.py
```

* The file extension selects the runtime: `.js` runs on Node.js, `.ts` on TypeScript, `.py` on Python, and so on.
* The file must exist in your upload and can't be empty.
* Up to 32 characters: letters, digits, `_`, `.`, `/` and `-`, no spaces.

A missing `MAIN` (without `RUNTIME`) fails with `MISSING_MAIN`; a file that doesn't exist, has no extension or breaks the rules above fails with `INVALID_MAIN`.

### MEMORY

The RAM reserved for your application, in megabytes. It also sets your application's vCPUs and bandwidth.

```systemd theme={"system"}
MEMORY=512
```

The value must be at least the [minimum for your project type](/en/platform/limitations-and-restrictions#minimum-resource-requirements), and no more than the RAM your plan still has free. Otherwise the deploy fails with `INSUFFICIENT_MEMORY`.

### VERSION

The runtime version: `recommended` or `latest`. Any other value, including an exact version number, fails the deploy with `INVALID_VERSION`.

```systemd theme={"system"}
VERSION=recommended
```

Use `recommended` unless you need a feature that only the newest release has. The versions behind each value are listed in the [runtime versions table](/en/runtimes/introduction#versions).

### DISPLAY\_NAME

The name shown in the dashboard, the CLI and the API.

```systemd theme={"system"}
DISPLAY_NAME=Admin bot
```

Up to 32 characters: letters without accents, digits, spaces, `-` and `_`. Anything else, such as accented letters or emoji, fails with `INVALID_DISPLAY_NAME`.

### DESCRIPTION

A short description of the application, up to 280 characters (`INVALID_DESCRIPTION` beyond that).

```systemd theme={"system"}
DESCRIPTION=This bot helps with your daily tasks.
```

### AUTORESTART

Restarts the application automatically after a crash. Accepts `true` or `false`, and defaults to `false`, so turn it on for bots and anything that must stay online.

```systemd theme={"system"}
AUTORESTART=true
```

An automatic restart happens only when all of these are true:

* The application exited with status `1`, the usual exit code of an unhandled error in Node.js and Python.
* It had been running for at least 60 seconds, so an app that crashes right at boot isn't restarted in a loop.
* It hasn't been restarted automatically in the last hour.
* The logs don't show an error a restart can't fix: an invalid bot token, a missing module, a syntax or TypeScript type error, or a failed dependency install.

A restart keeps the app online through a transient error, but the underlying bug still needs a fix in your code. See also the help center article on [auto restart](https://help.squarecloud.app/en-us/article/how-to-use-auto-restart-on-square-cloud-nmhvh0/).

### SUBDOMAIN

Publishes the application as a website at `https://<subdomain>.squareweb.app`.

```systemd theme={"system"}
SUBDOMAIN=mysite
```

* Up to 63 characters: letters, digits and hyphens, not starting or ending with a hyphen. The name is stored in lowercase.
* A name that is already in use, reserved (such as `admin` or `api`) or invalid fails with `INVALID_SUBDOMAIN`.
* A website needs more RAM than a bot: see the [minimum RAM](/en/platform/limitations-and-restrictions#minimum-resource-requirements).
* Your server must listen on port `80` and host `0.0.0.0` (see [website doesn't load](/en/platform/troubleshooting/app-wont-start#website-doesnt-load)).

<Warning>Decide at the first upload whether the application is a website. On a website you can change the subdomain later, but you can't remove it (`CANNOT_SET_SUBDOMAIN`). An application deployed without `SUBDOMAIN` can't become a website: upload it again as a new application with `SUBDOMAIN` set.</Warning>

To serve the site on your own domain, see [how to set up your own domain](https://help.squarecloud.app/en-us/article/how-to-set-up-your-own-domain-cnamedns-1fzbrgh/) in the help center.

### RUNTIME

Sets the runtime explicitly, instead of deriving it from the extension of `MAIN`. An unknown value fails with `INVALID_RUNTIME`.

```systemd theme={"system"}
RUNTIME=nodejs
```

| Runtime | Accepted values |
| - | - |
| Node.js | `nodejs`, `javascript` |
| TypeScript | `typescript` |
| Python | `python` |
| C# / .NET | `csharp`, `dotnet`, `c#` |
| Elixir | `elixir` |
| Java | `java` |
| Rust | `rust` |
| Ruby | `ruby` |
| PHP | `php` |
| Go | `go`, `golang` |
| Static HTML/CSS | `static`, `html` |

With `RUNTIME` set you can leave out `MAIN`. In that case, also set `START`: most runtimes start the application by running the `MAIN` file.

### START

A custom start command. It replaces the default command, which runs your `MAIN` file.

```systemd theme={"system"}
START=npm run start
```

* Up to 256 characters (`INVALID_START` beyond that).
* Dependencies are still installed before the command runs.
* The command is read from the file on every start, so you can change it by editing `squarecloud.app` in the dashboard and restarting.

<Warning>Only call scripts that exist in your project. `START=npm run build && npm run start`, for example, fails on an Express app without a `build` script in `package.json`. Leave `START` out when the default command is enough.</Warning>

### ID

You don't write this key yourself. After `squarecloud upload`, the Square Cloud CLI adds `ID=<app ID>` to the file, so later commands such as `squarecloud commit` know [which application to target](/en/cli-reference/quickstart#how-the-cli-finds-your-app). Square Cloud ignores it when deploying.

## Examples

### Bot

```systemd squarecloud.app theme={"system"}
MAIN=index.js
MEMORY=512
VERSION=recommended
DISPLAY_NAME=Robin bot
DESCRIPTION=Moderation and music for my server.
AUTORESTART=true
```

### Website or API

```systemd squarecloud.app theme={"system"}
MAIN=index.js
MEMORY=512
VERSION=recommended
DISPLAY_NAME=My site
DESCRIPTION=My site is really cool!
SUBDOMAIN=mysite
AUTORESTART=true
```

The site answers at `https://mysite.squareweb.app`.

### Next.js

A framework that needs a build step uses `START`. Here `MAIN` only selects the Node.js runtime, so point it at your actual config file (such as `next.config.mjs`); the build and start scripts come from `package.json`.

```systemd squarecloud.app theme={"system"}
MAIN=next.config.js
MEMORY=2048
VERSION=recommended
DISPLAY_NAME=Nextjs site
SUBDOMAIN=nextjs
START=npm run build && npm run start
AUTORESTART=true
```

## Next steps

<CardGroup cols={2}>
  <Card title="Environment variables" icon="key" href="/en/platform/environment-variables">
    Keep tokens and connection strings out of your code and your zip.
  </Card>

  <Card title="squarecloud.ignore" icon="file-slash" href="/en/getting-started/squarecloud-ignore">
    Choose which files the CLI and VS Code leave out of the upload.
  </Card>

  <Card title="Runtimes" icon="server" href="/en/runtimes/introduction">
    Versions, dependency files and how each runtime starts your app.
  </Card>

  <Card title="Troubleshooting" icon="bug" href="/en/platform/troubleshooting/app-wont-start">
    What each deploy error means and how to fix it.
  </Card>
</CardGroup>


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