Deploying Astro to Netlify
Why Netlify?
Netlify is one of the most popular platforms for deploying static sites. It offers:
- Automatic deployments from Git
- Free SSL certificates
- Edge CDN
- Serverless functions
[ i ]
Netlify's free tier is generous, making it ideal for personal projects and small sites.
Prerequisites
- Astro project ready to build
- Git repository hosted on GitHub, GitLab, or Bitbucket
- Netlify account
Step 1: Connect Your Repository
- Log in to Netlify
- Click "Add new site" → "Import an existing project"
- Select your Git provider and authorize Netlify
- Choose your Astro repository
Step 2: Configure Build Settings
Netlify should auto-detect Astro, but verify these settings:
- Build command:
npm run build - Publish directory:
dist
Step 3: Deploy
Click "Deploy site". Netlify will build and deploy your Astro site in under a minute.
Custom Domains
Go to Site settings → Domain management to add your custom domain. Netlify automatically provisions an SSL certificate.
Continuous Deployment
Every push to your main branch triggers a new build and deployment. You can preview deploys for pull requests too.
That's it — your Astro site is live on the internet!