neon-drizzle

neon-drizzle is a cursor rule for coding agents from neondatabase/ai-rules. It costs 0 tokens per session (2,016 once invoked), scanned A, original, MIT.

Integration rules for connecting Neon, a hosted PostgreSQL database, to Drizzle ORM, a TypeScript database toolkit.

In plain words
What is it for?
Use them when choosing Neon’s HTTP or WebSocket connection method, setting environment variables, installing packages, and configuring Drizzle.
Why use it?
They reduce connection and configuration mistakes across serverless and traditional applications.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/neondatabase/ai-rules/neon-drizzle
Clone the repo
git clone --depth 1 https://github.com/neondatabase/ai-rules

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for neon-drizzle

README.md
[![agentmods](https://agentmods.dev/badge/rules/neondatabase/ai-rules/neon-drizzle.svg)](https://agentmods.dev/rules/neondatabase/ai-rules/neon-drizzle)
Your own site
<a href="https://agentmods.dev/rules/neondatabase/ai-rules/neon-drizzle"><img src="https://agentmods.dev/badge/rules/neondatabase/ai-rules/neon-drizzle.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,016 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02016
Opus 5 $0.00000 $0.01008
Sonnet 5 $0.00000 $0.00403
Haiku 4.5 $0.00000 $0.00202

Measured 5d ago against content hash eb272dc75b8b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

neon-drizzle scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

neon-drizzle.mdc · 282 lines

How it starts

The opening of the file, as written. The whole thing — 282 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Neon and Drizzle Integration Guidelines

Overview

This guide covers the specific integration patterns, configurations, and optimizations for using Drizzle ORM with Neon Postgres. Follow these guidelines to ensure efficient, secure, and robust database operations in serverless and traditional environments.

Dependencies

For Neon with Drizzle ORM integration, include these specific dependencies. The ws package is required for persistent WebSocket connections in Node.js environments older than v22.

npm install drizzle-orm @neondatabase/serverless ws
npm install -D drizzle-kit dotenv @types/ws

Neon Connection String

Always use the Neon connection string format and store it in an environment file (.env, .env.local).

DATABASE_URL="postgresql://[user]:[password]@[neon_hostname]/[dbname]?sslmode=require&channel_binding=require"

Connection Setup: Choosing the Right Driver Adapter

Neon's serverless driver offers two connection methods: HTTP and WebSocket. Drizzle has a specific adapter for each.

1. HTTP Adapter (Recommended for Serverless/Edge)

This method is ideal for short-lived, stateless environments like Vercel Edge Functions or AWS Lambda. It uses fetch for each query, resulting in very low latency for single operations.

  • Use the neon client from @neondatabase/serverless.
  • Use the drizzle adapter from drizzle-orm/neon-http.
// src/db.ts
import { drizzle } from "drizzle-orm/neon-http";
import { neon } from "@neondatabase/serverless";
import { config } from "dotenv";

config({ path: ".env" });

if (!process.env.DATABASE_URL) {
  throw new Error('DATABASE_URL is not defined');
}

const sql = neon(process.env.DATABASE_URL);
export const db = drizzle(sql);

2. WebSocket Adapter (for node-postgres compatibility)

This method is suitable for long-running applications (e.g., a standard Node.js server) or when you need support for interactive transactions. It maintains a persistent WebSocket connection.

Read the full file on GitHub · 282 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 282 lines · 2,016 tokens per session scan A eb272dc75b8b

Subscribe to this mod's changes

neon-drizzle is a cursor rule published in the GitHub repository neondatabase/ai-rules (86 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,016 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.