> ## 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 Host a Website or API

> Host a website or API on Square Cloud: set up the squarecloud.app file with SUBDOMAIN and port 80, see static and Next.js examples and framework guides.

## Introduction

To host websites and APIs on Square Cloud, it's essential to follow proper configuration procedures and meet the necessary technical prerequisites. This comprehensive guide will present the entire professional implementation process.

### Technical prerequisites

* **Square Cloud Account**: Create your account through the [signup page](https://squarecloud.app/en/signup), using your email address for registration.
* **Active plan**: It's necessary to have an active plan to ensure adequate resources and optimized performance. Check our [available plans](https://squarecloud.app/en/pricing) and choose the most suitable for your needs.

## Square Cloud configuration file

<Card title="Learn about: how to create the configuration file for Square Cloud." icon="link" href="/en/getting-started/config-file">
  The squarecloud.app file is an essential configuration file that will be used to configure your application on Square Cloud. It defines name, description, version, main file, among other fundamental configurations.
</Card>

### Essential parameters for websites

Your server must listen on **port 80** and on **host `0.0.0.0`** (all network interfaces): Square Cloud delivers your subdomain's traffic there. It sets the `PORT` (`80`) and `HOST` (`0.0.0.0`) environment variables for you, so read the port from `PORT` and keep a fallback of `80`:

<CodeGroup>
  ```javascript Node.js theme={"system"}
  const port = Number(process.env.PORT) || 80;
  app.listen(port, "0.0.0.0");
  ```

  ```python Python theme={"system"}
  import os

  port = int(os.environ.get("PORT", 80))
  app.run(host="0.0.0.0", port=port)
  ```
</CodeGroup>

Many frameworks, such as Next.js and Nuxt, already read `PORT` on their own. Static websites don't need a server or a `START` parameter at all.

**Main parameters of the squarecloud.app configuration file:**

* `SUBDOMAIN`: For website hosting, define this parameter with your desired subdomain. Set it on the first upload: an application uploaded without a subdomain can't get one later.
* `START`: Custom startup command (when necessary).
* `MEMORY`: RAM allocated to your application, in megabytes. Websites and APIs need at least 512. Curious why there is a minimum value? See [why RAM minimums exist](/en/platform/limitations-and-restrictions#why-do-ram-minimums-exist).

<Note>The website URL will be: `my-subdomain-parameter`.squareweb.app</Note>

### Configuration examples

**Example 1: Static website without custom startup command**

```systemd theme={"system"}
MAIN=index.html
MEMORY=512
VERSION=recommended
DISPLAY_NAME=My simple static website!
SUBDOMAIN=mysite-simple-website
```

**Example 2: Next.js website with a custom startup command**

```systemd theme={"system"}
RUNTIME=nodejs
MEMORY=1024
VERSION=recommended
DISPLAY_NAME=My simple Next.js website!
SUBDOMAIN=mysite-nextjs-website
START=npm run start
```

Run `npm run build` on your machine first and include the `.next` folder in the zip: Square Cloud doesn't install `devDependencies`, so the build can't run on the server. With a `START` command, `RUNTIME=nodejs` picks the Node.js runtime and no `MAIN` file is needed. For framework-specific details, see the [Next.js guide](/en/tutorials/website/nextjs).

### Custom domain

To serve your website from your own domain (e.g., `mysite.com`) instead of `mysite.squareweb.app`, you need the Standard plan or higher. Follow [how to set up your own domain](https://help.squarecloud.app/en-us/article/how-to-set-up-your-own-domain-cnamedns-1fzbrgh/) in the help center.

## Support for multiple technologies

Square Cloud offers comprehensive support for various web development technologies, providing flexibility in choosing the most suitable tech stack for your project.

<CardGroup cols={2}>
  <Card title="React" icon="react" href="/en/tutorials/website/react">
    Learn how to host your React website on Square Cloud.
  </Card>

  <Card title="Next.js" icon="node-js" href="/en/tutorials/website/nextjs">
    Learn how to host your Next.js website on Square Cloud.
  </Card>

  <Card title="NestJs" icon="js" href="/en/tutorials/api/nestjs">
    Learn how to host your NestJs application on Square Cloud.
  </Card>

  <Card title="Vite" icon="rocket" href="/en/tutorials/website/vite">
    Learn how to host your Vite website on Square Cloud.
  </Card>

  <Card title="Vue" icon="vuejs" href="/en/tutorials/website/vue">
    Learn how to host your Vue website on Square Cloud.
  </Card>

  <Card title="Express" icon="node-js" href="/en/tutorials/api/express">
    Learn how to host your Express API on Square Cloud.
  </Card>

  <Card title="Flask" icon="flask" href="/en/tutorials/api/flask">
    Learn how to host your Flask application on Square Cloud.
  </Card>

  <Card title="Django" icon="python" href="/en/tutorials/api/django">
    Learn how to host your Django application on Square Cloud.
  </Card>

  <Card title="FastAPI" icon="python" href="/en/tutorials/api/fastapi">
    Learn how to host your FastAPI application on Square Cloud.
  </Card>

  <Card title="Lavalink" icon="java" href="/en/tutorials/how-to-create-your-lavalink-server">
    Learn how to host your Lavalink server and stream high-quality music to your Discord bot.
  </Card>
</CardGroup>

## Next steps

<CardGroup cols={3}>
  <Card title="App won't start" icon="triangle-exclamation" href="/en/platform/troubleshooting/app-wont-start">
    Fix port conflicts, missing modules and other startup failures.
  </Card>

  <Card title="Environment variables" icon="key" href="/en/platform/environment-variables">
    Keep API keys and connection strings out of your code.
  </Card>

  <Card title="Managed database" icon="database" href="/en/tutorials/how-to-deploy-your-database">
    Create a database for your website or API.
  </Card>
</CardGroup>

## Contact us

If you continue facing **technical difficulties**, our **specialized support team** is available to assist you. [**Contact us**](https://squarecloud.app/en/support) 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**](https://www.trustpilot.com/review/squarecloud.app) on Google and Trustpilot.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.