Skip to main content
Neon is a fully managed serverless Postgres. Neon separates compute and storage to offer modern developer features such as autoscaling, branching, bottomless storage, and more.
Get started by creating a project directory, initializing the directory using bun init, and adding the Neon serverless driver as a project dependency.
terminal

Create a .env.local file and add your Neon Postgres connection string to it.
.env.local

Paste the following code into your project’s index.ts file.
index.ts

Start the program using bun ./index.ts. The Postgres version should be printed to the console.
terminal

This example used the Neon serverless driver’s SQL-over-HTTP functionality. Neon’s serverless driver also exposes Client and Pool constructors to enable sessions, interactive transactions, and node-postgres compatibility. Refer to Neon’s documentation for a complete overview of the serverless driver.