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

> ## Agent Instructions
> These are the docs for Sevalla, a platform for deploying applications, databases, static sites, object storage and load balancers. The dashboard is at https://app.sevalla.com.
> Bold text in steps is an exact dashboard label.
> To act on a Sevalla account, prefer the Sevalla MCP server (https://mcp.sevalla.com/mcp, see https://docs.sevalla.com/ai-agents/overview.md), then the Sevalla CLI (https://docs.sevalla.com/developer-tools/cli.md), then the REST API (https://api-docs.sevalla.com, OpenAPI spec at https://api.sevalla.com/v3/openapi.json).
> Every page index is at https://docs.sevalla.com/llms.txt.

# Deploy a Turborepo monorepo

> Deploy each app of a Turborepo monorepo to Sevalla as its own application from one Git repository, with NIXPACKS_BUILD_CMD, NIXPACKS_START_CMD and deploy paths.

A Turborepo monorepo deploys to Sevalla as one application per app: each application builds from the same Git repository, and two environment variables tell Nixpacks which app to build with `turbo` and which one to start. This guide deploys the `web` and `docs` Next.js apps of Turborepo's starter.

## Before you begin

* A Sevalla company with a payment method, and a GitHub, GitLab or Bitbucket account for the repository. See [Git providers](/git/overview).
* Node.js 24 or later and pnpm on your computer.

## Create the project

Create a monorepo from Turborepo's `basic` example:

```bash theme={null}
npx create-turbo@latest storefront --package-manager pnpm
cd storefront
```

The monorepo has two Next.js apps, `apps/web` and `apps/docs`, and shared packages in `packages/`, such as `@repo/ui`. Each app's `start` script runs `next start`.

## Prepare the project for Sevalla

The root `package.json` already has what Nixpacks, the default [build strategy](/applications/builds/nixpacks), needs:

* `engines.node` is `>=24`, so Nixpacks installs Node.js 24 instead of its default, Node.js 18.
* `packageManager` names pnpm, so Nixpacks enables it with Corepack and installs the whole workspace with `pnpm i --frozen-lockfile` from the repository root. Commit `pnpm-lock.yaml`.

Nixpacks detects `turbo.json`, but on its own it builds every app with `turbo run build` and finds no command to start one app. Each Sevalla application gets these two variables instead:

| Variable | `web` application | `docs` application |
| - | - | - |
| `NIXPACKS_BUILD_CMD` | `pnpm turbo run build --filter=web` | `pnpm turbo run build --filter=docs` |
| `NIXPACKS_START_CMD` | `pnpm --filter web start` | `pnpm --filter docs start` |

`--filter=web` builds the `web` app and the workspace packages it depends on. `next start` takes its port from [`PORT`](/guides/javascript/overview#listen-on-the-port-environment-variable), which Sevalla sets to the web process's port (`8080` by default), so the ports that the `dev` scripts use don't matter on Sevalla.

Run `pnpm build` to check that the monorepo builds locally. Then commit everything and push it to your Git provider:

```bash theme={null}
git init
git add .
git commit -m "Prepare for Sevalla"
git branch -M main
git remote add origin https://github.com/acme/storefront.git
git push -u origin main
```

## Deploy to Sevalla

<Steps>
  <Step title="Create the application">
    In the sidebar, click **Applications**, then click **Create** > **Application**. Under **Source**, click **Private repository**, then choose the **Git provider**, the **Repository** and the **Branch**. Enter `storefront-web` as the **Name**. Under **Location**, choose a **Data center**. Keep the **Size** at **H1** or choose a larger one, then click **Create application**. The application opens on its **Overview** tab with the status **Not deployed yet**: creating an application doesn't deploy it.
  </Step>

  <Step title="Add the environment variables">
    Click the **Environment variables** tab, then click **Add environment variables**. Add `NIXPACKS_BUILD_CMD` and `NIXPACKS_START_CMD` with the values for the `web` application from the table in [Prepare the project for Sevalla](#prepare-the-project-for-sevalla), keep **Available during runtime** and **Available during buildtime** selected, and click **Add environment variables**.
  </Step>

  <Step title="Deploy">
    Click the **Overview** tab, then click **Deploy now** under **Recent deployments**. Check the **Branch** and click **Deploy**.
  </Step>

  <Step title="Turn on auto-deploy">
    To deploy every push to the branch automatically, click the **Settings** tab, then click **Update auto-deploy** in the **Auto-deploy** section. Turn on **Auto-deploy** and click **Update auto-deploy**. See [Deployments](/applications/deployments#deploy-automatically-on-push).
  </Step>

  <Step title="Deploy the docs app">
    Repeat steps 1 to 4 for a second application named `storefront-docs`, from the same repository and branch, with the values for the `docs` application.
  </Step>
</Steps>

## Verify the deployment

1. On each application's **Deployments** tab, wait for the deployment's status to change to **Deployed**. The application's status next to its name changes to **Running**.
2. Click the domain under each application's name, for example `storefront-web-x7k2m.sevalla.app`. Each one opens its own Next.js starter page.

<Frame>
  <img className="block dark:hidden" src="https://assets.sevalla.com/screenshots/light/app-overview-address.png" alt="The application header with its name, Running status, repository, branch and the domain that opens the application" width="1192" />

  <img className="hidden dark:block" src="https://assets.sevalla.com/screenshots/dark/app-overview-address.png" alt="The application header with its name, Running status, repository, branch and the domain that opens the application" width="1192" />
</Frame>

If a deployment fails, open it on the **Deployments** tab and read its build log, then see [Troubleshoot builds and deployments](/applications/troubleshooting/builds-and-deployments). A build log that runs `turbo run build` for every app means `NIXPACKS_BUILD_CMD` is missing or wasn't available during the build.

## Deploy changes

With **Auto-deploy** on, every push to the branch starts a deployment of both applications; otherwise, click **Deploy now** on each application for each change. Each deployment builds the image, then replaces the web process's instances. See [Deployments](/applications/deployments).

## Deploy only the apps that changed

To deploy an application only when its own files change, set its [deploy paths](/applications/deployments#deploy-only-when-some-files-change):

<Steps>
  <Step title="Open the deploy paths">
    Click the application's **Settings** tab, then click **Update deploy paths**.
  </Step>

  <Step title="Allow the app's files">
    Choose **Allow paths** and add the files the app is built from, as glob patterns. For `storefront-web`, add `apps/web/**`, `packages/**` and `pnpm-lock.yaml`. Click **Update deploy paths**.
  </Step>
</Steps>

Pushes that change none of these files no longer deploy the application. Deploy paths need GitHub or GitLab: Bitbucket pushes don't list the changed files, so with deploy paths set, every push from a Bitbucket repository is skipped.

## Connect the apps to each other

Applications in the same location can reach each other over the private network without going through the internet. On one application's **Networking** tab, under **Connected services**, add an internal connection to the other with **Add environment variables to the application** turned on: Sevalla adds `APP_HOST`, the other application's internal hostname. See [Networking](/applications/networking).

## Add a custom domain

To serve an application from your own domain, such as `shop.example.com`, add the domain on the application's **Domains** tab and create the DNS records that Sevalla shows. Custom domains need a web process larger than **H1**, so [scale](/applications/scaling) the web process first. See [Custom domains](/domains/overview).


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