🚀 Introduction
- Before getting started, you can choose to use the Bun runtime in your project. If you don’t have Bun installed locally yet, you have two main options:
-
Install via npm (recommended for compatibility with
npxduring deploy):
- Or install Bun via the official installer (check Bun documentation for native installation instructions).
-
By adding
bunas a dependency, you can usenpx bunin theSTARTfield ofsquarecloud.appto start your application with Bun. See below in the “Starting the Application” section forSTARTexamples. - Next, you will need to create an account on Square Cloud, which can be done through the login page. You can use your email, GitHub, or both to create the account.
- Finally, you need to have an active paid plan on your account. You can view our plans and purchase one according to your needs here.
⚙️ squarecloud.app file configuration
If you are uploading your application via the Square Cloud website, you can ignore this section. The site automatically creates the
squarecloud.app configuration file for you.Learn more: how to create the configuration file for Square Cloud.
The squarecloud.app file is a configuration file that will be used to
configure your application; it will serve to define the name, description,
version, main file, among other things.
▶️ How to start your application
- To use the Bun runtime in the Square Cloud Node.js environment, first add the
bunpackage to your project (e.g.npm install bun) so that thenpx buncommand is available in the runtime environment. - Then, set the
STARTfield in yoursquarecloud.appwith the command that starts your application using Bun. Example:
OR .config
-
Remember: if the
STARTfield is defined, the value in it will be executed directly. For more information about configuration file parameters, visit configuration parameters. -
If the
node_modulesfolder does not exist, Square Cloud will runnpm install --no-package-lock --no-audit --no-fundto install dependencies and clean the.npmfolder.
bun as a dependency (npm install bun) to ensure npx bun is available in the runtime environment during deploy. In projects where you prefer to use the native Bun installer, check compatibility and your build requirements before opting for this approach.
🖥️ Preparing the project
📁 Essential configuration files
When preparing your BUN project for deploy on Square Cloud, ensure you include the configuration file (squarecloud.app/.config) and your application’s essential files inside a zip file.
🗑️ Files to exclude before uploading
node_modules: This folder does not need to be uploaded as it will be recreated during installation in production.package-lock.json: This file is not needed as the production environment will install dependencies based onpackage.json.
🤔 Why exclude these files?
There are several reasons to excludenode_modules and package-lock.json before uploading your project:
-
Installation Consistency: Not uploading
node_modulesensures dependencies are installed by the production environment, resulting in a consistent build free of local system discrepancies. -
Updated Installations: The production environment will install the latest compatible versions of dependencies listed in
package.json, providing a clean start for your application. - Upload Size Reduction: Not including these folders reduces the uploaded file size, speeding up the upload process and making the deploy more efficient.
📄 Required Files
Three files are necessary to host your BUN project:- squarecloud.app/.config
- mainFile.js/.ts (Example of main file)
- package.json (Dependencies file)
💡 Troubleshooting
The main file is invalid or corrupted
The main file is invalid or corrupted
This error occurs when the file defined as “main” for your application in the
configuration file does not exist, is spelled incorrectly, or the path
is wrong. If your main file is inside a folder, for
example, you must inform
folder/file.js.Insufficient memory
Insufficient memory
The minimum amount of RAM required to host a bot is 256MB and for
a site/API it is 512MB. However, depending on the size and complexity of
your application, it may be advisable to allocate a larger amount of RAM to
avoid the LACK_OF_RAM error.
📤 How to host your project
Now that you have prepared all the files for your Bun project, the next step is to upload them to Square Cloud and put your application online. There are several ways to upload, but we will cover two: via Dashboard or via CLI.Via dashboard
Access the Upload Page
Access the upload page and upload your project zip file.
Configure Your Environment
After uploading your zip, you will need to configure the name, main file or runtime environment and other settings for your project.
If you are uploading a web project, make sure to select "Web Publication" and set a subdomain to your project.
If you are uploading a web project, make sure to select "Web Publication" and set a subdomain to your project.
Via CLI
To use this method, you need to create a config file namedsquarecloud.app in the root directory of your project. This file will contain the necessary configuration for your project.
Learn more about: how to create the configuration file for Square Cloud.
The squarecloud.app file is a configuration file that will be used to configure your application; it will be used to define your environment.
Install the CLI
First, you need to have the CLI installed in your environment. If you don't have it yet, run the following command in your terminal:If you already have it, we recommend updating it. To do this, run the following command in your terminal:
- Windows
- Linux, macOS, and WSL
Authenticate
Now, to authenticate and use other CLI commands, you will find your authorization key here by clicking on "Request API Key". After obtaining your authorization key, run the following command:


