Skip to content
This is an unmaintained snapshot of the Astro v4 docs. View the latest docs.

Deploy your Astro Site to Vercel

You can use Vercel to deploy an Astro site to their global edge network with zero configuration.

This guide includes instructions for deploying to Vercel through the website UI or Vercel’s CLI.

Your Astro project can be deployed to Vercel as a static site, or as a server-side rendered site (SSR).

Your Astro project is a static site by default. You don’t need any extra configuration to deploy a static Astro site to Vercel.

To enable SSR in your Astro project and deploy on Vercel:

Add the Vercel adapter to enable SSR in your Astro project with the following astro add command. This will install the adapter and make the appropriate changes to your astro.config.mjs file in one step.

Terminal window
npx astro add vercel

If you prefer to install the adapter manually instead, complete the following two steps:

  1. Install the @astrojs/vercel adapter to your project’s dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:

    Terminal window
    npm install @astrojs/vercel
  2. Add two new lines to your astro.config.mjs project configuration file.

    astro.config.mjs
    import { defineConfig } from 'astro/config';
    import vercel from '@astrojs/vercel/serverless';
    export default defineConfig({
    output: 'server',
    adapter: vercel(),
    });

You can deploy to Vercel through the website UI or using Vercel’s CLI (command line interface). The process is the same for both static and SSR Astro sites.

  1. Push your code to your online Git repository (GitHub, GitLab, BitBucket).

  2. Import your project into Vercel.

  3. Vercel will automatically detect Astro and configure the right settings.

  4. Your application is deployed! (e.g. astro.vercel.app)

After your project has been imported and deployed, all subsequent pushes to branches will generate Preview Deployments, and all changes made to the Production Branch (commonly “main”) will result in a Production Deployment.

Learn more about Vercel’s Git Integration.
  1. Install the Vercel CLI and run vercel to deploy.

    Terminal window
    npm install -g vercel
    vercel
  2. Vercel will automatically detect Astro and configure the right settings.

  3. When asked Want to override the settings? [y/N], choose N.

  4. Your application is deployed! (e.g. astro.vercel.app)

Project config with vercel.json

Section titled Project config with vercel.json

You can use vercel.json to override the default behavior of Vercel and to configure additional settings. For example, you may wish to attach headers to HTTP responses from your Deployments.

More Deployment Guides

Contribute

What’s on your mind?

Create GitHub Issue

Quickest way to alert our team of a problem.

Community