Neon Serverless Postgres

작성자: Neon

Neon Serverless Postgres 작업을 위한 가이드 및 모범 사례.

npx skills add https://github.com/neondatabase/agent-skills --skill neon-postgres

FIRST: Use the parent neon skill for a Neon overview, getting started with Neon, Neon development best practices, and more.

If the neon skill is not installed, fetch it from https://neon.com/docs/ai/skills/neon/SKILL.md or install it with:

npx skills add neondatabase/agent-skills --skill neon

Lakebase Postgres

Lakebase Postgres is the database at the core of Neon. It runs on the lakebase architecture — OLTP built directly on cloud object storage — which decouples storage from compute to offer autoscaling, branching, instant restore, and scale-to-zero. It's fully compatible with Postgres and works with any language, framework, or ORM that supports Postgres.

It is the same database whether you reach it through Neon or through Databricks; this skill covers the Neon access path.

Setup Flow

1. Select the organization and project

Use the CLI (default) or MCP server to list organizations and projects. Let the user select an existing project or create a new one. Check the .neon file for an existing linked project or branch.

2. Get the connection string

Use the CLI (default), neon env pull, or the MCP server to get the connection string. Store it in .env as DATABASE_URL. Read the file first before modifying it, to avoid overwriting existing values.

When to use pooled vs direct connections

Use caseConnection type
Web applications, serverless functionsPooled (-pooler)
Schema migrationsDirect
pg_dump / pg_restoreDirect
Logical replicationDirect
Long-running analytics with temp tablesDirect
Admin tasks needing SET or session stateDirect
LISTEN / NOTIFYDirect

3. Pick the connection method and driver

Always pair Neon with an ORM such as Drizzle for easy schema management and migrations. Refer to the connection methods guide to pick the correct driver based on how the runtime treats your code: https://neon.com/docs/connect/choose-connection.md.

Recommendations:

  • Drizzle as ORM (see https://neon.com/docs/guides/drizzle.md)
  • On Vercel, use node-postgres (npm install pg) with Vercel Fluid compute and import { attachDatabasePool } from "@vercel/functions";
  • On Cloudflare, use node-postgres with Cloudflare Hyperdrive
  • On Neon Functions, use node-postgres, as the functions are long-running and reuse the pool across requests.
  • Use the @neondatabase/serverless driver for serverless and edge environments (for example, when using Netlify) — HTTP transport for one-shot queries, WebSocket for transaction support. Link: https://neon.com/docs/serverless/serverless-driver.md

4. Set up the schema

Manage schemas and migrations as code. Avoid running ad hoc schema migrations against your database, since they're hard to manage.

If you're using an ORM, follow your ORM's best practices to manage schemas and migrations. For example, if using Drizzle, only use Drizzle for schema and migration management unless instructed otherwise.

Branching

Use this when the user is planning isolated environments, schema migration testing, preview deployments, or branch lifecycle automation.

Key points:

  • Branches are instant, copy-on-write clones (no full data copy).
  • Each branch has its own compute endpoint.
  • Use the neon CLI or MCP server to create, inspect, and compare branches.

Link: https://neon.com/docs/introduction/branching.md

For detailed branch creation workflows (normal vs schema-only branches, reset-from-parent, CLI/MCP selection), use the neon-postgres-branches skill. If it isn't installed, fetch it from https://neon.com/docs/ai/skills/neon-postgres-branches/SKILL.md or install it with:

npx skills add neondatabase/agent-skills --skill neon-postgres-branches

Autoscaling

Use this when the user needs compute to scale automatically with workload and wants guidance on CU sizing and runtime behavior.

Link: https://neon.com/docs/introduction/autoscaling.md

Scale to Zero

Use this when optimizing idle costs and discussing suspend/resume behavior, including cold-start trade-offs.

Key points:

  • Idle computes suspend automatically after a default of 5 minutes; the timeout is configurable, and suspension can only be disabled on the Launch and Scale plans.
  • First query after suspend typically has a cold-start penalty (around hundreds of ms)
  • Storage remains active while compute is suspended.

Link: https://neon.com/docs/introduction/scale-to-zero.md

Instant Restore

Use this when the user needs point-in-time recovery or wants to restore data state without traditional backup restore workflows.

Key points:

  • History windows for instant restore depend on plan limits.
  • Users can create branches from historical points-in-time.
  • Time Travel queries can be used for historical inspection workflows.

Link: https://neon.com/docs/introduction/branch-restore.md

Read Replicas

Use this for read-heavy workloads where the user needs dedicated read-only compute without duplicating storage.

Key points:

  • Replicas are read-only compute endpoints sharing the same storage.
  • Creation is fast and scaling is independent from primary compute.
  • Typical use cases: analytics, reporting, and read-heavy APIs.

Link: https://neon.com/docs/introduction/read-replicas.md

Connection Pooling

Use this when the user is in serverless or high-concurrency environments and needs safe, scalable Postgres connection management.

Key points:

  • Neon pooling uses PgBouncer.
  • Add -pooler to endpoint hostnames to use pooled connections.
  • Pooling is especially important in serverless runtimes with bursty concurrency.

Link: https://neon.com/docs/connect/connection-pooling.md

IP Allow Lists

Use this when the user needs to restrict database access by trusted networks, IPs, or CIDR ranges.

Link: https://neon.com/docs/introduction/ip-allow.md

Logical Replication

Use this when integrating CDC pipelines, external Postgres sync, or replication-based data movement.

Key points:

  • Neon supports native logical replication workflows.
  • Useful for replicating to/from external Postgres systems.

Link: https://neon.com/docs/guides/logical-replication-guide.md

관련 스킬

monitoring-capture-service
posthog
캡처 서비스(rust/capture/)는 PostHog의 Rust HTTP 수집 엔드포인트입니다. SDK에서 이벤트를 수신하고, 할당량/속도 제한을 적용하며, Kafka로 전송합니다. 세 가지 배포 역할이 동일한 바이너리를 다른 CAPTURE_MODE 설정으로 실행합니다.
official
qdrant-search-quality
github
Qdrant 검색 관련성을 진단하고 개선합니다. '검색 결과가 나쁘다', '잘못된 결과', '낮은 정밀도', '낮은 재현율', '관련 없는...' 등의 문제가 보고될 때 사용하세요.
official
research
tavily-ai
모든 주제에 대해 자동 소스 수집, 분석 및 인용을 포함한 포괄적 연구를 수행합니다. 명확한 인용과 함께 다중 소스 웹 연구를 진행하며, 비교 분석, 최신 이슈, 시장 분석 및 상세 보고서에 적합합니다. 세 가지 모델 옵션을 제공합니다: 미니(단일 주제 집중 연구, 약 30초), 프로(포괄적 다각도 분석, 약 60-120초), 오토(API 기반 복잡도 자동 감지). Tavily MCP 서버를 통해 OAuth 인증을 하며, 자동 브라우저 기반 로그인을 지원합니다.
official
exploring-replay-vision-observations
posthog
Guides agents through pulling a Replay Vision scanner's observations, reading the findings, and acting on them — summarizing patterns across sessions, drilling…
official
cms-environments-publishing
contentstack
개발자에게 환경 구성, 콘텐츠 게시, 전달 및 미리보기 토큰 사용, Sync API 활용, CDN 이해 등에 대해 조언합니다.
official
substack-ghostwriting
samber
Substack 콘텐츠를 작성, 최적화, 성장시키는 작업 — 뉴스레터 발행물(이메일 우선)과 웹 게시물(웹 우선 아티클/에세이)을 다룹니다. 음성 매칭을 통한 고스트라이팅, Substack 알고리즘 최적화, Notes 전략, 이메일 포맷팅, SEO, 성장 전략, 수익화 계획을 포함합니다. 사용자가 Substack, 뉴스레터, 뉴스레터 발행물 작성, Substack 게시물, Substack 아티클, 웹 게시물, 에버그린 콘텐츠, Substack SEO, 뉴스레터 성장, Notes 전략, 고스트라이팅 등을 언급할 때 사용하세요.
creativemarketing
apify-market-research
apify
Google Maps, Facebook, Instagram, Booking.com 등에서 시장 상황, 지역별 기회, 가격, 소비자 행동, 제품 검증을 분석합니다.
official
feature-flags-go
posthog
PostHog 기능 플래그 for Go 애플리케이션
official