GuidesNode.jsAstro

Deploy Astro on Zeabur

Astro is a modern website building tool with a powerful developer experience and lightweight output.

This guide will help you deploy your Astro site on Zeabur.

Step 1: Create an Astro Project

You can create an Astro project using the command below and follow the prompts for configuration.

npm create astro@latest

Step 2: Install the @zeabur/astro-adapter Package

Zeabur provides an adapter package for Astro, which you can install using the command below.

pnpm i @zeabur/astro-adapter

After installation, you need to configure the adapter in your astro.config.mjs.

import zeabur from '@zeabur/astro-adapter/serverless';
 
export default {
  // ...
  adapter: zeabur(),
  output: 'server'
  // ...
};

With that, your Astro project is ready to be deployed to Zeabur.

Deploying with Containerization

Sometimes, your Astro project may have specific needs that make it unsuitable for Serverless deployment. For example, it might rely on an API request that takes a long time to execute for server-side rendering (SSR).

In such cases, you can use Astro’s official @astrojs/node to deploy your project on Zeabur using containerization:

import node from '@astrojs/node';
 
export default {
  // ...
  adapter: node({ mode: 'standalone' }),
  output: 'server'
  // ...
};

Step 3: Deploy to Zeabur

Method 1: Using the Zeabur CLI

First, ensure that you have installed the Zeabur CLI according to the guide Deploy in CLI.

Then, in your newly initialized Astro project, add uncommitted files to Git.

git add -A
git commit -m "Initial commit"

Next, deploy your service using the command below.

zeabur

Method 2: Using the Zeabur Dashboard

Navigate to the Zeabur Dashboard and create a new project.

Then, click on the Deploy New Service button and choose to deploy from GitHub.

💡

If this is your first time deploying a project from GitHub on Zeabur, you will need to configure and install the GitHub App. You can view a more detailed guide here.

After selecting the repository and branch, Zeabur will automatically begin to build your service.

Zeabur will automatically detect that your service is built with Astro, so you don’t need to make any additional configurations. Your deployment will be completed in a few minutes.

Step 4: Bind a Domain

After the deployment is complete, you may need to configure a domain for your Astro site.

Open the “Domain” tab on the service page and click on “Generate Domain” or “Custom Domain”.

For more information on how to bind a domain to your service, please refer to Bind a domain.