This repository is a companion to this post on the Neon blog.
Built using Fastify, HTMX, and Drizzle, this application demonstrates how you can use Neon's Serverless Postrges auto-suspend feature with a long-running Node.js application. The techniques used can be applied to other runtimes and Postgres drivers.
- Create a project at https://console.neon.tech/.
- Copy
.env.example
to a file named.env
, and replaceDATABASE_URL
your database's connection string. - Initialise the database with a schema and some data:
npm i npm run drizzle:generate npm run drizzle:push npm run seed
To start the application in development mode with hot reload via nodemon
use:
npm run dev
The application will start listening on http://localhost:8080/.