AgentSkillsCN

Deploy

部署

SKILL.md

Deploy Skill

Deploy the application to Vercel and configure production environment.

Trigger

Use this skill when: user says "deploy", "go live", "push to production", "launch", or "ship it"

Pre-Deployment Checklist

1. Code Quality

bash
# Run all checks
pnpm lint          # No lint errors
pnpm build         # Build succeeds
pnpm test:coverage # 80%+ coverage

2. Environment Variables

Ensure all required variables are set in Vercel:

Required:

code
NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
NEXT_PUBLIC_SITE_URL=https://yourdomain.com

Optional (based on features):

code
# Payments
LEMONSQUEEZY_API_KEY=
LEMONSQUEEZY_STORE_ID=
LEMONSQUEEZY_WEBHOOK_SECRET=

# Email
RESEND_API_KEY=
RESEND_FROM_EMAIL=

# Analytics
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=

# Error Tracking
NEXT_PUBLIC_SENTRY_DSN=
SENTRY_AUTH_TOKEN=

3. Supabase Production Setup

  1. Create production Supabase project (if not already)
  2. Run migrations: supabase db push
  3. Enable RLS on all tables
  4. Configure authentication:
    • Set Site URL to production domain
    • Add redirect URLs
    • Configure email templates

4. Domain Configuration

  1. Add custom domain in Vercel
  2. Configure DNS records
  3. Enable HTTPS (automatic with Vercel)

Deployment Methods

Method 1: Git Push (Recommended)

bash
# Vercel auto-deploys on push to main
git add .
git commit -m "Ready for production"
git push origin main

Method 2: Vercel CLI

bash
# Install CLI
pnpm add -g vercel

# Deploy preview
vercel

# Deploy production
vercel --prod

Method 3: Vercel Dashboard

  1. Go to vercel.com
  2. Import Git repository
  3. Configure environment variables
  4. Deploy

Post-Deployment

1. Verify Deployment

  • Visit production URL
  • Test authentication flow
  • Test all critical user paths
  • Check mobile responsiveness
  • Verify dark mode works
  • Test payments (if enabled)
  • Send test email (if enabled)

2. Configure Webhooks

If using LemonSqueezy:

  1. Go to LemonSqueezy dashboard → Webhooks
  2. Add webhook URL: https://yourdomain.com/api/webhooks/lemonsqueezy
  3. Select events: order_created, subscription_created, etc.
  4. Copy signing secret to Vercel env vars

3. Set Up Monitoring

  • Sentry alerts configured
  • Posthog tracking verified
  • Vercel Analytics enabled (optional)

4. DNS & SSL

  • Custom domain working
  • SSL certificate active
  • www redirect configured (if needed)

Vercel Configuration

The vercel.json file configures:

json
{
  "buildCommand": "pnpm build",
  "installCommand": "pnpm install",
  "framework": "nextjs",
  "regions": ["iad1"],
  "headers": [
    // Security headers configured
  ]
}

Rollback

If something goes wrong:

bash
# Via CLI
vercel rollback

# Or in dashboard:
# Deployments → Select previous → Promote to Production

Environment-Specific Configs

Preview Deployments

  • Use Supabase preview branch (if available)
  • Use test payment keys
  • Disable production analytics

Production

  • Use production Supabase
  • Use live payment keys
  • Enable all monitoring

Security Checklist

  • No secrets in code
  • Environment variables set correctly
  • RLS enabled on all Supabase tables
  • CORS configured properly
  • Rate limiting on APIs (if needed)
  • Security headers in vercel.json

Troubleshooting

Build Fails

bash
# Check build locally
pnpm build

# Check for TypeScript errors
pnpm tsc --noEmit

Environment Variables Not Working

  • Prefix client-side vars with NEXT_PUBLIC_
  • Redeploy after adding new vars
  • Check for typos in variable names

Database Connection Issues

  • Verify Supabase URL is correct
  • Check if IP is allowlisted (if using connection pooling)
  • Verify RLS policies allow access

Go-Live Announcement

Once deployed:

  1. Update DNS to point to Vercel
  2. Test thoroughly
  3. Monitor for errors
  4. Announce launch! 🚀