Workers with Postgres - recommended ways?
There are a number of ways to connect to Postgres from workers. I wonder what are pros and cons of each.
1. https://developers.cloudflare.com/hyperdrive/
2. https://developers.cloudflare.com/workers/tutorials/postgres/ - requires old
node_compat
mode
3. Data API (for AWS RDS serverless Aurora v1 (and v2 now?)) - uses HTTP. I believe v1 has some scaling limitations and at least some of which are addressed in v2.
In our particular case we are using RDS for prod and staging/dev.Cloudflare Docs
Hyperdrive · Hyperdrive
Hyperdrive is a service that accelerates queries you make to existing databases, making it faster to access your data from across the globe, …
Cloudflare Docs
Connect to a PostgreSQL database with Cloudflare Workers · Cloudfla...
In this tutorial, you will learn how to create a Cloudflare Workers application and connect it to a PostgreSQL database using TCP Sockets. The Workers …
1 Reply
There is also https://github.com/porsager/postgres?tab=readme-ov-file#cloudflare-workers-support which uses the newer node compat instead of the deprecated one, and can be integrated with Hyperdrive if you want