Skip to main content

Introduction

To develop and host Evolution API on Square Cloud, it’s essential to follow a structured sequence of configurations and prerequisites. This technical guide will cover the entire process, from initial setup to production deployment.

Prerequisites

  • Square Cloud Account: Register through the signup page using your email.
  • Active plan: Ensures dedicated resources and optimized performance for your application. Check our available plans and choose the most suitable for your needs.

Why use Evolution API?

Evolution API is an open-source API for WhatsApp. It manages several WhatsApp instances in one place, through its web manager or its REST API, and connects them to tools like n8n, Chatwoot and Typebot.

Setting up the project

Download the project from our evolutionapi-web releases, which already has the files needed to deploy on Square Cloud, or from the official repository.
The official repository lists typescript in devDependencies. Square Cloud installs dependencies in production mode, without devDependencies, so the npm run build step fails. Our release already moves it to dependencies; with the official repository, move it yourself.
Evolution API reads a .env file at the root of the project when it starts, so this file goes in your ZIP. Start from the .env in our release (or from .env.example in the official repository) and edit the variables below. Variables set in the dashboard’s Environment Variables take precedence over the .env file, which makes the dashboard the better place for secrets such as AUTHENTICATION_API_KEY and DATABASE_CONNECTION_URI. See Environment variables.

Database configuration

Evolution API needs a PostgreSQL database. You can host one on Square Cloud with the Standard plan or higher: see how to create and connect a managed database. After creating it, set its URL in the .env as DATABASE_CONNECTION_URI, together with the client certificate for the PostgreSQL connection. Here’s an example of the configuration needed:
.env
Evolution API connects through Prisma, which expects the client certificate as a .p12 file. Download the certificate files (.crt and .key) from the database’s page in the dashboard, convert them, and put the .p12 in your project:
The export password you choose is the sslpassword of the URL, and sslidentity is the path to the .p12 file. Keep the .p12 in your ZIP, since the application reads it from disk. With the environment variable and certificate set, apply the migrations to your database. From the project folder on your computer, install the dependencies with npm install (it needs the runWithProvider.js file) and run the following command:

Server configuration

As shown in the .env.example file of the repository, set the server variables: SERVER_TYPE, SERVER_PORT, SERVER_URL and the language.
.env
Evolution API reads its port from SERVER_PORT (not from PORT) and falls back to 8080 without it, so keep SERVER_PORT=80. It is important to configure a secure global API key to avoid unauthorized access. Replace it with a long random value of your own: the key in example files is public.
.env

Configuring Square Cloud

Create a squarecloud.app file at the root of the project. The START command generates the Prisma client, builds the project and starts it; installing and building needs about 3072 MB of RAM:
squarecloud.app
SUBDOMAIN must match the address in SERVER_URL. When uploading from the dashboard, select “Web Publication”, set the same subdomain and paste the START command as the startup command.

Deploying

Via dashboard

1

Access the Upload Page

Access the upload page and upload your project zip file.
2

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

Deploy Your Project

Finally, click on the “Deploy” button to host your project on Square Cloud.
After deployment, you can monitor your project’s status and logs from the dashboard.
Uploading application to Square Cloud
4

Confirm Your App Is Live

Your first deploy usually takes less than a minute. In the dashboard, wait for your application status to show as running and check the logs for any startup errors.
If you deployed a website or API, open https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
App not starting? See the Troubleshooting guide for the most common causes and fixes.

Via CLI

To use this method, your project needs a configuration file named squarecloud.app at its root. It tells Square Cloud how to run your application.

Configuration file guide

Learn how to create the squarecloud.app configuration file that defines your application’s environment.
1

Install the CLI

Install the Square Cloud CLI. If you already have it, run the same command to update it:
2

Log In

Run the command below. It opens your browser: approve the login there and the CLI is ready. There is no API key to copy. For scripts and CI, see CLI authentication.
3

Upload Your Project

From your project folder, run the command below. The CLI zips the current folder, leaving out what squarecloud.ignore lists, and uploads it:
To upload a zip you created yourself, pass it with --file:
4

Confirm Your App Is Live

Your first deploy usually takes less than a minute. Check your application status and logs directly from the terminal:
If you deployed a website or API, open https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
App not starting? See the Troubleshooting guide for the most common causes and fixes.

Additional info

After the first run, you can reduce the RAM to 1536MB or 2048MB and set the startup command to only:

Cache system

You can configure a cache system in Evolution API. To do so, you will need a Redis Database that you can also host in Square Cloud.
To configure it, you will also need to download the certificate and set the URL to connect. Note the rediss:// scheme: Square Cloud databases only accept TLS connections.
.env

Troubleshooting

Custom Domain

To use a custom domain (e.g., mysite.com) instead of the default URL mysite.squareweb.app, you need the Standard plan or higher. The default URL comes from the SUBDOMAIN field in the configuration file. To connect your domain, follow how to set up your own domain.

Minimum RAM Requirements

Minimum: 512MB RAM for websites and APIs, enough for a static build on the static runtime. For apps that render pages on a server (Next.js, Nuxt, Angular SSR and similar), we recommend at least 1GB RAM. For larger applications, allocate more RAM to prevent the application from running out of memory and crashing.

Could not find this site.

Check if the subdomain/domain matches what’s configured in the SUBDOMAIN field or in the custom domain settings. If you just uploaded the site, wait up to 60 seconds for Square to enable first access.

Site took too long to respond…

Your server must listen on port 80 and host 0.0.0.0. Square Cloud sets the PORT (80) and HOST (0.0.0.0) environment variables in your application: read them in your code instead of hardcoding other values. A server that listens only on localhost or 127.0.0.1 never receives requests.

Next steps

Managed database

Create the PostgreSQL database Evolution API needs.

Database connection errors

Fix SSL/TLS and connection errors.

WhatsApp bot

Build a single WhatsApp bot with whatsapp-web.js or Baileys.

Contact us

If you continue facing technical difficulties, our specialized support team is available to assist you. Contact us and we’ll be happy to help you resolve any issue: support quality is a big part of why developers rate Square Cloud 4.9/5 across 402 reviews on Google and Trustpilot.