Deploying Next.js on Vercel with Neon Postgres: Our Production Stack
Every Foundry Ventures web property runs on the same core stack: Next.js on Vercel with Neon PostgreSQL. Here is why, and how we configure it for production.
The Stack
- Next.js 15 (App Router): Server components, API routes, middleware
- Vercel: Hosting, edge functions, cron jobs
- Neon PostgreSQL: Serverless Postgres with connection pooling
- Prisma 6: Type-safe ORM with migrations
Why Neon Over Traditional Postgres
Neon's serverless architecture matches Vercel's execution model. Traditional Postgres connections are long-lived; serverless functions are short-lived. This mismatch causes connection pool exhaustion.
Neon solves this with:
- Built-in connection pooling: No need for PgBouncer or similar middleware
- Scale to zero: Development branches cost nothing when idle
- Branching: Database branches for preview deployments
Prisma Configuration
Our Prisma setup uses two connection strings:
DATABASE_URL= # Pooled connection for queries
DIRECT_URL= # Direct connection for migrations
The pooled URL goes through Neon's connection pooler. The direct URL bypasses it for schema migrations, which need a persistent connection.
Vercel Configuration
Environment variables
We use Vercel's environment variable system with separate values for production, preview, and development. Database URLs point to different Neon branches per environment.
Cron jobs
Vercel Cron triggers our cleanup endpoint daily at 2 AM UTC. The endpoint purges stale view deduplication records, anonymizes old IP addresses, and removes inactive subscribers.
Headers and redirects
Security headers (CSP, HSTS, X-Frame-Options) are configured in next.config.js and applied to every response.
Monitoring
We use Vercel's built-in analytics for core web vitals and Plausible for privacy-friendly page analytics. No Google Analytics, no cookies for tracking.
Cost
For a corporate site with moderate traffic, the total monthly cost is under $30: Vercel Pro ($20), Neon free tier ($0), Plausible ($9). The stack scales significantly before costs increase meaningfully.