{"repo":"neondatabase/serverless","free":true,"listed":false,"github":"https://github.com/neondatabase/serverless","clone":"git clone https://github.com/neondatabase/serverless.git","description":"Connect to Neon PostgreSQL from serverless/worker/edge functions","language":"JavaScript","stars":544,"topics":["cloudflare","cloudflare-workers","javascript","neon","pg","postgres","postgresql","postgresql-database","serverless","sql"],"license":"MIT","category":"databases-storage","readme_excerpt":"@neondatabase/serverless @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) Get started Install it Install it with your preferred JavaScript package manager. It's named @neondatabase/serverless on npm and @neon/serverless on JSR. So, for example: or Using TypeScript? No worries: types are included either way. Note: to install with npm for use by another package that declares a dependency on pg (node-postgres), use an alias plus an override, which will look something like this in your package.json : Configure it Get your connection string from the Neon console and set it as an environment variable. Something like: Use it For one-shot queries, use the neon(...) function. For instance: Note: interpolating ${postId} here is safe from SQL injection. There are more details and options for neon() function. Deploy it Turn this example into a complete API endpoint deployed on Vercel Edge Functions at https://myapp.vercel.dev/api/post?postId=123 by following two simple steps: 1. Create a new file api/post.ts : 2. Test and deploy Sessions, transactions, and node-postgres compatibility A query using the neon function, as shown above, is carried by an https fetch request. This should work — and work fast — from any modern JavaScri","default_branch":null,"files":null,"tree":[],"storefront":"/r/neondatabase","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/neondatabase/serverless/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}