Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evanshortiss/neon-and-long-running-apps
An application that demonstrates how to safely configure your database client to reconnect if Neon auto-suspend is enabled.
https://github.com/evanshortiss/neon-and-long-running-apps
Last synced: 21 days ago
JSON representation
An application that demonstrates how to safely configure your database client to reconnect if Neon auto-suspend is enabled.
- Host: GitHub
- URL: https://github.com/evanshortiss/neon-and-long-running-apps
- Owner: evanshortiss
- Created: 2024-01-19T18:49:44.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-01T21:26:29.000Z (10 months ago)
- Last Synced: 2024-04-09T13:09:28.585Z (7 months ago)
- Language: TypeScript
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Neon's Serverless Postgres and Long-Running Applications
This repository is a companion to this [post on the Neon blog](https://neon.tech/blog/using-neons-auto-suspend-with-long-running-applications).
Built using Fastify, HTMX, and Drizzle, this application demonstrates how you
can use [Neon's Serverless Postrges auto-suspend](https://neon.tech/docs/introduction/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/.
1. Copy `.env.example` to a file named `.env`, and replace `DATABASE_URL` your database's [connection string](https://neon.tech/docs/connect/connect-from-any-app).
1. Initialise the database with a schema and some data:
```bash
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:
```bash
npm run dev
```The application will start listening on http://localhost:8080/.