Next.js + Neon Postgres Demo

A minimalistic demonstration of different database interaction methods with Next.js 15, Server Actions, and Neon PostgreSQL on Vercel.

Database Methods

@neondatabase/serverless

Direct SQL queries with Neon's serverless driver

Prisma ORM

Type-safe database access with auto-generated client

Drizzle ORM

Lightweight TypeScript ORM with SQL-like syntax

@vercel/postgres

Vercel's optimized PostgreSQL client with SQL templates

Features

  • ✅ Next.js 15 with App Router
  • ✅ Server Actions for mutations
  • ✅ TypeScript throughout
  • ✅ Zod validation
  • ✅ User CRUD operations
  • ✅ API routes for testing
  • ✅ Ready for Vercel deployment

API Endpoints

GET Users

/api/neon/users
/api/prisma/users
/api/drizzle/users
/api/vercel-postgres/users

POST Create User

POST /api/neon/users
POST /api/prisma/users
POST /api/drizzle/users
POST /api/vercel-postgres/users

Example API Calls

Create a user:

curl -X POST http://localhost:3000/api/neon/users \
  -H "Content-Type: application/json" \
  -d '{"name": "John Doe", "email": "john@example.com"}'

Get all users:

curl http://localhost:3000/api/prisma/users

Database schema: users (id, name, email, created_at)