Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-postgres-index-connect-to-a-postgresql-database-with-cloudflare-workflow-guide.mdA 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-.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textSQL 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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