Skip to main content
Deno 2 is finally here 🎉️
Learn more
The Neon serverless driver is now on JSR.

Announcing the Neon Serverless Driver on JSR

JSR is a modern JavaScript registry intended to simplify publishing and consuming JavaScript and TypeScript modules, while also moving the ecosystem forward by supporting and promoting web standards. Since our launch, over 7.5k users have signed up to JSR.

Today, we’re thrilled to announce that the Neon Serverless Driver is now available on JSR.

Neon is a fully managed, serverless, scalable Postgres driver that simplifies adding a persistent relational database to your projects.

Using Neon via JSR not only offers a better developer experience than npm, but also provides faster query latencies. This serverless driver allows V8 isolate runtimes like Deno and Cloudflare Workers to connect to the database via protocols other than TCP, which minimizes the number of required round trips and allows for sub-10ms first query latencies.

Read on for more information on how to install and use Neon with JSR.

Installing the Neon serverless driver

You can get started with the Neon serverless driver using the deno add command:

deno add @neon/serverless

Or using npm:

npx jsr add @neon/serverless

The above command will generate a deno.json file, listing all your project dependencies:

{
  "imports": {
    "@neon/serverless": "jsr:@neon/serverless^0.9.2"
  }
}

You can then import the serverless driver to your main.ts file:

import { neon } from "@neon/serverless";

// Get the connection string from the environment variable "DATABASE_URL"
const databaseUrl = Deno.env.get("DATABASE_URL")!;

const sql = neon(databaseUrl);
const result = await sql`SELECT 'Hello World' as message`;

// [ { message: "Hello World" } ]

Finally, you can run the following command to execute:

​​deno run -A main.ts

What’s next?

With Neon’s serverless driver on JSR, you can quickly add Postgres to your project and achieve sub-10ms queries, regardless of which JavaScript runtime you’re using.

🚨️ Read more about JSR 🚨️