npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@netlify/neon

v0.1.0

Published

[![npm version](https://img.shields.io/npm/v/@netlify/neon.svg)](https://www.npmjs.com/package/@netlify/neon) [![License](https://img.shields.io/npm/l/@netlify/neon.svg)](LICENSE)

Downloads

24,008

Readme

@netlify/neon

npm version License

Netlify-optimized wrapper for @neondatabase/serverless with automatic environment configuration.

@neondatabase/serverless is Neon's PostgreSQL driver for JavaScript and TypeScript. It's:

  • Low-latency, thanks to message pipelining and other optimizations
  • Ideal for serverless/edge deployment, using https and WebSockets in place of TCP
  • A drop-in replacement for node-postgres, aka pg (on which it's based)

Netlify Integration

Automatically uses your Neon database connection via Netlify environment variables:

# Install package
npm install @netlify/neon

# Configure database (via Netlify CLI)
netlify db init

Basic Usage

import { neon } from '@netlify/neon'
const sql = neon() // automatically uses env NETLIFY_DATABASE_URL

const [post] = await sql`SELECT * FROM posts WHERE id = ${postId}`
// `post` is now { id: 12, title: 'My post', ... } (or undefined)

Usage with Drizzle-ORM

// ./src/db/index.ts
import { neon } from '@netlify/neon'
import { drizzle } from 'drizzle-orm/neon-http'
import { posts } from "./schema"

export const db = drizzle({
  schema,
  client: neon() // Uses NETLIFY_DATABASE_URL automatically
})

// ./src/db/schema.ts
import { integer, pgTable, varchar, text } from 'drizzle-orm/pg-core'

export const postsTable = pgTable('posts', {
    id: integer().primaryKey().generatedAlwaysAsIdentity(),
    title: varchar({ length: 255 }).notNull(),
    content: text().notNull().default('')
})

Querying with Drizzle

import { db } from "./db"
import { postsTable } from "./db/schema"

const posts = await db.select().from(postsTable)

Read more about using Drizzle-ORM with Neon: Get started

With additional options

The neon function imported from @netlify/neon also supports all of the same HTTP options as @neondatabase/serverless.

import { neon } from '@netlify/neon'

// automatically using connection string from env NETLIFY_DATABASE_URL 
const sql = neon({
    arrayMode: true,
    fetchOptions: { priority: 'high' }
})

// or when explicitly passing in a connection string override
const sql = neon("postgres://user:pass@host/db",{
    arrayMode: true,
    fetchOptions: { priority: 'high' }
})

Transactions

Supports all Neon transaction options:

import { neon } from '@netlify/neon'

const sql = neon() // automatically uses env NETLIFY_DATABASE_URL
const showLatestN = 10
const [posts, tags] = await sql.transaction(
  [sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, sql`SELECT * FROM tags`],
  {
    isolationLevel: 'RepeatableRead',
    readOnly: true,
  }
)

Documentation

📚 Neon Serverless Driver Docs
📚 Drizzle with Neon Postgres