Skip to content

evanshortiss/neon-and-long-running-apps

Repository files navigation

Neon's Serverless Postgres and Long-Running Applications

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.

Usage

Initial Setup

  1. Create a project at https://console.neon.tech/.
  2. Copy .env.example to a file named .env, and replace DATABASE_URL your database's connection string.
  3. Initialise the database with a schema and some data:
    npm i
    npm run drizzle:generate
    npm run drizzle:push
    npm run seed

Dev Mode

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/.

About

An application that demonstrates how to safely configure your database client to reconnect if Neon auto-suspend is enabled.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published