
Neon Postgres
- 1 installs
- 404 repo stars
- Updated August 5, 2026
- aiskillstore/marketplace
neon-postgres is a Claude Code skill for connecting to and managing Neon serverless PostgreSQL with pooling, branching, and the serverless driver.
About
neon-postgres is a Claude Code skill for working with Neon serverless PostgreSQL. A developer uses it to set up connections with the @neondatabase/serverless driver (HTTP for edge/one-shot queries, WebSocket for pooled transactions), integrate Drizzle ORM, and use Neon branching for preview databases. It includes examples for Next.js, edge functions, migrations, and PR-based branch workflows.
- Connects apps to Neon serverless Postgres via HTTP and WebSocket drivers
- Covers connection pooling, database branching, autoscaling, and Drizzle ORM integration
- Includes Next.js, edge-function, migration, and CI/CD branch-per-PR examples
Neon Postgres by the numbers
- 1 all-time installs (skills.sh)
- Ranked #765 of 911 Databases skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
neon-postgres capabilities & compatibility
Requires a Neon account and DATABASE_URL connection string; Neon offers a serverless free tier and CI needs NEON_API_KEY
- Capabilities
- database connection · connection pooling · database branching · orm integration
- Works with
- postgres · vercel · github
- Use cases
- database · devops
- Pricing
- Bring your own API key
What neon-postgres says it does
Neon PostgreSQL serverless database - connection pooling, branching, serverless driver, and optimization. Use when deploying to Neon or building serverless applications.
Neon branches are copy-on-write clones of your database.
npx skills add https://github.com/aiskillstore/marketplace --skill neon-postgresAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 404 |
| Last updated | August 5, 2026 |
| Repository | aiskillstore/marketplace ↗ |
What it does
Connect and manage Neon serverless Postgres with pooling, branching, and Drizzle in serverless apps.
Who is it for?
Developers building serverless or edge apps on Neon Postgres who need connection and branching guidance.
Skip if: Self-hosted or non-Neon Postgres deployments where serverless drivers and branching do not apply.
When should I use this skill?
You are deploying to Neon or building a serverless application on Postgres.
What you get
A correctly connected Neon Postgres app with pooling, branching, and ORM integration.
- Database connection setup
- Drizzle ORM integration
- Branch-per-PR CI workflow
By the numbers
- Two connection methods: HTTP (neon) and WebSocket (Pool)
- Two Drizzle drivers: neon-http and neon-serverless
Files
Neon PostgreSQL Skill
Serverless PostgreSQL with branching, autoscaling, and instant provisioning.
Quick Start
Create Database
1. Go to console.neon.tech 2. Create a new project 3. Copy connection string
Installation
# npm
npm install @neondatabase/serverless
# pnpm
pnpm add @neondatabase/serverless
# yarn
yarn add @neondatabase/serverless
# bun
bun add @neondatabase/serverlessConnection Strings
# Direct connection (for migrations, scripts)
DATABASE_URL=postgresql://user:password@ep-xxx.us-east-1.aws.neon.tech/dbname?sslmode=require
# Pooled connection (for application)
DATABASE_URL_POOLED=postgresql://user:password@ep-xxx-pooler.us-east-1.aws.neon.tech/dbname?sslmode=requireKey Concepts
| Concept | Guide |
|---|---|
| Serverless Driver | reference/serverless-driver.md |
| Connection Pooling | reference/pooling.md |
| Branching | reference/branching.md |
| Autoscaling | reference/autoscaling.md |
Examples
| Pattern | Guide |
|---|---|
| Next.js Integration | examples/nextjs.md |
| Edge Functions | examples/edge.md |
| Migrations | examples/migrations.md |
| Branching Workflow | examples/branching-workflow.md |
Templates
| Template | Purpose |
|---|---|
| templates/db.ts | Database connection |
| templates/neon.config.ts | Neon configuration |
Connection Methods
HTTP (Serverless - Recommended)
Best for: Edge functions, serverless, one-shot queries
import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);
// Simple query
const posts = await sql`SELECT * FROM posts WHERE published = true`;
// With parameters
const post = await sql`SELECT * FROM posts WHERE id = ${postId}`;
// Insert
await sql`INSERT INTO posts (title, content) VALUES (${title}, ${content})`;WebSocket (Connection Pooling)
Best for: Long-running connections, transactions
import { Pool } from "@neondatabase/serverless";
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const client = await pool.connect();
try {
await client.query("BEGIN");
await client.query("INSERT INTO posts (title) VALUES ($1)", [title]);
await client.query("COMMIT");
} catch (e) {
await client.query("ROLLBACK");
throw e;
} finally {
client.release();
}With Drizzle ORM
HTTP Driver
// src/db/index.ts
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";
import * as schema from "./schema";
const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql, { schema });WebSocket Driver
// src/db/index.ts
import { Pool } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-serverless";
import * as schema from "./schema";
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
export const db = drizzle(pool, { schema });Branching
Neon branches are copy-on-write clones of your database.
CLI Commands
# Install Neon CLI
npm install -g neonctl
# Login
neonctl auth
# List branches
neonctl branches list
# Create branch
neonctl branches create --name feature-x
# Get connection string
neonctl connection-string feature-x
# Delete branch
neonctl branches delete feature-xBranch Workflow
# Create branch for feature
neonctl branches create --name feature-auth --parent main
# Get connection string for branch
export DATABASE_URL=$(neonctl connection-string feature-auth)
# Work on feature...
# When done, merge via application migrations
neonctl branches delete feature-authCI/CD Integration
# .github/workflows/preview.yml
name: Preview
on: pull_request
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Neon Branch
uses: neondatabase/create-branch-action@v5
id: branch
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
api_key: ${{ secrets.NEON_API_KEY }}
branch_name: preview-${{ github.event.pull_request.number }}
- name: Run Migrations
env:
DATABASE_URL: ${{ steps.branch.outputs.db_url }}
run: npx drizzle-kit migrateConnection Pooling
When to Use Pooling
| Scenario | Connection Type |
|---|---|
| Edge/Serverless functions | HTTP (neon) |
| API routes with transactions | WebSocket Pool |
| Long-running processes | WebSocket Pool |
| One-shot queries | HTTP (neon) |
Pooler URL
# Without pooler (direct)
postgresql://user:pass@ep-xxx.aws.neon.tech/db
# With pooler (add -pooler to endpoint)
postgresql://user:pass@ep-xxx-pooler.aws.neon.tech/dbAutoscaling
Configure in Neon console:
- Min compute: 0.25 CU (can scale to zero)
- Max compute: Up to 8 CU
- Scale to zero delay: 5 minutes (default)
Handle Cold Starts
import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!, {
fetchOptions: {
// Increase timeout for cold starts
signal: AbortSignal.timeout(10000),
},
});Best Practices
1. Use HTTP for Serverless
// Good - HTTP for serverless
import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);
// Avoid - Pool in serverless (connection exhaustion)
import { Pool } from "@neondatabase/serverless";
const pool = new Pool({ connectionString: process.env.DATABASE_URL });2. Connection String per Environment
# .env.development
DATABASE_URL=postgresql://...@ep-dev-branch...
# .env.production
DATABASE_URL=postgresql://...@ep-main...3. Use Prepared Statements
// Good - parameterized query
const result = await sql`SELECT * FROM users WHERE id = ${userId}`;
// Bad - string interpolation (SQL injection risk)
const result = await sql(`SELECT * FROM users WHERE id = '${userId}'`);4. Handle Errors
import { neon, NeonDbError } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);
try {
await sql`INSERT INTO users (email) VALUES (${email})`;
} catch (error) {
if (error instanceof NeonDbError) {
if (error.code === "23505") {
// Unique violation
throw new Error("Email already exists");
}
}
throw error;
}Next.js App Router
// app/posts/page.tsx
import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);
export default async function PostsPage() {
const posts = await sql`SELECT * FROM posts ORDER BY created_at DESC`;
return (
<ul>
{posts.map((post) => (
<li key={post.id}>{post.title}</li>
))}
</ul>
);
}Drizzle + Neon Complete Setup
// src/db/index.ts
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";
import * as schema from "./schema";
const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql, { schema });
// src/db/schema.ts
import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
export const posts = pgTable("posts", {
id: serial("id").primaryKey(),
title: text("title").notNull(),
content: text("content"),
createdAt: timestamp("created_at").defaultNow().notNull(),
});
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
schema: "./src/db/schema.ts",
out: "./src/db/migrations",
dialect: "postgresql",
dbCredentials: {
url: process.env.DATABASE_URL!,
},
});Neon Serverless Driver Reference
Overview
The @neondatabase/serverless package provides two connection methods:
- HTTP (neon): Stateless, one-shot queries via HTTP
- WebSocket (Pool): Persistent connections with pooling
Installation
npm install @neondatabase/serverlessHTTP Driver (neon)
Basic Usage
import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);
// Tagged template literal
const users = await sql`SELECT * FROM users`;
// With parameters (safe from SQL injection)
const user = await sql`SELECT * FROM users WHERE id = ${userId}`;Insert
const newUser = await sql`
INSERT INTO users (email, name)
VALUES (${email}, ${name})
RETURNING *
`;Update
const updated = await sql`
UPDATE users
SET name = ${newName}
WHERE id = ${userId}
RETURNING *
`;Delete
await sql`DELETE FROM users WHERE id = ${userId}`;Transactions (HTTP)
HTTP transactions use a special syntax:
import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);
const results = await sql.transaction([
sql`INSERT INTO users (email) VALUES (${email}) RETURNING id`,
sql`INSERT INTO profiles (user_id) VALUES (LASTVAL())`,
]);Configuration Options
const sql = neon(process.env.DATABASE_URL!, {
// Fetch options
fetchOptions: {
// Timeout for cold starts
signal: AbortSignal.timeout(10000),
},
// Array mode (returns arrays instead of objects)
arrayMode: false,
// Full results (includes row count, fields metadata)
fullResults: false,
});Type Safety
interface User {
id: string;
email: string;
name: string;
}
const sql = neon(process.env.DATABASE_URL!);
// Type the result
const users = await sql<User[]>`SELECT * FROM users`;
// Single result
const [user] = await sql<User[]>`SELECT * FROM users WHERE id = ${userId}`;WebSocket Driver (Pool)
Basic Usage
import { Pool } from "@neondatabase/serverless";
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
// Query
const { rows } = await pool.query("SELECT * FROM users");
// With parameters
const { rows: [user] } = await pool.query(
"SELECT * FROM users WHERE id = $1",
[userId]
);Transactions
const client = await pool.connect();
try {
await client.query("BEGIN");
await client.query(
"INSERT INTO users (email) VALUES ($1)",
[email]
);
await client.query(
"INSERT INTO profiles (user_id) VALUES (LASTVAL())"
);
await client.query("COMMIT");
} catch (e) {
await client.query("ROLLBACK");
throw e;
} finally {
client.release();
}Pool Configuration
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
// Maximum connections
max: 10,
// Connection timeout (ms)
connectionTimeoutMillis: 10000,
// Idle timeout (ms)
idleTimeoutMillis: 30000,
});When to Use Each
| Scenario | Driver |
|---|---|
| Edge/Serverless functions | HTTP (neon) |
| Simple CRUD operations | HTTP (neon) |
| Transactions | WebSocket (Pool) |
| Connection pooling | WebSocket (Pool) |
| Long-running processes | WebSocket (Pool) |
| Next.js API routes | HTTP (neon) |
| Next.js Server Actions | HTTP (neon) |
Error Handling
import { neon, NeonDbError } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);
try {
await sql`INSERT INTO users (email) VALUES (${email})`;
} catch (error) {
if (error instanceof NeonDbError) {
// PostgreSQL error codes
switch (error.code) {
case "23505": // unique_violation
throw new Error("Email already exists");
case "23503": // foreign_key_violation
throw new Error("Referenced record not found");
case "23502": // not_null_violation
throw new Error("Required field missing");
default:
throw error;
}
}
throw error;
}Common PostgreSQL Error Codes
| Code | Name | Description |
|---|---|---|
| 23505 | unique_violation | Duplicate key value |
| 23503 | foreign_key_violation | Foreign key constraint |
| 23502 | not_null_violation | NULL in non-null column |
| 23514 | check_violation | Check constraint failed |
| 42P01 | undefined_table | Table doesn't exist |
| 42703 | undefined_column | Column doesn't exist |
Next.js Integration
Server Component
// app/users/page.tsx
import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);
export default async function UsersPage() {
const users = await sql`SELECT * FROM users ORDER BY created_at DESC`;
return (
<ul>
{users.map((user) => (
<li key={user.id}>{user.name}</li>
))}
</ul>
);
}Server Action
// app/actions.ts
"use server";
import { neon } from "@neondatabase/serverless";
import { revalidatePath } from "next/cache";
const sql = neon(process.env.DATABASE_URL!);
export async function createUser(formData: FormData) {
const email = formData.get("email") as string;
const name = formData.get("name") as string;
await sql`INSERT INTO users (email, name) VALUES (${email}, ${name})`;
revalidatePath("/users");
}API Route
// app/api/users/route.ts
import { neon } from "@neondatabase/serverless";
import { NextResponse } from "next/server";
const sql = neon(process.env.DATABASE_URL!);
export async function GET() {
const users = await sql`SELECT * FROM users`;
return NextResponse.json(users);
}
export async function POST(request: Request) {
const { email, name } = await request.json();
const [user] = await sql`
INSERT INTO users (email, name)
VALUES (${email}, ${name})
RETURNING *
`;
return NextResponse.json(user, { status: 201 });
}{
"schema_version": "2.0",
"meta": {
"generated_at": "2026-01-16T18:53:55.254Z",
"slug": "asmayaseen-neon-postgres",
"source_url": "https://github.com/Asmayaseen/hackathon-2/tree/main/.claude/skills/neon-postgres",
"source_ref": "main",
"model": "claude",
"analysis_version": "3.0.0",
"source_type": "community",
"content_hash": "c93dae2b6e718ea2a5be0077ea5b2ab168205d115ebc30e85e427f1b8ead057a",
"tree_hash": "02b4c996e56868edfea260e40b281cb60152b3cafa801a62b6ca581220a89fbe"
},
"skill": {
"name": "neon-postgres",
"description": "Neon PostgreSQL serverless database - connection pooling, branching, serverless driver, and optimization. Use when deploying to Neon or building serverless applications.",
"summary": "Neon PostgreSQL serverless database - connection pooling, branching, serverless driver, and optimiza...",
"icon": "🗄️",
"version": "1.0.0",
"author": "Asmayaseen",
"license": "MIT",
"category": "data",
"tags": [
"postgresql",
"serverless",
"database",
"neon",
"connection-pooling"
],
"supported_tools": [
"claude",
"codex",
"claude-code"
],
"risk_factors": [
"env_access",
"network"
]
},
"security_audit": {
"risk_level": "safe",
"is_blocked": false,
"safe_to_publish": true,
"summary": "Documentation-only skill containing TypeScript templates and guides for Neon PostgreSQL integration. All patterns detected are legitimate database connection patterns: tagged template literals for SQL queries (not shell commands), environment variable access for DATABASE_URL (standard credential management), and HTTPS connections to Neon servers. The skill explicitly warns against hardcoding credentials and promotes security best practices. No executable scripts, no credential exfiltration, no malicious patterns.",
"risk_factor_evidence": [
{
"factor": "env_access",
"evidence": [
{
"file": "SKILL.md",
"line_start": 38,
"line_end": 78
},
{
"file": "SKILL.md",
"line_start": 97,
"line_end": 134
},
{
"file": "SKILL.md",
"line_start": 240,
"line_end": 308
},
{
"file": "reference/serverless-driver.md",
"line_start": 22,
"line_end": 100
},
{
"file": "reference/serverless-driver.md",
"line_start": 116,
"line_end": 272
},
{
"file": "templates/db.ts",
"line_start": 15,
"line_end": 62
}
]
},
{
"factor": "network",
"evidence": [
{
"file": "SKILL.md",
"line_start": 14,
"line_end": 14
},
{
"file": "SKILL.md",
"line_start": 193,
"line_end": 203
}
]
}
],
"critical_findings": [],
"high_findings": [],
"medium_findings": [],
"low_findings": [],
"dangerous_patterns": [],
"files_scanned": 4,
"total_lines": 917,
"audit_model": "claude",
"audited_at": "2026-01-16T18:53:55.254Z"
},
"content": {
"user_title": "Connect to Neon PostgreSQL databases",
"value_statement": "Build serverless applications with Neon PostgreSQL. Get connection templates, branching workflows, and optimization patterns for edge functions and serverless deployments.",
"seo_keywords": [
"neon postgresql",
"serverless database",
"claude code neon",
"postgresql connection pooling",
"neon branching",
"edge database",
"serverless postgres",
"neon driver",
"drizzle orm neon",
"next.js database"
],
"actual_capabilities": [
"Create Neon PostgreSQL databases and manage connection strings",
"Connect using HTTP driver for serverless and edge functions",
"Use WebSocket pooling for transactions and long-running connections",
"Implement database branching workflows for preview environments",
"Integrate with Drizzle ORM for type-safe queries",
"Handle cold starts and configure autoscaling settings"
],
"limitations": [
"Requires existing Neon account and project setup",
"Does not provision Neon resources directly",
"Connection depends on valid DATABASE_URL environment variable",
"Works only with Neon-hosted PostgreSQL databases"
],
"use_cases": [
{
"target_user": "Full-stack developers",
"title": "Serverless database connections",
"description": "Connect Next.js, edge functions, and serverless APIs to Neon PostgreSQL with optimal connection patterns"
},
{
"target_user": "DevOps engineers",
"title": "Database branching workflows",
"description": "Create preview branches for testing, set up CI/CD integration with Neon CLI and GitHub Actions"
},
{
"target_user": "ORM developers",
"title": "Type-safe query patterns",
"description": "Integrate Neon with Drizzle ORM for type-safe database operations in serverless environments"
}
],
"prompt_templates": [
{
"title": "Basic connection setup",
"scenario": "Set up Neon database connection",
"prompt": "Show me how to connect to Neon PostgreSQL from my serverless function using the @neondatabase/serverless package"
},
{
"title": "Connection pooling",
"scenario": "Configure connection pool",
"prompt": "When should I use pooled WebSocket connections vs HTTP connections in Neon? Show me both patterns"
},
{
"title": "Database branching",
"scenario": "Create preview branch",
"prompt": "How do I create a Neon database branch for preview environments and connect my app to it?"
},
{
"title": "ORM integration",
"scenario": "Set up Drizzle with Neon",
"prompt": "Set up Drizzle ORM with Neon PostgreSQL including schema definition and type-safe queries"
}
],
"output_examples": [
{
"input": "How do I connect to Neon PostgreSQL from a Next.js API route?",
"output": [
"Install the serverless driver: npm install @neondatabase/serverless",
"Add your connection string to .env as DATABASE_URL",
"Create a connection instance using the neon() function",
"Use tagged template literals for type-safe parameterized queries"
]
},
{
"input": "How do I create a preview database branch for testing?",
"output": [
"Use the Neon CLI to create a branch: neonctl branches create --name preview-branch",
"Get the connection string: neonctl connection-string preview-branch",
"Set the DATABASE_URL environment variable in your CI/CD pipeline",
"Run migrations against the preview branch",
"Delete the branch when done to save resources"
]
},
{
"input": "Should I use HTTP or WebSocket connections in my serverless function?",
"output": [
"Use HTTP (neon) for serverless and edge functions - no connection limits",
"Use WebSocket Pool for transactions and long-running processes",
"Avoid pooling in serverless to prevent connection exhaustion",
"HTTP handles cold starts better with appropriate timeouts"
]
}
],
"best_practices": [
"Use HTTP driver for serverless and edge functions to avoid connection exhaustion",
"Always use tagged template literals with parameter injection to prevent SQL injection",
"Set appropriate timeouts to handle cold starts when compute scales to zero"
],
"anti_patterns": [
"Using WebSocket pooling in serverless functions (causes connection exhaustion)",
"String interpolation in queries (creates SQL injection vulnerabilities)",
"Hardcoding database credentials instead of using environment variables"
],
"faq": [
{
"question": "What Neon plans support serverless connections?",
"answer": "All Neon plans include the serverless driver. Free tier has limits on compute and storage."
},
{
"question": "How many connections can I have?",
"answer": "HTTP driver has no connection limit. Pooled connections default to 10 max per instance."
},
{
"question": "Can I use this with other ORMs?",
"answer": "Yes, Neon works with Prisma, Drizzle, Kysely, and other PostgreSQL-compatible ORMs."
},
{
"question": "Is my data secure?",
"answer": "Neon uses TLS/SSL for all connections. Credentials should never be committed to version control."
},
{
"question": "Why am I getting connection errors?",
"answer": "Check that your compute is not scaled to zero, verify DATABASE_URL is correct, and ensure your IP is allowlisted."
},
{
"question": "How is this different from regular PostgreSQL?",
"answer": "Neon provides autoscaling, instant branching, and serverless-optimized connection modes unavailable in traditional PostgreSQL."
}
]
},
"file_structure": [
{
"name": "reference",
"type": "dir",
"path": "reference",
"children": [
{
"name": "serverless-driver.md",
"type": "file",
"path": "reference/serverless-driver.md",
"lines": 291
}
]
},
{
"name": "templates",
"type": "dir",
"path": "templates",
"children": [
{
"name": "db.ts",
"type": "file",
"path": "templates/db.ts",
"lines": 69
}
]
},
{
"name": "SKILL.md",
"type": "file",
"path": "SKILL.md",
"lines": 356
}
]
}
/**
* Neon PostgreSQL Connection Template
*
* Usage:
* 1. Copy this file to src/db/index.ts
* 2. Set DATABASE_URL in .env
* 3. Choose the appropriate connection method
*/
// === OPTION 1: HTTP (Serverless - Recommended) ===
// Best for: Edge functions, serverless, one-shot queries
import { neon } from "@neondatabase/serverless";
export const sql = neon(process.env.DATABASE_URL!, {
fetchOptions: {
// Increase timeout for cold starts
signal: AbortSignal.timeout(10000),
},
});
// Usage:
// const users = await sql`SELECT * FROM users`;
// const user = await sql`SELECT * FROM users WHERE id = ${userId}`;
// === OPTION 2: WebSocket Pool ===
// Best for: Transactions, long-running connections
// import { Pool } from "@neondatabase/serverless";
//
// export const pool = new Pool({
// connectionString: process.env.DATABASE_URL,
// max: 10,
// });
//
// Usage:
// const { rows } = await pool.query("SELECT * FROM users");
// === OPTION 3: Drizzle ORM + Neon HTTP ===
// Best for: Type-safe queries with Drizzle
// import { neon } from "@neondatabase/serverless";
// import { drizzle } from "drizzle-orm/neon-http";
// import * as schema from "./schema";
//
// const sql = neon(process.env.DATABASE_URL!);
// export const db = drizzle(sql, { schema });
//
// Usage:
// const users = await db.select().from(schema.users);
// === OPTION 4: Drizzle ORM + Neon WebSocket ===
// Best for: Drizzle with transactions
// import { Pool } from "@neondatabase/serverless";
// import { drizzle } from "drizzle-orm/neon-serverless";
// import * as schema from "./schema";
//
// const pool = new Pool({ connectionString: process.env.DATABASE_URL });
// export const db = drizzle(pool, { schema });
//
// Usage:
// await db.transaction(async (tx) => {
// await tx.insert(schema.users).values({ email: "user@example.com" });
// });
Related skills
FAQ
When should I use the HTTP vs WebSocket driver?
Use the HTTP (neon) driver for edge/serverless functions and one-shot queries, and the WebSocket Pool for long-running connections and transactions.
What is Neon branching used for?
Neon branches are copy-on-write clones of your database, useful for preview environments and PR-based branch-per-preview CI/CD workflows.