Configuration file? What is it? 🤔

The configuration file is a file that contains the parameters of your application, such as the main file, memory, version, and other parameters. This file is used to configure and deploy your application on the Square Cloud platform.

Creating the configuration file

It’s very simple to create the configuration file, just create a file with the name squarecloud.app or squarecloud.config and put the configuration parameters inside it.

1

Select extension

The configuration file can have two extensions: .app or .config. You can choose the extension you prefer. Tip: use .app to help promote Square (squarecloud.app). 😂

In macOS, we recommend using the .config extension.
Note: .app or .config is the file extension, not the name.

2

Create file

Create a file with the extension you selected and put the configuration parameters inside it.

Configuration parameters

Below you can see the configuration parameters that you can use in your configuration file.

MAIN [*]

The MAIN parameter is used to define the main file of your application.

Example:
MAIN=index.js
Also, support subdirectories.
MAIN=src/loaders/index.js
This parameter has maximum of 32 characters.
This configuration is IGNORED if you use START parameter.

MEMORY [*]

The MEMORY parameter is used to define the amount of memory that your application will use on the Square Cloud platform.

MEMORY=256
The value is in megabytes (MB).
The minimum memory for a bot is 256MB and for a website is 512MB.

VERSION [*]

The VERSION parameter is used to define the version of your application.

VERSION=recommended
For each language there is a different version, see the table below.
LanguageVersion recommendedVersion latest
JavaScript [Node.js]20.9.0 (LTS - 2023)21.1.0
Python3.11.63.12
JavaJDK 17JDK 18
Elixir1.15.41.15.4
Rust1.76.01.76.0
PHP8.2.108.2.10
Go1.21.31.21.3
HTML/CSSBuild 07-29-23Build 07-29-23
We recommend using the recommended version as our team has performed extensive testing on all recommended versions.

DISPLAY_NAME [*]

The DISPLAY_NAME parameter is used to define the name of your application.

Example:
DISPLAY_NAME=Admin BOT
This parameter has maximum of 32 characters.

DESCRIPTION

The DESCRIPTION parameter is used to define the description of your application.

Example:
DESCRIPTION=This bot is designed to help you with your daily tasks.
This parameter has maximum of 280 characters.

AUTORESTART

The AUTORESTART parameter is used to define if your application should restart automatically if it crashes.

Example:
AUTORESTART=true
By default, this parameter is set to false.

SUBDOMAIN

The SUBDOMAIN parameter is used to define the subdomain of your website.

Example:
SUBDOMAIN=mysite
This parameter has maximum of 63 characters.
Website url will be: mysite.squareweb.app

START

The START parameter is used to define a custom startup command for your application.

Example:
START=npm run start
This parameter has maximum of 128 characters.
This parameter ignores the MAIN parameter, which is used to join Square’s standardized initialization commands.

Examples of configuration for bots

We have some examples of configurations for bots, below you can see some examples.

This example just use required parameters. (minimum configuration)
MAIN=index.js
MEMORY=256
VERSION=recommended
DISPLAY_NAME=Robin bot
This example is a bot with all parameters.
MAIN=index.js
MEMORY=256
VERSION=recommended
DISPLAY_NAME=Robin bot
DESCRIPTION=Robin is a bot designed to help you with your daily tasks.
AUTORESTART=true
This example use all parameters and CUSTOM STARTUP COMMAND in a bot.
MAIN=index.js
MEMORY=512
VERSION=recommended
DISPLAY_NAME=Batman force
START=npm run start

Examples of configuration for websites

We have some examples of configurations for websites, below you can see some examples.

Website url will be: mysite.squareweb.app
This example use all parameters and CUSTOM STARTUP COMMAND in a website.
MAIN=index.js
MEMORY=512
VERSION=recommended
DISPLAY_NAME=My website!
DESCRIPTION=My website is very cool!
SUBDOMAIN=mysite
START=npm run build && npm run start
AUTORESTART=true
MAIN next.config.js used only to system recognize the project as a JavaScript project or TypeScript project (another .ts/.tsx file)
Next.js website example.
MAIN=next.config.js
MEMORY=1024
VERSION=recommended
DISPLAY_NAME=Next.js website
DESCRIPTION=This website is built with Next.js.
SUBDOMAIN=nextjs
START=npm run build && npm run start
AUTORESTART=true

Reforcing the limits

For security and performance reasons, there are limits on the configuration parameters, below you can see the limits of each parameter.

ParameterCharacter limit
MAIN32 characters
DISPLAY_NAME32 characters
DESCRIPTION280 characters
START128 characters
SUBDOMAIN63 characters