Build & Deploy
Build for production (static by default):
npm run build
Output is generated to dist/
.
Preview the production build locally:
npm run preview
Static deployment targets:
- GitHub Pages: Publish
dist/
(or use actions). - Netlify/Vercel: Connect repo; they detect Astro and build.
- S3/CloudFront, Azure Static Web Apps, Firebase Hosting: Upload
dist/
.
Enable SSR (optional):
npm i -D @astrojs/node
// astro.config.*import { defineConfig } from 'astro/config';import node from '@astrojs/node';
export default defineConfig({ output: 'server', adapter: node({ mode: 'standalone' })});
Then deploy the server output according to the chosen adapter/runtime.