Deploying to Vercel
Deploy your Yama application to Vercel for zero-config serverless deployment.
Prerequisites
- A Vercel account (sign up )
- Your Yama project ready for deployment
Quick Deploy
Option 1: Vercel CLI
# Install Vercel CLI
npm i -g vercel
# Deploy
vercelOption 2: GitHub Integration
- Push your code to GitHub
- Import your repository in Vercel
- Vercel will auto-detect and deploy
Configuration
Create a vercel.json file:
{
"buildCommand": "yama build",
"outputDirectory": "dist",
"installCommand": "pnpm install",
"framework": null,
"rewrites": [
{
"source": "/(.*)",
"destination": "/server.js"
}
],
"env": {
"DATABASE_URL": "@database-url",
"JWT_SECRET": "@jwt-secret"
}
}Environment Variables
Set environment variables in Vercel dashboard:
- Go to your project settings
- Navigate to “Environment Variables”
- Add your variables:
DATABASE_URLJWT_SECRETNODE_ENV=production
Database Migrations
Run migrations before deployment:
# In your build command or pre-deploy hook
yama schema:applyOr use Vercel’s build hooks to run migrations automatically.
Serverless Functions
Yama automatically optimizes for serverless:
- Each endpoint can be deployed as a separate function
- Automatic cold start optimization
- Pay-per-use pricing
Custom Domain
- Go to project settings
- Navigate to “Domains”
- Add your custom domain
- Configure DNS records
Monitoring
Monitor your deployment:
- View logs in Vercel dashboard
- Set up alerts for errors
- Monitor function execution times
Troubleshooting
Build Errors
Check your build logs in Vercel dashboard. Common issues:
- Missing environment variables
- Database connection issues
- Build command errors
Cold Starts
Serverless functions may have cold starts. Optimize by:
- Using connection pooling
- Keeping functions warm (Vercel Pro)
- Optimizing handler code
Next Steps
- Learn about Docker deployment
- See Environment Variables guide
Last updated on