Skip to main content
Neon is a fully managed serverless Postgres. Neon separates compute and storage to offer features such as autoscaling, branching, and bottomless storage.
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.
https://mintcdn.com/bun-1dd33a4e/JUhaF6Mf68z_zHyy/icons/typescript.svg?fit=max&auto=format&n=JUhaF6Mf68z_zHyy&q=85&s=7ac549adaea8d5487d8fbd58cc3ea35bindex.ts

Start the program with bun ./index.ts. It prints the Postgres version 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.