Appearance
System
Light
Dark
Setting applies to this browser only

Deployment


Static Site Output

By default, Astro builds your project as a static site. This means all your pages are pre-rendered at build time into HTML files, making them incredibly fast and easy to deploy anywhere.

npm run build

The output goes to the dist/ directory, ready to be served by any static file server or CDN.

Deploying to Netlify

Netlify is an excellent choice for Astro sites. It offers continuous deployment from Git, automatic SSL, and a generous free tier.

  1. Push your project to a Git repository (GitHub, GitLab, or Bitbucket)
  2. Connect the repository in the Netlify dashboard
  3. Set the build command to npm run build
  4. Set the publish directory to dist
  5. Deploy!

Netlify will automatically rebuild and deploy your site whenever you push changes.

Deploying to Vercel

Vercel provides seamless deployment for Astro projects:

  1. Install the Vercel CLI: npm i -g vercel
  2. Run vercel in your project directory
  3. Follow the prompts to configure your project

Or connect your Git repository through the Vercel dashboard for automatic deployments.

Deploying to Cloudflare Pages

Cloudflare Pages offers global CDN distribution and fast builds:

  1. Connect your Git repository in the Cloudflare dashboard
  2. Set the build command to npm run build
  3. Set the output directory to dist
  4. Deploy

Cloudflare’s global network ensures your content loads quickly worldwide.

Custom Server Deployment

For self-hosted deployments, you can serve the dist/ directory with any web server:

# Using a simple HTTP server
npx serve dist

# Using Nginx (copy dist/ contents to your web root)
cp -r dist/* /var/www/html/

Remember to configure proper caching headers for static assets and enable gzip or Brotli compression for optimal performance.

Home
Search
Menu
Theme
Top