Loading...
Loading...
Weekly AI insights —
Real strategies, no fluff. Unsubscribe anytime.
Written by Gareth Simono, Founder and CEO of Agentik {OS}. Full-stack developer and AI architect with years of experience shipping production applications across SaaS, mobile, and enterprise platforms. Gareth orchestrates 267 specialized AI agents to deliver production software 10x faster than traditional development teams.
Founder & CEO, Agentik {OS}
Vercel deploys are easy until they're not. Env vars missing, build errors in prod only. Here's the production checklist to get it right.

I have watched projects break in production that worked perfectly in development. Always the same culprits. Missing environment variables. Node.js version mismatch. Bundle size over limits. API routes that work on localhost timing out under Vercel's serverless function limits.
Vercel is genuinely excellent deployment infrastructure. These issues are not Vercel's fault. They are the predictable consequences of not knowing the checklist.
This is the checklist. Follow it and your deployments will work the first time.
Most deployment failures are caught before you deploy if you run the right commands locally.
# Run the exact build that Vercel will run
npm run build
# If this fails locally, it will fail on Vercel
# Fix all build errors before touching the dashboard
# Check bundle sizes (important for performance)
npx @next/bundle-analyzer # Add to package.json first
# Verify type safety
npx tsc --noEmit
# Run your full test suite
npm run testNever push to production without a clean local build. This takes 2 minutes. The alternative is debugging a broken deployment in production, which takes much longer.
Environment variable issues cause more production failures than anything else. Here is the complete system.
# .env.example (committed to version control)
# Copy this to .env.local and fill in values
# NEVER commit .env.local or .env.production
# App
NEXT_PUBLIC_APP_URL=
NEXT_PUBLIC_APP_NAME=
# Database
CONVEX_DEPLOYMENT=
NEXT_PUBLIC_CONVEX_URL=
# Auth
CLERK_SECRET_KEY=
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/onboarding
# Payments
STRIPE_SECRET_KEY=
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_WEBHOOK_SECRET=
# AI
ANTHROPIC_API_KEY=
# Email
RESEND_API_KEY=Variables without NEXT_PUBLIC_ prefix are server-side only. Variables with the prefix are bundled into the client.
Common mistake: putting secret keys in NEXT_PUBLIC_ variables. They end up in the browser bundle. Anyone can read them. Stripe secret keys, Anthropic API keys, database credentials. Never NEXT_PUBLIC.
Common mistake #2: forgetting to add NEXT_PUBLIC_ to variables that client components need. They silently become undefined on the client. Add runtime validation:
// lib/env.ts
function getEnvVar(name: string, required = true): string {
const value = process.env[name];
if (required && !value) {
throw new Error(
`Missing required environment variable: ${name}\n` +
`Check your .env.local file and Vercel environment variable settings.`
);
}
return value ?? "";
}
export const env = {
// Server-side only
stripeSecretKey: getEnvVar("STRIPE_SECRET_KEY"),
anthropicApiKey: getEnvVar("ANTHROPIC_API_KEY"),
clerkSecretKey: getEnvVar("CLERK_SECRET_KEY"),
// Client-safe
appUrl: getEnvVar("NEXT_PUBLIC_APP_URL"),
stripePublishableKey: getEnvVar("NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY"),
convexUrl: getEnvVar("NEXT_PUBLIC_CONVEX_URL"),
} as const;This fails fast and with a clear error message instead of a cryptic runtime failure.
After connecting your repository:
# Vercel usually detects these, but verify:
Framework Preset: Next.js
Root Directory: ./ (or the directory if it's a monorepo)
Build Command: npm run build (or your actual build command)
Output Directory: .next (Next.js default)
Install Command: npm install (or yarn/pnpm/bun equivalent)
Node.js Version: 20.x (match your local version)In Vercel Dashboard > Project > Settings > Environment Variables:
.env.examplevercel dev (rarely needed)Some variables must be different in production:
# Development
NEXT_PUBLIC_APP_URL=http://localhost:3000
STRIPE_WEBHOOK_SECRET=whsec_local_from_stripe_cli
# Production
NEXT_PUBLIC_APP_URL=https://yourdomain.com
STRIPE_WEBHOOK_SECRET=whsec_live_from_stripe_dashboardVercel lets you set different values per environment. Use it.
Vercel Dashboard > Project > Domains > Add Domain
For a custom domain at your registrar (GoDaddy, Namecheap, Cloudflare, etc.):
Option A: Vercel nameservers (easiest) Move your domain's nameservers to Vercel. Vercel manages all DNS.
Option B: CNAME record (most common)
Type: CNAME
Name: www
Value: cname.vercel-dns.com
Option C: A record for apex domain
Type: A
Name: @
Value: 76.76.21.21
For most setups, redirect the apex domain (yourdomain.com) to www.yourdomain.com. Vercel handles this automatically if you add both.
SSL is automatic on Vercel. It provisions certificates via Let's Encrypt within minutes of domain verification.
This breaks everyone once. Different services need different webhook URLs:
# Stripe webhook
Stripe Dashboard > Developers > Webhooks > Add endpoint
Endpoint URL: https://yourdomain.com/api/stripe/webhook
# After creating, copy the webhook signing secret
# Add to Vercel as STRIPE_WEBHOOK_SECRET
# The local Stripe CLI secret is DIFFERENT from the production secret
# They are NOT interchangeableIf you forget to update the webhook URL, events will silently fail in production. Subscriptions won't update. Payments will process but your database won't know about them.
Next.js API routes run as Vercel serverless functions. They have limits:
| Limit | Hobby | Pro | Enterprise |
|---|---|---|---|
| Max duration | 10s | 60s | 900s |
| Max size (compressed) | 50MB | 250MB | 250MB |
| Memory | 1024MB | 3008MB | 3008MB |
The 10-second limit on Hobby kills many AI applications. AI API calls often take 5-15 seconds. A 10-second serverless limit means your AI routes fail in production.
// app/api/ai-analysis/route.ts
export const maxDuration = 60; // Only works on Pro plan
export async function POST(req: Request) {
// This can now run for up to 60 seconds
const result = await longRunningAiOperation();
return Response.json(result);
}For operations that might exceed even 60 seconds, move them to background jobs. Convex Actions and Trigger.dev are both good options.
Run through this before every production deploy:
## Environment
- [ ] All .env.example variables are set in Vercel for Production
- [ ] NEXT_PUBLIC_APP_URL points to production domain
- [ ] Stripe webhook URL is updated to production endpoint
- [ ] Stripe webhook secret matches the production webhook
## Build
- [ ] npm run build succeeds locally
- [ ] npx tsc --noEmit passes
- [ ] No type errors
- [ ] All tests pass
## Functionality
- [ ] Auth flow works on preview URL before switching to production
- [ ] Payment flow works in test mode on preview URL
- [ ] Critical user paths tested manually
## Performance
- [ ] Lighthouse score acceptable on preview URL
- [ ] No massive bundle size regressions
- [ ] Core Web Vitals in green rangeVercel makes rollback easy:
# Via CLI
vercel rollback # Rolls back to previous deployment
# Via Dashboard
# Deployments tab > Click previous deployment > Promote to productionBut rollback helps most when you have feature flags that let you disable a broken feature without a code rollback. Worth setting up even a simple feature flag system for major features.
After going live:
# Check your deployment
vercel logs --prod # Stream production logs
# Or in dashboard:
# Project > Deployments > Select deployment > Functions tab
# Shows function invocations, errors, durationSet up Sentry or similar for error tracking. Vercel logs are good for debugging, but you need alerting for errors you don't know to look for.
Q: How do you deploy to Vercel?
Deploy to Vercel by connecting your GitHub repository, configuring environment variables, and pushing to your main branch. Vercel automatically builds, tests, and deploys your application. For AI applications, configure environment variables for API keys and set up edge functions for AI routes.
Q: What is the Vercel deployment checklist?
Before deploying: verify all environment variables are set, ensure build succeeds locally, check TypeScript types pass, run the test suite, verify API routes work, test responsive design, check Core Web Vitals, configure custom domain, and set up monitoring. AI agents can automate most of this checklist.
Q: How do you handle environment variables on Vercel?
Store environment variables in Vercel's dashboard under Project Settings, use .env.local for local development, never commit secrets to git, use Vercel's encryption for sensitive values, and separate variables by environment (development, preview, production). AI API keys should always be server-side only.
Full-stack developer and AI architect with years of experience shipping production applications across SaaS, mobile, and enterprise. Gareth built Agentik {OS} to prove that one person with the right AI system can outperform an entire traditional development team. He has personally architected and shipped 7+ production applications using AI-first workflows.

How I Built a SaaS in 19 Days with AI (Build Log)
One person. AI doing 70% of the coding. A fully functional SaaS with paying customers in 19 days. Here's the exact process, decisions, and mistakes.

Convex + AI: Build Real-Time Backend in Hours, Not Weeks
Convex eliminates most backend code. Pair it with AI and you're shipping real-time features that would have taken weeks in a few hours.

Stripe with AI: Build a Complete Billing System Fast
Stripe handles payments. AI handles the complexity around them. Here's how to build a complete billing system with subscriptions, usage, and smart dunning.
Stop reading about AI and start building with it. Book a free discovery call and see how AI agents can accelerate your business.