Overview
The website is configured to use Vercel’s serverless adapter, which enables:- Server-side rendering (SSR) for dynamic pages
- API routes that run as serverless functions at request time
- Automatic deployment on every git push
- Edge caching for optimal performance
Vercel Adapter Configuration
The site uses the@astrojs/vercel adapter in serverless mode, configured in astro.config.mjs:
output: 'server' mode ensures that API routes (like /api/videos.json and /api/thumbnail-proxy) run at request time rather than being pre-rendered at build time.
Deployment Steps
Prepare Your Repository
Ensure your code is pushed to a GitHub repository. Vercel connects directly to GitHub for automatic deployments.
Connect to Vercel
- Go to vercel.com and sign in with GitHub
- Click “Add New Project”
- Import your repository from the list
- Select the repository for Lake Ozark Christian Church
Configure Build Settings
Vercel will auto-detect the Astro framework. Verify these settings:
- Framework Preset: Astro
- Build Command:
npm run build - Output Directory:
dist - Install Command:
npm install
package.json:Set Environment Variables (Optional)
If your site requires any environment variables, add them in the Vercel dashboard:
- Go to Project Settings → Environment Variables
- Add any required variables
- Click Save
Currently, the site doesn’t require environment variables. The YouTube video fetching uses the
youtube-sr library which doesn’t require API keys.Deploy
Click “Deploy” to start the build process. Vercel will:
- Clone your repository
- Install dependencies
- Run the build command
- Deploy to a production URL
Automatic Deployments
Once connected, Vercel automatically deploys:- Production deployments on pushes to the
mainbranch - Preview deployments for pull requests and other branches
Performance Features
Caching Strategy
The API routes implement cache headers for optimal performance:- Fresh content served for 5 minutes
- Stale content served while fetching fresh data (up to 10 minutes)
- Reduces API calls to YouTube and improves response times
Edge Network
Vercel automatically distributes your site across their global edge network, ensuring fast load times worldwide.Troubleshooting
Build Failures
If the build fails, check:- Build logs in the Vercel dashboard for specific errors
- Dependencies are correctly listed in
package.json - Node version compatibility (Vercel uses Node 18+ by default)
API Route Issues
If API routes aren’t working:- Verify
output: 'server'is set inastro.config.mjs - Ensure routes have
export const prerender = false - Check function logs in Vercel dashboard under Functions tab
Domain Configuration
To use a custom domain:- Go to Project Settings → Domains
- Add your custom domain
- Update DNS records as instructed
- Vercel automatically provisions SSL certificates
Next Steps
- Configure environment variables if needed
- Review build configuration options
- Set up monitoring and analytics