Vercel Expert

The Vercel Expert agent specializes in Vercel platform deployment, Edge Functions, serverless configuration, environment management, and optimizing Next.js apps for Vercel hosting.

Expertise Areas#

  • Project Configuration - vercel.json setup and optimization
  • Edge Functions - Edge runtime for low-latency responses
  • Environment Variables - Secure configuration management
  • Serverless Functions - Timeout, region, and runtime config
  • Caching & ISR - Incremental Static Regeneration
  • Vercel Storage - Blob, KV, and Postgres
  • Preview Deployments - PR-based testing environments
  • Cron Jobs - Scheduled serverless execution

Usage Examples#

Project Setup#

Use the vercel-expert agent to configure vercel.json for a Next.js SaaS application with API routes.

Response includes:

  • Build configuration
  • Function timeouts
  • Headers and redirects
  • Region settings

Edge Functions#

Use the vercel-expert agent to implement geo-based routing using Edge Functions.

Response includes:

  • Edge runtime setup
  • Middleware configuration
  • Geo detection
  • Response handling

Caching Strategy#

Use the vercel-expert agent to implement ISR with on-demand revalidation for a blog.

Response includes:

  • Revalidation configuration
  • Cache tags
  • API endpoints for revalidation
  • Cache invalidation patterns

Best Practices Applied#

1. Deployment#

  • Proper build commands
  • Environment variable scoping
  • Region optimization
  • Preview deployment testing

2. Performance#

  • Edge runtime for latency-sensitive routes
  • ISR for dynamic content
  • On-demand revalidation
  • Proper caching headers

3. Storage#

  • Blob for file uploads
  • KV for session/cache data
  • Postgres for relational data
  • Efficient data access patterns

4. Security#

  • Environment variable protection
  • Cron job authentication
  • Secure headers
  • API route protection

Common Patterns#

Vercel Configuration#

1// vercel.json 2{ 3 "framework": "nextjs", 4 "buildCommand": "npm run build", 5 "regions": ["iad1"], 6 "functions": { 7 "app/api/**/*.ts": { 8 "maxDuration": 30 9 } 10 }, 11 "headers": [ 12 { 13 "source": "/api/(.*)", 14 "headers": [ 15 { "key": "Access-Control-Allow-Origin", "value": "*" } 16 ] 17 } 18 ], 19 "crons": [ 20 { 21 "path": "/api/cron/cleanup", 22 "schedule": "0 0 * * *" 23 } 24 ] 25}

Edge Function#

1// app/api/edge/route.ts 2export const runtime = 'edge'; 3 4export async function GET(request: Request) { 5 const country = request.headers.get('x-vercel-ip-country') ?? 'US'; 6 7 return new Response(JSON.stringify({ 8 message: 'Hello from the edge!', 9 country, 10 }), { 11 headers: { 'Content-Type': 'application/json' }, 12 }); 13}

On-Demand Revalidation#

1// app/api/revalidate/route.ts 2import { revalidatePath, revalidateTag } from 'next/cache'; 3import { NextRequest, NextResponse } from 'next/server'; 4 5export async function POST(request: NextRequest) { 6 const secret = request.headers.get('x-revalidate-secret'); 7 8 if (secret !== process.env.REVALIDATE_SECRET) { 9 return NextResponse.json({ error: 'Invalid secret' }, { status: 401 }); 10 } 11 12 const { path, tag } = await request.json(); 13 14 if (path) revalidatePath(path); 15 if (tag) revalidateTag(tag); 16 17 return NextResponse.json({ revalidated: true, now: Date.now() }); 18}

Vercel Blob Storage#

1// app/api/upload/route.ts 2import { put, del, list } from '@vercel/blob'; 3import { NextResponse } from 'next/server'; 4 5export async function POST(request: Request) { 6 const formData = await request.formData(); 7 const file = formData.get('file') as File; 8 9 if (!file) { 10 return NextResponse.json({ error: 'No file provided' }, { status: 400 }); 11 } 12 13 const blob = await put(file.name, file, { 14 access: 'public', 15 addRandomSuffix: true, 16 }); 17 18 return NextResponse.json(blob); 19}

Sample Prompts#

TaskPrompt
Configuration"Set up vercel.json for a production deployment"
Edge functions"Implement geolocation-based content serving"
ISR"Configure incremental static regeneration for product pages"
Blob storage"Set up file upload with Vercel Blob"
Cron jobs"Schedule a daily cleanup job"

Configuration#

1// bootspring.config.js 2module.exports = { 3 agents: { 4 customInstructions: { 5 'vercel-expert': ` 6 - Use Edge runtime for latency-sensitive routes 7 - Configure proper environment variables 8 - Implement ISR with on-demand revalidation 9 - Use Vercel storage solutions 10 - Set up preview deployment testing 11 `, 12 }, 13 }, 14 deployment: { 15 platform: 'vercel', 16 region: 'iad1', 17 }, 18};