Routes & ship · Lesson 15 of 22 · 15 min
Deploy to Vercel
Push to GitHub, import into Vercel, and get a live URL that updates on every push.
Your site is a folder of static files. Vercel will build it from GitHub and host it for free. After setup, deploying is just git push.
1. Commit your work
You said yes to git during setup, so the repo already exists.
git add .
git commit -m "Sunday Supper site"
Check .gitignore includes node_modules/ and dist/. The minimal template adds both. You never commit the build output. Vercel builds it fresh.
2. Push to GitHub
Create a new empty repository on github.com/new named sunday-supper. Don’t add a README. Then connect and push:
git remote add origin https://github.com/YOUR-USERNAME/sunday-supper.git
git branch -M main
git push -u origin main
Using the GitHub CLI? One line does all of that:
gh repo create sunday-supper --public --source=. --push
3. Import into Vercel
- Go to vercel.com/new and sign in with GitHub.
- Find
sunday-supperand click Import. - Vercel detects Astro as the framework. Leave the defaults:
| Setting | Value |
|---|---|
| Framework Preset | Astro |
| Build Command | npm run build |
| Output Directory | dist |
| Install Command | npm install |
- Click Deploy.
About 30 seconds later you get a live URL like sunday-supper.vercel.app. Open it on your phone.
4. Ship a change
Edit services.json, change a price, then:
git commit -am "Update dinner party price"
git push
Vercel sees the push and redeploys. Refresh the live site in a minute.
Push to a branch other than main and Vercel gives you a separate preview URL for it. Good for checking a change before it goes live.
5. Tell Astro its URL
Once you have the live URL, add it to your config. Astro uses it for canonical links, sitemaps, and RSS.
astro.config.mjs
// @ts-check
import { defineConfig } from 'astro/config';
export default defineConfig({
site: 'https://sunday-supper.vercel.app',
});
Commit and push.
Option: deploy from the terminal
Prefer not to use GitHub? The Vercel CLI deploys straight from your folder:
npm i -g vercel
vercel # first run links the project and makes a preview
vercel --prod # pushes to your production URL
Option: Netlify
The same site deploys to Netlify with the same settings. At app.netlify.com, choose Add new site → Import an existing project, pick the repo, and use build command npm run build with publish directory dist.