🚀 Introduction
- Before you begin, make sure you have Node.js and npm installed on your system. If you don’t have them yet, you can download them from the official Node.js website.
- Next, you will need to create an account on Square Cloud, which can be done through the login page. You can use either your email or Discord, or both, to create an 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.
⚙️ Creating the squarecloud config file
Learn about: how to make 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 the name, description,
version, main file, among other things.
▶️ Start Application
- If the
START
field is not defined in the configuration file, Square Cloud will by default runnode
with optimization options and specific parameters. If theSTART
field is defined in the configuration file, the value in theSTART
field will be executed directly. For more information on configuration file parameters, visit configuration parameters.
- If the
node_modules
folder does not exist, Square Cloud will runnpm install --no-package-lock --no-audit --no-fund
to install dependencies and clean the.npm
folder.
🖥️ Preparing Your Node.js Project
📁 Essential Configuration Files
When preparing your Node.js project for deployment on Square Cloud, ensure that you include your configuration file (squarecloud.app/.config
) and the essential files of your application in a zip file.
The configuration (
squarecloud.app/.config
) file must be located in the root of the zip file. Otherwise, Square Cloud will not be able to find it during deployment.🗑️ Files to Exclude Before Uploading
node_modules
: This folder is not required to be sent as it will be created during the installation process in the production environment.package-lock.json
: This file is not necessary because 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 sending the
node_modules
folder ensures that dependencies are installed by the production environment, resulting in a consistent build free from local system discrepancies. -
Updated Installations: The production environment will install the latest compatible versions of the dependencies listed in
package.json
, providing a clean start for your application. - Reduced Upload Size: Leaving out these files decreases the size of your upload file, which speeds up the upload process and makes deployment more efficient.
📄 Required Files
Three files are required to host your Node project:- squarecloud.app/.config
- mainFile.js/.ts (Example of main file)
- package.json (Dependency file)
Square Cloud natively supports
TypeScript
, running your project through
ts-node, but it is recommended to always compile to JavaScript
since we are
a production platform.💡 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 written incorrectly, or the path
is incorrect. If your main file is inside a folder, for example, you should
enter
folder/file.js
.Bad Memory
Bad Memory
The minimum amount of RAM required to host a bot is 256MB, and for a
website/API, it’s 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.
📤 Uploading Project to Square Cloud
After preparing your project files, you can now upload them to Square Cloud and host your project.Access the Square Cloud
Dashboard and upload your project
files.
