Getting Started on Square Cloud with Node.js
Learn how to get started on Square Cloud with Node.js
๐ 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.
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 exclude node_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.
By doing this, you can ensure that your Node.js application is optimally prepared and secure for deployment to Square Cloud.
๐ 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
๐ค 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.
If you continue to experience any issues, please donโt hesitate to contact our support team.
Was this page helpful?