Neon
Neon ↗ is a fully managed serverless PostgreSQL. It separates storage and compute to offer modern developer features, such as serverless, branching, and bottomless storage.
Database Integrations allow you to connect to a database from your Worker by getting the right configuration from your database provider and adding it as secrets to your Worker.
To set up an integration with Neon:
-
You need to have an existing Neon database to connect to. Create a Neon database ↗ or load data from an existing database to Neon ↗.
-
Create an
elements
table using the Neon SQL editor. The SQL Editor allows you to query your databases directly from the Neon Console. -
Insert some data into your newly created table.
-
Add the Neon database integration to your Worker:
- Log in to the Cloudflare dashboard ↗ and select your account.
- In Account Home, select Workers & Pages.
- In Overview, select your Worker.
- Select Integrations > Neon.
- Follow the setup flow, selecting the database created in step 1.
-
In your Worker, install the
@neondatabase/serverless
driver to connect to your database and start manipulating data: -
The following example shows how to make a query to your Neon database in a Worker. The credentials needed to connect to Neon have been automatically added as secrets to your Worker through the integration.
To learn more about Neon, refer to Neon's official documentation ↗.