| name | vercel-deploy |
| description | Deploy frontend apps, Next.js projects, and serverless functions to Vercel with preview URLs and production deployments. Trigger: when deploying to Vercel, using vercel CLI, deploying Next.js, creating preview deployments, managing Vercel environments, adding Vercel domains |
| version | 1 |
| argument-hint | [deploy|--prod|env|logs|domains|inspect] |
| allowed-tools | ["bash","read","write","edit","glob","grep"] |
Vercel Deployment
You are now operating in Vercel deployment mode using the vercel CLI.
Prerequisites
npm install -g vercel
vercel login
export VERCEL_TOKEN="your-token-here"
vercel whoami
Linking a Project
vercel link
vercel link --scope my-team --project my-project
vercel env pull .env.local
Preview Deployments
Preview deployments create a unique URL for review before production.
vercel
vercel --yes
vercel ./dist --yes
vercel --yes 2>/dev/null | tail -1
Production Deployments
vercel --prod --yes
vercel --prod --yes 2>&1 | grep "Production:"
vercel --prod --yes --archive=tgz
Deployment Inspection
vercel ls
vercel ls --json
vercel inspect https://my-app-abc123.vercel.app
vercel inspect <deployment-url> --json
Viewing Logs
vercel logs <deployment-url>
vercel logs <deployment-url> --follow
vercel logs https://my-app-abc123.vercel.app --follow
vercel logs <url> --follow 2>&1 | grep -i error
Environment Variable Management
vercel env add DATABASE_URL
vercel env add DATABASE_URL production
vercel env add DATABASE_URL preview
vercel env add DATABASE_URL development
echo "postgresql://..." | vercel env add DATABASE_URL production
vercel env ls
vercel env rm DATABASE_URL production
vercel env pull .env.local
vercel env pull .env.production --environment production
Domain Management
vercel domains ls
vercel domains add my-app.example.com
vercel domains add my-app.example.com --project my-project
vercel domains inspect my-app.example.com
vercel domains rm my-app.example.com
Removing Deployments
vercel rm https://my-app-abc123.vercel.app
vercel rm my-project --safe
vercel rm my-project --yes
Deployment Patterns
Pattern 1: Preview Deploy for Code Review
PREVIEW_URL=$(vercel --yes 2>/dev/null | tail -1)
echo "Preview URL: $PREVIEW_URL"
curl -f "$PREVIEW_URL/api/health" || echo "Health check failed"
echo "Share this URL for review: $PREVIEW_URL"
Pattern 2: Production Deployment with Verification
vercel --prod --yes
PROD_URL=$(vercel ls --json | jq -r '.[0].url' | head -1)
curl -f "https://$PROD_URL" || echo "Production check failed"
curl -s "https://$PROD_URL/api/version" | jq '.version'
vercel logs "https://$PROD_URL" --follow &
LOGS_PID=$!
sleep 15
kill $LOGS_PID
Pattern 3: Feature Branch Preview
git checkout feature/my-feature
PREVIEW_URL=$(vercel --yes 2>/dev/null | tail -1)
echo "Feature preview: $PREVIEW_URL"
Vercel Project Configuration (vercel.json)
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"installCommand": "npm ci",
"framework": "nextjs",
"regions": ["iad1", "sfo1"],
"rewrites": [
{ "source": "/api/(.*)", "destination": "/api/$1" }
],
"headers": [
{
"source": "/api/(.*)",
"headers": [
{ "key": "Cache-Control", "value": "no-store" }
]
}
]
}
Parsing Deployment Output
vercel --yes 2>&1 | grep -E "https://.*vercel\.app"
vercel --prod --yes 2>&1 | grep "Production:"
vercel ls --json | jq '.[0] | {url, state, created}'
vercel ls --json | jq '.[] | select(.state == "READY") | .url' | head -1
Vercel Pricing Reference
| Plan | Cost | Bandwidth | Features |
|---|
| Hobby | Free | 100 GB | 1 user, personal projects |
| Pro | $20/member/month | 1 TB | Teams, analytics, preview protection |
| Enterprise | Custom | Custom | SSO, audit logs, SLA |
Safety Rules
- Never commit
VERCEL_TOKEN to source control — use environment variables or CI secrets.
- Always deploy to preview first; verify the preview URL before promoting to production.
- Use
vercel env pull to sync environment variables locally; never hardcode secrets.
- Verify new content is live after production deploy — Vercel CDN may serve stale cache briefly.
- Use
vercel logs --follow immediately after production deployment to catch startup errors.
- Domain changes can take up to 48 hours for DNS propagation — plan accordingly.