cloudflare · Cloudflare Workers Docs
Index Connect to a PostgreSQL database with Cloudflare Workers
A step-by-step tutorial for setting up a Cloudflare Workers application that connects to a PostgreSQL database using TCP Sockets and Hyperdrive, including Node.js compatibility configuration and connection string setup.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Index Connect to a PostgreSQL database with Cloudflare Workers
A step-by-step tutorial for setting up a Cloudflare Workers application that connects to a PostgreSQL database using TCP Sockets and Hyperdrive, including Node.js compatibility configuration and connection string setup.
When To Use
Use when you need to implement a workflow for connecting a Cloudflare Worker to a PostgreSQL database using Hyperdrive and TCP Sockets.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare-workflow-guide.md | A tutorial guide for creating a Cloudflare Workers application that connects to a PostgreSQL database using TCP Sockets and Hyperdrive. | Questions about a tutorial guide for creating a Cloudflare Workers application that connects to a PostgreSQL database using TCP Socke... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare-.text | A text-based guide and command sequence for initializing a Cloudflare Workers project to connect to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text-based guide and command sequence for initializing a Cloudflare Workers project to connect to a PostgreSQL data... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--2.text | A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using the postgres-tutorial starter. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using the postgres-tut... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--3.text | A text-based guide outlining the initial setup steps for connecting Cloudflare Workers to a PostgreSQL database using the pnpm create command. | Exact payloads, commands, or snippets shown in A text-based guide outlining the initial setup steps for connecting Cloudflare Workers to a PostgreSQL database using... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--4.text | A text-based guide outlining the initial setup steps for connecting Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text-based guide outlining the initial setup steps for connecting Cloudflare Workers to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--5.text | A configuration file demonstrating the compatibility flags and settings required to connect Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A configuration file demonstrating the compatibility flags and settings required to connect Cloudflare Workers to a P... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--6.text | A text configuration snippet showing the required compatibility flags and compatibility date for connecting Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text configuration snippet showing the required compatibility flags and compatibility date for connecting Cloudflar... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--7.text | A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using the pg library. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using the pg library. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--8.text | A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using the pg library. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using the pg library. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--9.text | A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using the pg library. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using the pg library. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--10.text | A step-by-step guide and command sequence for connecting Cloudflare Workers to a PostgreSQL database using the pg library. | Exact payloads, commands, or snippets shown in A step-by-step guide and command sequence for connecting Cloudflare Workers to a PostgreSQL database using the pg lib... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--11.text | A text-based guide outlining the steps to connect Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect Cloudflare Workers to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--12.text | A text-based guide outlining the steps to connect Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect Cloudflare Workers to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--13.text | A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--14.text | A text-based guide outlining the steps to connect Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect Cloudflare Workers to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--15.text | A text file containing a sample PostgreSQL connection URI format used to connect Cloudflare Workers to a database. | Exact payloads, commands, or snippets shown in A text file containing a sample PostgreSQL connection URI format used to connect Cloudflare Workers to a database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--16.text | A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using environment variables. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect a Cloudflare Worker to a PostgreSQL database using environment vari... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--17.text | A text-based guide outlining the steps to configure a database URL secret using the Wrangler CLI for Cloudflare Workers PostgreSQL connectivity. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to configure a database URL secret using the Wrangler CLI for Cloudflare Worke... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--18.text | A text snippet demonstrating how to define the DB_URL environment variable for connecting a Cloudflare Worker to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text snippet demonstrating how to define the DBURL environment variable for connecting a Cloudflare Worker to a Pos... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--19.text | A configuration object containing database credentials and connection parameters for connecting a Cloudflare Worker to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A configuration object containing database credentials and connection parameters for connecting a Cloudflare Worker t... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--20.text | A text file containing database connection variables including host, port, username, and database name for connecting Cloudflare Workers to a PostgreSQL instance. | Exact payloads, commands, or snippets shown in A text file containing database connection variables including host, port, username, and database name for connecting... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--21.text | A text-based guide outlining the steps to connect Cloudflare Workers to a PostgreSQL database using wrangler secrets. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect Cloudflare Workers to a PostgreSQL database using wrangler secrets. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--22.text | A step-by-step tutorial guide for connecting Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A step-by-step tutorial guide for connecting Cloudflare Workers to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--23.text | A JavaScript code example demonstrating how to use the pg client to connect to a PostgreSQL database within a Cloudflare Worker. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the pg client to connect to a PostgreSQL database within a Cloudfl... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--24.text | A JavaScript code example demonstrating how to instantiate and connect to a PostgreSQL database using a connection string within a Cloudflare Worker. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to instantiate and connect to a PostgreSQL database using a connection st... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--25.text | A JavaScript code snippet demonstrating how to instantiate and connect to a PostgreSQL database using a Client instance within a Cloudflare Worker. | Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating how to instantiate and connect to a PostgreSQL database using a Client instan... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--26.text | SQL commands to create a products table for connecting a Cloudflare Worker to a PostgreSQL database. | Exact payloads, commands, or snippets shown in SQL commands to create a products table for connecting a Cloudflare Worker to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--27.text | A JavaScript code example demonstrating how to connect to a PostgreSQL database from a Cloudflare Worker using the pg client library. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to connect to a PostgreSQL database from a Cloudflare Worker using the pg... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--28.text | A step-by-step guide and command sequence for connecting a Cloudflare Worker to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A step-by-step guide and command sequence for connecting a Cloudflare Worker to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--29.text | A JavaScript code example demonstrating how to connect to a PostgreSQL database from a Cloudflare Worker using the pg client library. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to connect to a PostgreSQL database from a Cloudflare Worker using the pg... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--30.text | A text-based example demonstrating how to connect a Cloudflare Worker to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text-based example demonstrating how to connect a Cloudflare Worker to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--31.text | A command-line example demonstrating how to create a Hyperdrive configuration using a PostgreSQL connection string via Wrangler. | Exact payloads, commands, or snippets shown in A command-line example demonstrating how to create a Hyperdrive configuration using a PostgreSQL connection string vi... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--32.text | A wrangler.toml configuration file demonstrating how to bind a Hyperdrive instance to a Cloudflare Worker for PostgreSQL connectivity. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file demonstrating how to bind a Hyperdrive instance to a Cloudflare Worker for Postgre... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--33.text | A wrangler.toml configuration file demonstrating Hyperdrive binding setup for connecting Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file demonstrating Hyperdrive binding setup for connecting Cloudflare Workers to a Post... |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--34.text | A text-based guide and command overview for connecting Cloudflare Workers to a PostgreSQL database. | Exact payloads, commands, or snippets shown in A text-based guide and command overview for connecting Cloudflare Workers to a PostgreSQL database. |
examples/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare--35.text | A JavaScript code example demonstrating how to connect a Cloudflare Worker to a PostgreSQL database using a connection string. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to connect a Cloudflare Worker to a PostgreSQL database using a connectio... |
What This Skill Covers
- In this tutorial, you will learn how to create a Cloudflare Workers application and connect it to a PostgreSQL database using TCP Sockets and Hyperdrive. The...
- Main sections:
Tags,Prerequisites,1\. Create a Worker application,Enable Node.js compatibility,2\. Add the PostgreSQL connection library.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/tutorials/postgres/index.md
