neon-vercel-postgres
БесплатноБез исполняемых скриптовНе проверенIntegrates Neon serverless Postgres and Vercel Postgres (built on Neon) into web and edge applications: the @neondatabase/serverless and @vercel/postgres HTTP…
Об этом скилле
Neon & Vercel Serverless Postgres
Status: Production Ready
Last Updated: 2025-10-29
Dependencies: None
Latest Versions: @neondatabase/[email protected], @vercel/[email protected], [email protected], [email protected]
Quick Start (5 Minutes)
1. Choose Your Platform
Option A: Neon Direct (multi-cloud, Cloudflare Workers, any serverless)
npm install @neondatabase/serverless
Option B: Vercel Postgres (Vercel-only, zero-config on Vercel)
npm install @vercel/postgres
Note: Both use the same Neon backend. Vercel Postgres is Neon with Vercel-specific environment setup.
Why this matters:
- Neon direct gives you multi-cloud flexibility and access to branching API
- Vercel Postgres gives you zero-config on Vercel with automatic environment variables
- Both are HTTP-based (no TCP), perfect for serverless/edge environments
2. Get Your Connection String
For Neon Direct:
# Sign up at https://neon.tech
# Create a project → Get connection string
# Format: postgresql://user:[email protected]/dbname?sslmode=require
For Vercel Postgres:
# In your Vercel project
vercel postgres create
vercel env pull .env.local # Automatically creates POSTGRES_URL and other vars
CRITICAL:
- Use pooled connection string for serverless (ends with
-pooler.region.aws.neon.tech) - Non-pooled connections will exhaust quickly in serverless environments
- Always include
?sslmode=requireparameter
3. Query Your Database
Neon Direct (Cloudflare Workers, Vercel Edge, Node.js):
import { neon } from '@neondatabase/serverless';
const sql = neon(process.env.DATABASE_URL!);
// Simple query
const users = await sql`SELECT * FROM users WHERE id = ${userId}`;
// Transactions
const result = await sql.transaction([
sql`INSERT INTO users (name) VALUES (${name})`,
sql`SELECT * FROM users WHERE name = ${name}`
]);
Vercel Postgres (Next.js Server Actions, API Routes):
import { sql } from '@vercel/postgres';
// Simple query
const { rows } = await sql`SELECT * FROM users WHERE id = ${userId}`;
// Transactions
const client = await sql.connect();
try {
await client.sql`BEGIN`;
await client.sql`INSERT INTO users (name) VALUES (${name})`;
await client.sql`COMMIT`;
} finally {
client.release();
}
CRITICAL:
- Use template tag syntax (
sql`...`) for automatic SQL injection protection - Never concatenate strings:
sql('SELECT * FROM users WHERE id = ' + id)❌ - Template tags automatically escape values and prevent SQL injection
The 7-Step Setup Process
Step 1: Install Package
Choose based on your deployment platform:
Neon Direct (Cloudflare Workers, multi-cloud, direct Neon access):
npm install @neondatabase/serverless
Vercel Postgres (Vercel-specific, zero-config):
npm install @vercel/postgres
With ORM:
# Drizzle ORM (recommended)
npm install drizzle-orm @neondatabase/serverless
npm install -D drizzle-kit
# Prisma (alternative)
npm install prisma @prisma/client @prisma/adapter-neon @neondatabase/serverless
Key Points:
- Both packages use HTTP/WebSocket (no TCP required)
- Edge-compatible (works in Cloudflare Workers, Vercel Edge Runtime)
- Connection pooling is built-in when using pooled connection strings
- No need for separate connection pool libraries
Step 2: Create Neon Database
Option A: Neon Dashboard
- Sign up at https://neon.tech
- Create a new project
- Copy the pooled connection string (important!)
- Format:
postgresql://user:[email protected]/db?sslmode=require
Option B: Vercel Dashboard
- Go to your Vercel project → Storage → Create Database → Postgres
- Vercel automatically creates a Neon database
- Run
vercel env pullto get environment variables locally
Option C: Neon CLI (neonctl)
# Install CLI
npm install -g neonctl
# Authenticate
neonctl auth
# Create project
neonctl projects create --name my-app
# Get connection string
neonctl connection-string main
CRITICAL:
- Always use the pooled connection string (ends with
-pooler.region.aws.neon.tech) - Non-pooled connections are for direct connections (not serverless)
- Include
?sslmode=requirein connection string
Step 3: Configure Environment Variables
For Neon Direct:
# .env or .env.local
DATABASE_URL="postgresql://user:[email protected]/neondb?sslmode=require"
For Vercel Postgres:
# Automatically created by `vercel env pull`
POSTGRES_URL="..." # Pooled connection (use this for queries)
POSTGRES_PRISMA_URL="..." # For Prisma migrations
POSTGRES_URL_NON_POOLING="..." # Direct connection (avoid in serverless)
POSTGRES_USER="..."
POSTGRES_HOST="..."
POSTGRES_PASSWORD="..."
POSTGRES_DATABASE="..."
For Cloudflare Workers (wrangler.jsonc)
Установить neon-vercel-postgres в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл neon-vercel-postgres?
Integrates Neon serverless Postgres and Vercel Postgres (built on Neon) into web and edge applications: the @neondatabase/serverless and @vercel/postgres HTTP and WebSocket drivers, pooled versus non-pooled connection strings, sslmode requirements, git-like database branching with neonctl, Drizzle ORM and Prisma integration, migrations, and point-in-time restore. Use when setting up serverless Postgres for Cloudflare Workers, Vercel Edge Functions, Next.js, or Node.js serverless functions, configuring connection pooling for edge runtimes, creating database branches, migrating from D1/SQLite or traditional Postgres to serverless Postgres, or debugging errors like connection pool exhausted, TCP connections not supported in serverless, transaction timeouts, and sslmode required.
Как установить скилл neon-vercel-postgres?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл neon-vercel-postgres запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic