> ## 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 Deno application

> Deploy a Deno 2 HTTP server to Sevalla from a Git repository: pin Deno in .dvmrc, commit deno.lock, and build with Ingot or the official denoland/deno image.

A Deno server runs on Sevalla as an application: Ingot, Sevalla's builder, detects `deno.json` in your Git repository and builds on the official Deno image for the version you pin, and the web process runs `main.ts` with `deno run`. `Deno.serve()` listens on the port that Sevalla sets in the `PORT` environment variable.

## At a glance

| | |
| - | - |
| Source | A Git repository |
| Build | [Ingot](https://docs.sevalla.com/applications/builds/ingot.md) (Deno 2, `deno install --frozen`), or the [Dockerfile](#deploy-with-a-dockerfile) |
| Start command | `deno run --allow-net --allow-env --allow-read main.ts`, which Ingot sets for `main.ts` |
| Port | The `PORT` environment variable, `8080` by default |
| Processes | Web process |
| Services | None |
| Disk | None |
| Size | **H1** for the web process |

### Environment variables

The application needs no environment variables of its own. Sevalla sets `PORT` to the web process's port, and Ingot's start command passes it to `Deno.serve()` in `DENO_SERVE_ADDRESS`.

## Before you begin

* A Sevalla company with a payment method, and a GitHub, GitLab or Bitbucket account for the repository. See [Git providers](https://docs.sevalla.com/git/overview.md).
* Deno 2 on your computer.

## Create the project

Create a project with `deno init`:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
deno init storefront
cd storefront
```

`deno init` writes `deno.json`, `main_test.ts` and `main.ts`, which is already an HTTP server. Sevalla sends `SIGTERM` to each instance it replaces during a deployment, so add a listener that shuts the server down at the end of `main.ts`:

```ts main.ts theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
export function handler(req: Request): Response {
  const url = new URL(req.url);

  if (url.pathname === "/api") {
    return Response.json({
      message: "Hello, world!",
      time: new Date().toISOString(),
    });
  }

  return new Response("<h1>Welcome to Deno!</h1>", {
    headers: { "content-type": "text/html" },
  });
}

if (import.meta.main) {
  const server = Deno.serve(handler);

  Deno.addSignalListener("SIGTERM", async () => {
    console.log("SIGTERM received, shutting down the server");
    await server.shutdown();
  });
}
```

`server.shutdown()` stops accepting connections and lets the requests in progress finish, then Deno exits. `Deno.serve(handler)` serves the page on port 8000 when you run it on your computer, and on `PORT` on Sevalla, as [Prepare the project for Sevalla](#prepare-the-project-for-sevalla) explains.

## Prepare the project for Sevalla

Pin the Deno version and write the lock file:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
echo "2" > .dvmrc
deno install
```

| File | Why Sevalla needs it |
| - | - |
| `.dvmrc` | [Ingot](https://docs.sevalla.com/applications/builds/ingot.md), the default build strategy, builds on the newest Deno 2 line it knows: Deno 2.9 in Ingot 0.5.0. Without a version, Ingot uses its default line, which a new Ingot release can move. |
| `deno.lock` | `deno install` writes the exact versions of the dependencies in `deno.json`, such as `@std/assert`, which `main_test.ts` uses. Ingot installs them with `deno install --frozen`, which fails instead of changing the versions. Without the lock file, the build log warns that dependency versions are chosen during the build. |

Ingot needs no other configuration:

* With no `start` task in `deno.json`, Ingot starts the web process with `deno run --allow-net --allow-env --allow-read main.ts`: the server can listen for requests, read environment variables and read the project's files. To start it another way, add a `start` task to `deno.json`, and Ingot runs `deno task start` instead.
* Before the server starts, Ingot sets `DENO_SERVE_ADDRESS` from [`PORT`](https://docs.sevalla.com/guides/javascript/overview#listen-on-the-port-environment-variable), which Sevalla sets to the web process's port (`8080` by default). The first `Deno.serve()` call then listens on that port on all network interfaces, whatever port the code asks for.

Run `deno task dev` and open `http://localhost:8000` to check the server locally. Then commit everything and push it to your Git provider:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
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

These steps build with [Ingot](https://docs.sevalla.com/applications/builds/ingot.md). To build from your own Dockerfile instead, see [Deploy with a Dockerfile](#deploy-with-a-dockerfile).

**1. 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**. 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.

**2. Deploy**

Click the **Overview** tab, then click **Deploy now** under **Recent deployments**. Check the **Branch** and click **Deploy**.

**3. 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](https://docs.sevalla.com/applications/deployments.md#deploy-automatically-on-push).

## Verify the deployment

1. On the **Deployments** tab, click the deployment. Its **Build log** shows Ingot's [build plan](https://docs.sevalla.com/applications/builds/ingot.md#read-the-build-plan): Deno 2.9 for the `2` in `.dvmrc`, and the start command for `main.ts`.

   ```text Build log theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
   ╭─ ■ Deno 2.9 application ───────────────────────────────────────────────────╮
   │ Deno     2.9                                                    .dvmrc "2" │
   │ Start    deno run --allow-net --allow-env --allow-read main.ts  main.ts    │
   ├─ Image ────────────────────────────────────────────────────────────────────┤
   │ Build    denoland/deno:debian-2.9.8                                        │
   │ Runtime  denoland/deno:debian-2.9.8                                        │
   │ User     1000:1000                                                         │
   │ Init     tini                                                              │
   │ Port     $PORT, default 8080                                               │
   ╰───────────────────────────────────────────────────────────── Ingot v0.5.0 ─╯
   ```

2. Wait for the deployment's status to change to **Deployed**. The application's status next to its name changes to **Running**.

3. Click the domain under the application's name, for example `storefront-x7k2m.sevalla.app`. The page shows `Welcome to Deno!`, and `/api` returns JSON with `"message":"Hello, world!"`.

4. Check the same address from a terminal:

   ```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
   curl -s https://storefront-x7k2m.sevalla.app/ | grep -o '<h1>[^<]*</h1>'
   curl -s https://storefront-x7k2m.sevalla.app/api | jq -r .message
   ```

   ```text theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
   <h1>Welcome to Deno!</h1>
   Hello, world!
   ```

![The application header with its name, Running status, repository, branch and the domain that opens the application](https://assets.sevalla.com/screenshots/light/app-overview-address.png)

With the API, [Get deployment](https://api-docs.sevalla.com/v3/applications/get-deployment) (`getDeploymentV3`) returns the deployment's `status`, `success` once it's deployed, and [Get application deployment logs](https://api-docs.sevalla.com/v3/applications/get-application-deployment-logs) (`getApplicationDeploymentLogsV3`) returns its build log, which ends with `Web has been deployed successfully.` See [Deploy with the API](#deploy-with-the-api).

If the deployment fails, read its build log, then see [Troubleshoot Ingot builds](https://docs.sevalla.com/applications/builds/ingot.md#troubleshoot-ingot-builds). If the server stops with a `NotCapable` error in the [runtime logs](https://docs.sevalla.com/applications/logs.md), it needs a permission that Ingot's start command doesn't grant, such as `--allow-write`: add a `start` task to `deno.json` that runs `main.ts` with the permissions it needs.

## Deploy with a Dockerfile

Ingot needs no Dockerfile. Write your own when you want full control of the image: the base image, the system packages and every layer. Add a `Dockerfile` and a `.dockerignore` to the root of the repository:

```dockerfile Dockerfile theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
FROM denoland/deno:debian-2.9.8
WORKDIR /app
ENV DENO_NO_UPDATE_CHECK=1 PORT=8080
COPY deno.json deno.lock ./
RUN deno install --frozen
COPY . .
RUN deno install --frozen --entrypoint main.ts
USER 1993:1993
EXPOSE 8080
CMD ["sh", "-c", "DENO_SERVE_ADDRESS=tcp:0.0.0.0:${PORT} exec deno run --allow-net --allow-env --allow-read main.ts"]
```

| Line or choice | Why |
| - | - |
| `denoland/deno:debian-2.9.8` | Deno's official image on Debian 13, with the release that Ingot builds for the `2` in `.dvmrc`. Deno publishes no tag that follows a line, so change the tag to move to a new release. |
| `deno.json` and `deno.lock` first | `deno install --frozen` downloads the exact versions in `deno.lock` into the image, and fails instead of changing them. Copying the two files before the code lets Docker reuse the downloaded modules when only the code changes. The second `deno install` caches what `main.ts` imports, so the server downloads nothing when it starts. |
| `USER 1993:1993` | The server runs as the image's unprivileged `deno` user. The code and the downloaded modules stay owned by root, so the server can read them but not change them. |
| The image's entrypoint | The image starts every command under `tini`, which passes `SIGTERM` to Deno. `main.ts` handles it. |
| `CMD` | Runs `main.ts` with the same permissions as Ingot's start command. `DENO_SERVE_ADDRESS` makes `Deno.serve()` listen on `PORT`, which Sevalla sets at runtime, on all network interfaces. `exec` replaces the shell with Deno. |
| `DENO_NO_UPDATE_CHECK=1` | Deno doesn't check for a new release each time it starts. |

```text .dockerignore theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
.git
*.log
.env*
Dockerfile
.dockerignore
```

Commit and push both files. Ingot doesn't use the `Dockerfile`, so you can keep it in a repository that builds with Ingot, but it adds the `.dockerignore` patterns to its own, and its build plan lists them in an `Ignored` row. Then switch the application to the Dockerfile build strategy:

**1. Choose the Dockerfile build strategy**

On the application's **Settings** tab, in the **Build strategy** section, click **Update build strategy**. Click **Dockerfile**, keep the **Dockerfile path** `Dockerfile` and the **Docker context** `.`, then click **Update build strategy**.

**2. Deploy**

Click the **Overview** tab, then click **Deploy now** under **Recent deployments**. Check the **Branch** and click **Deploy**.

![The Update build strategy sheet with Dockerfile selected, the Dockerfile path, the Docker context and the Docker registry credential](https://assets.sevalla.com/screenshots/light/app-settings-build-strategy-dockerfile.png)

The deployment's **Build log** shows `📦 Building and pushing docker image using Dockerfile...` instead of Ingot's build plan, and its **Dockerfile** tab shows your `Dockerfile`. When the deployment is **Deployed**, the domain shows `Welcome to Deno!` again, and the two `curl` commands in [Verify the deployment](#verify-the-deployment) print the same lines. See [Dockerfile](https://docs.sevalla.com/applications/builds/dockerfile.md) for build arguments and private base images, and [Deploy with the API](#build-from-the-dockerfile-with-the-api) to switch the build strategy with the API.

## Deploy changes

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

## Use environment variables

Add configuration on the application's **Environment variables** tab and read it with `Deno.env.get()`, which Ingot's start command allows with `--allow-env`. Variables marked **Available during buildtime** also reach `deno install` and the `build` task in `deno.json`, if the project has one, during the build. Variables apply at the next deployment. See [Environment variables](https://docs.sevalla.com/applications/environment-variables.md).

## Add a custom domain

To serve the 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](https://docs.sevalla.com/applications/scaling.md) the web process first. See [Custom domains](https://docs.sevalla.com/domains/overview.md).

## Deploy with the API

These calls make the same deployment as [Deploy to Sevalla](#deploy-to-sevalla), in an order that a script or an AI agent runs as it is. Each step names the [Sevalla API](https://docs.sevalla.com/developer-tools/api.md) operation, then the [CLI](https://docs.sevalla.com/developer-tools/cli.md) command and the [MCP server](https://docs.sevalla.com/ai-agents/overview.md) tool that do the same. You need:

* An [API key](https://docs.sevalla.com/developer-tools/api-keys.md) with the **Company developer** role, or the `APP:CREATE`, `APP:READ` and `APP:UPDATE` permissions, in the `SEVALLA_API_KEY` environment variable. The CLI reads the key from `SEVALLA_API_TOKEN`.
* The repository on a Git provider that's connected to your Sevalla account. See [Git providers](https://docs.sevalla.com/git/overview.md). Creating the application checks it: when Sevalla can't read the repository, the call returns `400` with `Cannot access repository https://github.com/acme/storefront: Repository not found or you don't have access.`, followed by where to grant access.
* `curl` and `jq`.

**1. Choose the location**

[List clusters](https://api-docs.sevalla.com/v3/resources/list-clusters) (`listClustersV3`) returns the locations your company can use, each with its `id`, its `display_name` and its region ID in `location` (see [Locations](https://docs.sevalla.com/platform/locations.md)). Keep the ID of the one you want, here Frankfurt, Germany:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
CLUSTER_ID=$(curl -s https://api.sevalla.com/v3/resources/clusters \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  | jq -r '.[] | select(.location == "eu-frankfurt-1") | .id')
```

CLI: `sevalla resources clusters`. MCP: `get_platform_options`.

**2. Find the H1 size**

[List process resource types](https://api-docs.sevalla.com/v3/resources/list-process-resource-types) (`listProcessResourceTypesV3`) returns the sizes by `name`, in lowercase:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
H1_ID=$(curl -s https://api.sevalla.com/v3/resources/process-resource-types \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  | jq -r '.[] | select(.name == "h1") | .id')
```

CLI: `sevalla resources process-types`. MCP: `get_platform_options`.

**3. Create the application**

[Create application](https://api-docs.sevalla.com/v3/applications/create-application) (`createApplicationV3`) creates the application with a web process and auto-deploy off. It builds with Ingot (`build_type` is `ingot`) and isn't deployed yet:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
APP_ID=$(curl -s -X POST https://api.sevalla.com/v3/applications \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"display_name":"storefront","cluster_id":"'"$CLUSTER_ID"'","source":"privateGit","git_type":"github","repo_url":"https://github.com/acme/storefront","default_branch":"main"}' \
  | jq -r .id)
```

CLI: `sevalla apps create --name storefront --cluster $CLUSTER_ID --source privateGit --git-type github --repository https://github.com/acme/storefront --branch main`. MCP: `create_application` with `deploy` set to `false`, because it deploys by default.

**4. Find the web process**

[List processes](https://api-docs.sevalla.com/v3/applications/list-processes) (`listProcessesV3`) returns the web process that the application was created with:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
WEB_ID=$(curl -s https://api.sevalla.com/v3/applications/$APP_ID/processes \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  | jq -r '.data[] | select(.type == "web") | .id')
```

CLI: `sevalla apps processes list --app-id $APP_ID`. MCP: `get_application`.

**5. Set the size**

The API creates the web process at **S1**, where the dashboard's default is **H1**. [Update process](https://api-docs.sevalla.com/v3/applications/update-process) (`updateProcessV3`) sets **H1**:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
curl -s -X PATCH https://api.sevalla.com/v3/applications/$APP_ID/processes/$WEB_ID \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource_type_id":"'"$H1_ID"'"}' \
  | jq -c '{resource_type_name, cpu_limit, memory_limit}'
```

```json theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
{"resource_type_name":"h1","cpu_limit":300,"memory_limit":300}
```

CLI: `sevalla apps processes update $WEB_ID --app-id $APP_ID --resource-type $H1_ID`. MCP: `scale_process` with `size_id` and `apply_now` set to `false`.

**6. Turn on auto-deploy**

[Update application](https://api-docs.sevalla.com/v3/applications/update-application) (`updateApplicationV3`) turns on automatic deployments for every push to the branch:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
curl -s -X PATCH https://api.sevalla.com/v3/applications/$APP_ID \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auto_deploy":true}' | jq .auto_deploy
```

CLI: `sevalla apps update $APP_ID --data '{"auto_deploy":true}'`. MCP: `sevalla_api_update` with `updateApplicationV3`.

**7. Deploy**

[Trigger deployment](https://api-docs.sevalla.com/v3/applications/trigger-deployment) (`triggerDeploymentV3`) deploys the latest commit on the application's branch:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
DEPLOYMENT_ID=$(curl -s -X POST https://api.sevalla.com/v3/applications/$APP_ID/deployments \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}' | jq -r .id)
```

CLI: `sevalla apps deployments trigger $APP_ID`. MCP: `trigger_deployment`.

**8. Wait for the deployment**

[Get deployment](https://api-docs.sevalla.com/v3/applications/get-deployment) (`getDeploymentV3`) returns the deployment's `status`: `waiting` and `inProgress` while it runs, then `success` or `failed`. Poll it every 15 seconds, for up to 30 minutes, until the status is final:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
for i in $(seq 1 120); do
  STATUS=$(curl -s "https://api.sevalla.com/v3/applications/$APP_ID/deployments/$DEPLOYMENT_ID" \
    -H "Authorization: Bearer $SEVALLA_API_KEY" | jq -r '.status // empty')
  case $STATUS in success|failed|cancelled|skipped) break ;; esac
  sleep 15
done
echo "$STATUS"
```

CLI: `sevalla apps deployments get $DEPLOYMENT_ID --app-id $APP_ID`. MCP: `get_deployment`.

**9. Read the build log**

[Get application deployment logs](https://api-docs.sevalla.com/v3/applications/get-application-deployment-logs) (`getApplicationDeploymentLogsV3`) returns the build log, oldest line first: the build plan from [Verify the deployment](#verify-the-deployment), the build and the rollout, which ends with `Web has been deployed successfully.` When the status is `failed`, the last lines say why. Without `limit`, the call returns the latest 1,000 lines, so a longer log loses its start; `5000` is the most it allows.

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
curl -s "https://api.sevalla.com/v3/applications/$APP_ID/deployments/$DEPLOYMENT_ID/logs?limit=5000" \
  -H "Authorization: Bearer $SEVALLA_API_KEY" | jq -r '.[].message'
```

CLI: `sevalla apps deployments logs $DEPLOYMENT_ID --app-id $APP_ID`. MCP: `get_deployment_logs`.

**10. Check the application**

[List application domains](https://api-docs.sevalla.com/v3/applications/list-application-domains) (`listApplicationDomainsV3`) returns the application's domain. Request the home page and `/api` from it:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
HOST=$(curl -s https://api.sevalla.com/v3/applications/$APP_ID/domains \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  | jq -r '.data[] | select(.is_primary) | .name')
curl -s https://$HOST/ | grep -o '<h1>[^<]*</h1>'
curl -s https://$HOST/api | jq -r .message
```

```text theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
<h1>Welcome to Deno!</h1>
Hello, world!
```

CLI: `sevalla apps domains list --app-id $APP_ID`. MCP: `get_application`.

### Build from the Dockerfile with the API

After you push the `Dockerfile` from [Deploy with a Dockerfile](#deploy-with-a-dockerfile), [Update application](https://api-docs.sevalla.com/v3/applications/update-application) (`updateApplicationV3`) switches the build strategy. Then repeat the **Deploy**, **Wait for the deployment** and **Check the application** steps:

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
curl -s -X PATCH https://api.sevalla.com/v3/applications/$APP_ID \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"build_type":"dockerfile","dockerfile_path":"Dockerfile","docker_context":"."}' \
  | jq -c '{build_type, dockerfile_path, docker_context}'
```

```json theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
{"build_type":"dockerfile","dockerfile_path":"Dockerfile","docker_context":"."}
```

CLI: `sevalla apps update $APP_ID --data '{"build_type":"dockerfile","dockerfile_path":"Dockerfile","docker_context":"."}'`. MCP: `sevalla_api_update` with `updateApplicationV3`.


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