Introducing neon.ts: infrastructure as code for your Neon projects
neon.ts is a TypeScript infrastructure-as-code file for Neon projects that declares services (Postgres, Neon Auth, Data API, with functions, buckets and an AI gateway coming under a preview block) and provisions them with `neon config plan` and `neon config apply`. A companion `@neondatabase/env` package provides `parseEnv`, which validates `process.env` against the declared services and returns a typed env object, with optional per-app subsets. A programmable `branch` function sets TTL, autoscaling limits and scale-to-zero for new branches created via `neon checkout`. Type-level encoding of service dependencies turns cryptic `never` errors into messages that explain the fix, such as requiring Neon Auth for the Data API.
Related posts
- Introducing @neon/sdk, our new TypeScript client for the Neon API
Neon mediumAdept
@neon/sdk is a fetch-based, zero-dependency, ESM-only TypeScript client for the Neon API, replacing the axios-based @neondatabase/api-client. It has two layers: a raw surface generated from Neon's OpenAPI spec with Hey API, exposing every endpoint as a tree-shakeable function, and an ergonomic client that adds retries, readiness polling of background operations, pagination, errors as values and multi-step workflows. Examples include createAndConnect for projects and branches, snapshot restore with a preview callback that commits or rolls back, and cross-organization project transfer. Neon recommends it over the MCP server and CLI for programmatic integration such as CI/CD and platform provisioning, and the old client is not being deprecated.
- Neon for Agent Platforms: A Companion Skill for the AI Agent Program
Neon mediumAdept
neon-for-agent-platforms is an open-source companion Agent Skill and set of TypeScript scripts for running fleets of Neon Postgres databases on agent platforms. It covers a dual-org model that separates sponsored free-tier and paid customers, with one project per tenant transferred to the paid org on upgrade. It also covers copy-on-write dev and preview branches with shorter suspend timeouts to keep costs predictable, branch-based compound checkpoints, and the consumption API for per-customer cost attribution. Both skills install via npx, and the scripts can also be run directly against a Neon API key and org ID.
- Build Internal Tools Using Neon, StackAuth, and Vercel
Neon mediumAdept
An open-source Next.js template for internal tools combines Neon serverless Postgres, Stack Auth and Vercel free tiers to provide a database, API routes, authentication, role-based access control and an admin panel. Setup takes a few steps: clone the repo, fill in the env vars, push the schema with drizzle-kit, create nested admin/user roles in Neon's Auth tab, claim admin at /setup and deploy to Vercel. Access is controlled by verified-email domain whitelisting, per-email grants for contractors and explicit blocklists, all managed from /tools/admin. New tools are added under app/tools and registered in config/app.ts.
- Build a serverless API using Cloudflare Workers, Drizzle ORM, and Neon
Neon mediumAdept
A step-by-step setup for a serverless TypeScript API on Cloudflare Workers that uses Hono for routing, Drizzle ORM for schema definition and migrations, and Neon serverless Postgres for storage. It scaffolds a Worker with create-cloudflare, defines a products table in TypeScript, and uses drizzle-kit to generate SQL migrations. Migrations run through a postgres.js script capped at a single connection so they execute in order. The Worker queries Neon over HTTP via @neondatabase/serverless, is deployed with wrangler, and gets its DATABASE_URL from Cloudflare's Neon integration instead of manually configured secrets.
- Just landed in the Neon CLI
Neon mediumAdept
The Neon CLI is renamed from neonctl to neon (old name kept as an alias) and gains a branch-first workflow built on `neon link`, `neon checkout` and `neon env pull`, which store project/branch context in a local .neon file and rewrite only Neon-managed env vars. New commands include `neon inspect db` for read-only Postgres diagnostics (bloat, unused indexes, locks, pg_stat_statements outliers, cache hit rate), `neon diff` for git-style schema diffs, snapshots, project-scoped API keys and credential profiles for CI and agents, and a raw `neon api` fallback. `neon init` sets up MCP and agent skills in one step, and a suggested AGENTS.md snippet steers coding agents toward the branch-per-feature loop.