> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# How to deploy n8n on Square Cloud

> This tutorial will guide you to create and deploy your n8n application on Square Cloud.

## Introduction

* This article guides you through creating and hosting a n8n application on Square Cloud.
* Before getting started, make sure you have an account on Square Cloud, which can be done through the sign up page. You can use your email to create an account.
* Finally, you need to have an active paid plan with at least 4GB RAM on your account. You can view our plans and purchase one according to your needs [here](https://squarecloud.app/en/pricing).

## Creating the Project

* First of all we need an javascript environment. To do this, we need a package.json.
* The package.json must contain on dependencies field the n8n and must have the scripts to start it. Here's the example:

```json package.json theme={null}
{
  "name": "squarecloud-n8n",
  "version": "1.0.0",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "start": "n8n"
  },
  "author": "Square Cloud Education <squarecloud.app>",
  "license": "ISC",
  "dependencies": {
    "n8n": "latest"
  }
}
```

<Info>
  We already have everything ready for deploy on our repository [here](https://github.com/squarecloud-education/n8n-web/releases). You just need to download the `project.zip` and upload it.
</Info>

## 📁 Necessary Files

The following files are necessary in your zip:

* package.json
* .env (optional)

## ⚙️ Configuration File

* You need to configure runtime environment to `Detect manually` and set it to `NodeJS`. In a squarecloud.config or squarecloud.app will look like this:

```systemd squarecloud theme={null}
DISPLAY_NAME=App name
RUNTIME=nodejs
START=npm run start
MEMORY=3072
VERSION=recommended
SUBDOMAIN=my-n8n-subdomain
```

* Next, we need to set 2 environment variables, `N8N_HOST` and `N8N_PORT` in a `.env` file or in the Square Cloud environment on the upload menu. Their values must be `0.0.0.0` and `80`.

```systemd .env theme={null}
N8N_HOST=0.0.0.0
N8N_PORT=80
```

## Uploading the Project to Square Cloud

After preparing your project files, you can now upload them to Square Cloud and host your project.

<Tabs>
  <Tab title="Upload via Dashboard">
    Access the [Square Cloud Dashboard](https://squarecloud.app/en/dashboard/new) and upload your project files.

    <Frame>
      <img src="https://cdn.squarecloud.app/docs/articles/dashboard/uploading.gif" alt="Uploading application to Square Cloud" style={{ borderRadius: "0.2rem" }} />
    </Frame>
  </Tab>

  <Tab title="Upload via CLI">
    <Steps>
      <Step title="First Step">
        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:

        ```
        npm install -g @squarecloud/cli
        ```

        If you already have it, we recommend updating it. To do this, run the following command in your terminal:

        <Tabs>
          <Tab title="Windows">
            ```bash theme={null}
            squarecloud update
            ```
          </Tab>

          <Tab title="Linux, macOS, and WSL">
            ```bash theme={null}
            curl -fsSL https://cli.squarecloud.app/install | bash
            ```
          </Tab>
        </Tabs>
      </Step>

      <Step title="Second Step">
        Now, to authenticate and use other CLI commands, you will find your authorization key [here](https://squarecloud.app/en/account/security) by clicking on "Request API Key". After obtaining your authorization key, run the following command:

        ```bash theme={null}
        squarecloud auth login
        ```
      </Step>

      <Step title="Third Step">
        Finally, to deploy your application to Square Cloud using the CLI, you need to run the following command, passing the path to your zip file:

        ```bash theme={null}
        squarecloud upload zip
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>
