> ## 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 Astro

> Deploy an Astro site to Sevalla from a Git repository as a free static site, or render pages on demand as an application with the @astrojs/node adapter.

An Astro site builds to static HTML by default, and Sevalla publishes it as a static site: the build runs `astro build` from your Git repository and Cloudflare serves the `dist` folder. A site that renders pages on demand uses the [Node.js adapter](#render-pages-on-demand) and runs as an application instead.

## 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 on your computer.

## Create the project

Create a project from Astro's `basics` template:

```bash theme={null}
npm create astro@latest storefront -- --template basics --yes
cd storefront
```

The project comes with a `.gitignore`, a Git repository and a `build` script that runs `astro build`.

## Prepare the project for Sevalla

A static Astro site needs no changes. `astro build` writes every page to `dist`, as `about/index.html` for `/about`, which is how a static site serves it. Static sites take the Node.js version from their build settings, not from `package.json`, and the default, **Latest LTS**, meets Astro 7's requirement of Node.js 22.22 or later.

Run `npm run build && npm run preview` and open `http://localhost:4321` to check the build locally. Then push the repository that `create astro` made to your Git provider:

```bash theme={null}
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="Choose the repository">
    In the sidebar, click **Static sites**, then click **Create static site**. Under **Source**, click **Private repository**, then choose the **Git provider**, the **Repository** and the **Branch**.
  </Step>

  <Step title="Check the build settings">
    Under **Build settings**, Sevalla shows **Framework detected: Astro** and fills in the values. Check them:

    | Field | Value |
    | - | - |
    | **Build site before publishing** | On |
    | **Node version** | **Latest LTS** |
    | **Build command** | `npm run build` |
    | **Root directory** | Empty, for the repository root |
    | **Publish directory** | `dist` |
  </Step>

  <Step title="Create the static site">
    Enter a **Name** under **Details**, then click **Create static site**. Sevalla starts the first deployment right away, and deploys every push to the branch while **Auto-deploy** is on.
  </Step>
</Steps>

See [Build settings](/static-sites/build-settings) for every field.

## Verify the deployment

1. On the **Deployments** tab, wait for the deployment's status to change to **Deployed**. The site's **Status** on the **Overview** tab changes to **Live**.
2. On the **Overview** tab, click **Visit site**. The Astro starter page opens on the site's `*.sevalla.page` domain.

<Frame>
  <img className="block dark:hidden" src="https://assets.sevalla.com/screenshots/light/static-site-overview-visit.png" alt="The static site's Details card with its domain, Live status, source repository and the Visit site button" width="1216" />

  <img className="hidden dark:block" src="https://assets.sevalla.com/screenshots/dark/static-site-overview-visit.png" alt="The static site's Details card with its domain, Live status, source repository and the Visit site button" width="1216" />
</Frame>

If the deployment fails, open it on the **Deployments** tab and read its build log, then see [Troubleshoot static sites](/static-sites/troubleshooting).

## Render pages on demand

Pages that run code for each request, such as API endpoints, authentication or pages that export `prerender = false`, need a server. Build them with the Node.js adapter and deploy the project as an application.

Add the adapter, the start script and the Node.js version:

```bash theme={null}
npx astro add node
npm pkg set scripts.start="node ./dist/server/entry.mjs" engines.node="24.x"
```

Then set `astro.config.mjs` like this:

```js astro.config.mjs theme={null}
import { defineConfig } from "astro/config";
import node from "@astrojs/node";

export default defineConfig({
  output: "server",
  adapter: node({ mode: "standalone" }),
  server: { host: true },
});
```

| Setting | Why Sevalla needs it |
| - | - |
| `output: "server"` | Renders every page on demand. Leave it out to keep pages static except those that export `prerender = false`. |
| `mode: "standalone"` | `astro build` writes a server that starts with `node ./dist/server/entry.mjs`. |
| `server: { host: true }` | The server listens on all network interfaces. Without it, the standalone server listens on `localhost`, where Sevalla's traffic can't reach it. |
| `scripts.start` | Nixpacks, the default [build strategy](/applications/builds/nixpacks), starts the web process with `npm run start`. |
| `engines.node` | Nixpacks installs Node.js 24 instead of its default, Node.js 18, which Astro 7 refuses to run on. See [Pin the Node.js version](/guides/javascript/overview#pin-the-node-js-version). |

The standalone server 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). Commit and push the changes, then create the application:

<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**. 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="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>
</Steps>

When the deployment's status changes to **Deployed** on the **Deployments** tab, click the domain under the application's name, for example `storefront-x7k2m.sevalla.app`. If the deployment fails, see [Troubleshoot builds and deployments](/applications/troubleshooting/builds-and-deployments).

Astro's hashed assets under `/_astro/` are safe to cache for a long time: turn on the CDN on the application's **Networking** tab to serve them from Cloudflare. See [CDN and edge caching](/applications/caching).

## Add a custom domain

To serve the site from your own domain, such as `shop.example.com`, add the domain on the static site's **Domains** tab and create the DNS records that Sevalla shows. Applications have a **Domains** tab too, but custom domains need a web process larger than **H1**. See [Custom domains](/domains/overview).


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