From c40f895bd051fac563b365bdbb4171d1d8c72db0 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin Date: Mon, 10 Mar 2025 15:48:53 -0400 Subject: [PATCH 1/4] Make workers kv and hyperdrive consitent in terms of menu items --- src/content/docs/hyperdrive/index.mdx | 10 ++++++---- .../how-hyperdrive-works.mdx | 0 src/content/docs/hyperdrive/key-concepts/index.mdx | 12 ++++++++++++ src/content/docs/hyperdrive/observability/index.mdx | 2 +- src/content/docs/kv/index.mdx | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) rename src/content/docs/hyperdrive/{configuration => key-concepts}/how-hyperdrive-works.mdx (100%) create mode 100644 src/content/docs/hyperdrive/key-concepts/index.mdx diff --git a/src/content/docs/hyperdrive/index.mdx b/src/content/docs/hyperdrive/index.mdx index d15568ed9fe641b..40b212eaf9e2c18 100644 --- a/src/content/docs/hyperdrive/index.mdx +++ b/src/content/docs/hyperdrive/index.mdx @@ -1,5 +1,5 @@ --- -title: Overview +title: Cloudflare Hyperdrive order: 0 type: overview pcx_content_type: overview @@ -19,7 +19,7 @@ import { RelatedProduct, Tabs, TabItem, - LinkButton + LinkButton, } from "~/components"; @@ -61,8 +61,10 @@ export default { return Response.json({ error: e instanceof Error ? e.message : e }, { status: 500 }); } }, + } satisfies ExportedHandler<{ HYPERDRIVE: Hyperdrive }>; -``` + +```` @@ -86,7 +88,7 @@ export default { } ] } -``` +```` diff --git a/src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx b/src/content/docs/hyperdrive/key-concepts/how-hyperdrive-works.mdx similarity index 100% rename from src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx rename to src/content/docs/hyperdrive/key-concepts/how-hyperdrive-works.mdx diff --git a/src/content/docs/hyperdrive/key-concepts/index.mdx b/src/content/docs/hyperdrive/key-concepts/index.mdx new file mode 100644 index 000000000000000..e57d3a76e8ca10f --- /dev/null +++ b/src/content/docs/hyperdrive/key-concepts/index.mdx @@ -0,0 +1,12 @@ +--- +pcx_content_type: navigation +title: Key concepts +sidebar: + order: 2 + group: + hideIndex: true +--- + +import { DirectoryListing } from "~/components"; + + diff --git a/src/content/docs/hyperdrive/observability/index.mdx b/src/content/docs/hyperdrive/observability/index.mdx index 92fe63038be7ab6..b1c6ce8d4f82c4d 100644 --- a/src/content/docs/hyperdrive/observability/index.mdx +++ b/src/content/docs/hyperdrive/observability/index.mdx @@ -2,7 +2,7 @@ pcx_content_type: navigation title: Observability sidebar: - order: 4 + order: 7 group: hideIndex: true --- diff --git a/src/content/docs/kv/index.mdx b/src/content/docs/kv/index.mdx index 6ee4bfae4187a53..d9e0cbbf86b6f41 100644 --- a/src/content/docs/kv/index.mdx +++ b/src/content/docs/kv/index.mdx @@ -193,7 +193,7 @@ Built on SQLite, D1 is Cloudflare’s first queryable relational database. Creat --- -### More resources +## More resources From 2301d29d6fff923ff27a81aadb76061165f4f453 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin Date: Mon, 10 Mar 2025 15:50:42 -0400 Subject: [PATCH 2/4] Adjust spacing on overview pages --- src/content/docs/hyperdrive/index.mdx | 24 ++++++++--------- src/content/docs/kv/index.mdx | 37 +++++++++++++-------------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/content/docs/hyperdrive/index.mdx b/src/content/docs/hyperdrive/index.mdx index 40b212eaf9e2c18..08d39f3b1379055 100644 --- a/src/content/docs/hyperdrive/index.mdx +++ b/src/content/docs/hyperdrive/index.mdx @@ -49,18 +49,18 @@ export default { // your database via Hyperdrive that can be used with your existing tools const sql = postgres(env.HYPERDRIVE.connectionString); - try { - // Sample SQL query - const results = await sql`SELECT * FROM pg_tables`; - - // Close the client after the response is returned - ctx.waitUntil(sql.end()); - - return Response.json(results); - } catch (e) { - return Response.json({ error: e instanceof Error ? e.message : e }, { status: 500 }); - } - }, + try { + // Sample SQL query + const results = await sql`SELECT * FROM pg_tables`; + + // Close the client after the response is returned + ctx.waitUntil(sql.end()); + + return Response.json(results); + } catch (e) { + return Response.json({ error: e instanceof Error ? e.message : e }, { status: 500 }); + } + }, } satisfies ExportedHandler<{ HYPERDRIVE: Hyperdrive }>; diff --git a/src/content/docs/kv/index.mdx b/src/content/docs/kv/index.mdx index d9e0cbbf86b6f41..33bfbcb22dd1edc 100644 --- a/src/content/docs/kv/index.mdx +++ b/src/content/docs/kv/index.mdx @@ -45,29 +45,28 @@ export default { // write a key-value pair await env.KV_BINDING.put('KEY', 'VALUE'); - // read a key-value pair - const value = await env.KV_BINDING.get('KEY'); - - // list all key-value pairs - const allKeys = await env.KV_BINDING.list(); - - // delete a key-value pair - await env.KV_BINDING.delete('KEY'); - - // return a Workers response - return new Response( - JSON.stringify({ - value: value, - allKeys: allKeys, - }), - ); - }, - + // read a key-value pair + const value = await env.KV_BINDING.get('KEY'); + + // list all key-value pairs + const allKeys = await env.KV_BINDING.list(); + + // delete a key-value pair + await env.KV_BINDING.delete('KEY'); + + // return a Workers response + return new Response( + JSON.stringify({ + value: value, + allKeys: allKeys, + }), + ); + }, } satisfies ExportedHandler<{ KV_BINDING: KVNamespace }>; ``` - + ```json { From 7202613bb52312a465a99dbd704d7f521c04acbb Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Tue, 11 Mar 2025 09:29:28 +0000 Subject: [PATCH 3/4] Replacing internal links, setting up redirect. --- public/_redirects | 3 ++- .../2024-12-11-hyperdrive-caching-at-edge.mdx | 2 +- ...drive-pooling-near-database-and-ip-range-egress.mdx | 2 +- .../hyperdrive/configuration/local-development.mdx | 2 +- .../docs/hyperdrive/configuration/query-caching.mdx | 2 +- src/content/docs/hyperdrive/get-started.mdx | 2 +- src/content/docs/hyperdrive/platform/pricing.mdx | 2 +- .../serverless-timeseries-api-with-timescale/index.mdx | 2 +- src/content/docs/workers/platform/storage-options.mdx | 2 +- .../partials/hyperdrive/create-hyperdrive-config.mdx | 2 +- src/content/release-notes/hyperdrive.yaml | 10 +++++----- 11 files changed, 16 insertions(+), 15 deletions(-) diff --git a/public/_redirects b/public/_redirects index 640ee9791be4a2b..1b2eea4554b55e4 100644 --- a/public/_redirects +++ b/public/_redirects @@ -1679,7 +1679,8 @@ # hyperdrive -/hyperdrive/learning/how-hyperdrive-works/ /hyperdrive/configuration/how-hyperdrive-works/ 301 +/hyperdrive/key-concepts/how-hyperdrive-works/ /hyperdrive/key-concepts/how-hyperdrive-works/ 301 +/hyperdrive/learning/how-hyperdrive-works/ /hyperdrive/key-concepts/how-hyperdrive-works/ 301 /hyperdrive/learning/connect-to-postgres/ /hyperdrive/configuration/connect-to-postgres/ 301 /hyperdrive/learning/query-caching/ /hyperdrive/configuration/query-caching/ 301 /hyperdrive/learning/troubleshooting/ /hyperdrive/reference/troubleshooting/ 301 diff --git a/src/content/changelog/hyperdrive/2024-12-11-hyperdrive-caching-at-edge.mdx b/src/content/changelog/hyperdrive/2024-12-11-hyperdrive-caching-at-edge.mdx index 6cc85e45a894e89..297ec2f89452643 100644 --- a/src/content/changelog/hyperdrive/2024-12-11-hyperdrive-caching-at-edge.mdx +++ b/src/content/changelog/hyperdrive/2024-12-11-hyperdrive-caching-at-edge.mdx @@ -18,4 +18,4 @@ _P50, P75, and P90 Hyperdrive session latency for all client connection sessions This performance improvement is applied to all new and existing Hyperdrive configurations that have caching enabled. -For more details on how Hyperdrive performs query caching, refer to the [Hyperdrive documentation](/hyperdrive/configuration/how-hyperdrive-works/#query-caching). +For more details on how Hyperdrive performs query caching, refer to the [Hyperdrive documentation](/hyperdrive/key-concepts/how-hyperdrive-works/#query-caching). diff --git a/src/content/changelog/hyperdrive/2025-03-04-hyperdrive-pooling-near-database-and-ip-range-egress.mdx b/src/content/changelog/hyperdrive/2025-03-04-hyperdrive-pooling-near-database-and-ip-range-egress.mdx index 1399c9b6ba2fe49..8e9c6a89821ab17 100644 --- a/src/content/changelog/hyperdrive/2025-03-04-hyperdrive-pooling-near-database-and-ip-range-egress.mdx +++ b/src/content/changelog/hyperdrive/2025-03-04-hyperdrive-pooling-near-database-and-ip-range-egress.mdx @@ -14,6 +14,6 @@ By improving placement of Hyperdrive database connection pools, Workers' Smart P With this update, Hyperdrive also uses [Cloudflare's standard IP address ranges](https://www.cloudflare.com/ips/) to connect to your database. This enables you to configure the firewall policies (IP access control lists) of your database to only allow access from Cloudflare and Hyperdrive. -Refer to [documentation on how Hyperdrive makes connecting to regional databases from Cloudflare Workers fast](/hyperdrive/configuration/how-hyperdrive-works/). +Refer to [documentation on how Hyperdrive makes connecting to regional databases from Cloudflare Workers fast](/hyperdrive/key-concepts/how-hyperdrive-works/). This improvement is enabled on all Hyperdrive configurations. diff --git a/src/content/docs/hyperdrive/configuration/local-development.mdx b/src/content/docs/hyperdrive/configuration/local-development.mdx index 9ae649bed84d4e6..42a6c896d894ec6 100644 --- a/src/content/docs/hyperdrive/configuration/local-development.mdx +++ b/src/content/docs/hyperdrive/configuration/local-development.mdx @@ -94,5 +94,5 @@ Refer to the [`wrangler dev` documentation](/workers/wrangler/commands/#dev) to ## Related resources - Use [`wrangler dev`](/workers/wrangler/commands/#dev) to run your Worker and Hyperdrive locally and debug issues before deploying. -- Learn [how Hyperdrive works](/hyperdrive/configuration/how-hyperdrive-works/). +- Learn [how Hyperdrive works](/hyperdrive/key-concepts/how-hyperdrive-works/). - Understand how to [configure query caching in Hyperdrive](/hyperdrive/configuration/query-caching/). diff --git a/src/content/docs/hyperdrive/configuration/query-caching.mdx b/src/content/docs/hyperdrive/configuration/query-caching.mdx index 3d613a14fe680f7..e4865b9d7b496a3 100644 --- a/src/content/docs/hyperdrive/configuration/query-caching.mdx +++ b/src/content/docs/hyperdrive/configuration/query-caching.mdx @@ -73,6 +73,6 @@ const noCachingClient = new Client({ ## Next steps -- Learn more about [How Hyperdrive works](/hyperdrive/configuration/how-hyperdrive-works/). +- Learn more about [How Hyperdrive works](/hyperdrive/key-concepts/how-hyperdrive-works/). - Learn how to [Connect to PostgreSQL](/hyperdrive/configuration/connect-to-postgres/) from Hyperdrive. - Review [Troubleshooting common issues](/hyperdrive/observability/troubleshooting/) when connecting a database to Hyperdrive. diff --git a/src/content/docs/hyperdrive/get-started.mdx b/src/content/docs/hyperdrive/get-started.mdx index 53f247ecb922e34..df8baa9abfb362a 100644 --- a/src/content/docs/hyperdrive/get-started.mdx +++ b/src/content/docs/hyperdrive/get-started.mdx @@ -250,7 +250,7 @@ By finishing this tutorial, you have created a Hyperdrive configuration, a Worke ## Next steps -- Learn more about [how Hyperdrive works](/hyperdrive/configuration/how-hyperdrive-works/). +- Learn more about [how Hyperdrive works](/hyperdrive/key-concepts/how-hyperdrive-works/). - How to [configure query caching](/hyperdrive/configuration/query-caching/). - [Troubleshooting common issues](/hyperdrive/observability/troubleshooting/) when connecting a database to Hyperdrive. diff --git a/src/content/docs/hyperdrive/platform/pricing.mdx b/src/content/docs/hyperdrive/platform/pricing.mdx index f13b4c57e6df375..b51ce4527f8a43f 100644 --- a/src/content/docs/hyperdrive/platform/pricing.mdx +++ b/src/content/docs/hyperdrive/platform/pricing.mdx @@ -8,7 +8,7 @@ sidebar: **Hyperdrive is free and included in every [Workers Paid](/workers/platform/pricing/#workers) plan**. -Hyperdrive is automatically enabled when subscribed to a Workers Paid plan, and does not require you to pay any additional fees to use. Hyperdrive's [connection pooling and query caching](/hyperdrive/configuration/how-hyperdrive-works/) do not incur any additional charges, and there are no hidden limits other than those [published](/hyperdrive/platform/limits/). +Hyperdrive is automatically enabled when subscribed to a Workers Paid plan, and does not require you to pay any additional fees to use. Hyperdrive's [connection pooling and query caching](/hyperdrive/key-concepts/how-hyperdrive-works/) do not incur any additional charges, and there are no hidden limits other than those [published](/hyperdrive/platform/limits/). :::note diff --git a/src/content/docs/hyperdrive/tutorials/serverless-timeseries-api-with-timescale/index.mdx b/src/content/docs/hyperdrive/tutorials/serverless-timeseries-api-with-timescale/index.mdx index bd3d0c12ffc8eed..88c374f93d45c45 100644 --- a/src/content/docs/hyperdrive/tutorials/serverless-timeseries-api-with-timescale/index.mdx +++ b/src/content/docs/hyperdrive/tutorials/serverless-timeseries-api-with-timescale/index.mdx @@ -286,6 +286,6 @@ In this tutorial, you have learned how to create a working example to ingest and ## Next steps -- Learn more about [How Hyperdrive Works](/hyperdrive/configuration/how-hyperdrive-works/). +- Learn more about [How Hyperdrive Works](/hyperdrive/key-concepts/how-hyperdrive-works/). - Learn more about [Timescale](https://timescale.com). - Refer to the [troubleshooting guide](/hyperdrive/observability/troubleshooting/) to debug common issues. diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index 45aa2b104934a75..14ef7da236dfdd0 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -168,7 +168,7 @@ Hyperdrive allows you to: To get started with Hyperdrive: - [Connect Hyperdrive](/hyperdrive/get-started/) to your existing database. -- Learn more [about how Hyperdrive speeds up your database queries](/hyperdrive/configuration/how-hyperdrive-works/). +- Learn more [about how Hyperdrive speeds up your database queries](/hyperdrive/key-concepts/how-hyperdrive-works/). ## Analytics Engine diff --git a/src/content/partials/hyperdrive/create-hyperdrive-config.mdx b/src/content/partials/hyperdrive/create-hyperdrive-config.mdx index 9a329ba1e81f710..a21b1785a0f6507 100644 --- a/src/content/partials/hyperdrive/create-hyperdrive-config.mdx +++ b/src/content/partials/hyperdrive/create-hyperdrive-config.mdx @@ -102,6 +102,6 @@ export default { ## Next steps -- Learn more about [How Hyperdrive Works](/hyperdrive/configuration/how-hyperdrive-works/). +- Learn more about [How Hyperdrive Works](/hyperdrive/key-concepts/how-hyperdrive-works/). - Refer to the [troubleshooting guide](/hyperdrive/observability/troubleshooting/) to debug common issues. - Understand more about other [storage options](/workers/platform/storage-options/) available to Cloudflare Workers. \ No newline at end of file diff --git a/src/content/release-notes/hyperdrive.yaml b/src/content/release-notes/hyperdrive.yaml index fcac6a0a1ff90ab..09c8f0fd3cff23f 100644 --- a/src/content/release-notes/hyperdrive.yaml +++ b/src/content/release-notes/hyperdrive.yaml @@ -8,9 +8,9 @@ entries: - publish_date: "2025-03-07" title: Hyperdrive connects to your database using Cloudflare's IP address ranges description: |- - Hyperdrive now uses [Cloudflare's IP address ranges](https://www.cloudflare.com/ips/) for egress. + Hyperdrive now uses [Cloudflare's IP address ranges](https://www.cloudflare.com/ips/) for egress. - This enables you to configure the firewall policies on your database to allow access to this limited IP address range. + This enables you to configure the firewall policies on your database to allow access to this limited IP address range. Learn more about [configuring your database networking for Hyperdrive](/hyperdrive/configuration/firewall-and-networking-configuration/). - publish_date: "2025-03-07" @@ -34,7 +34,7 @@ entries: description: |- Hyperdrive query caching now happens in all locations where Hyperdrive can be accessed. When making a query in a location that has cached the query result, your latency may be decreased by up to 90%. - Refer to [documentation on how Hyperdrive caches query results](/hyperdrive/configuration/how-hyperdrive-works/#query-caching). + Refer to [documentation on how Hyperdrive caches query results](/hyperdrive/key-concepts/how-hyperdrive-works/#query-caching). - publish_date: "2024-11-19" title: Hyperdrive now supports clear-text password authentication description: |- @@ -44,13 +44,13 @@ entries: - publish_date: "2024-10-30" title: New Hyperdrive configurations to private databases using Tunnels are validated before creation description: |- - When creating a new Hyperdrive configuration to a private database using Tunnels, Hyperdrive will verify that it can connect to the database to ensure that your Tunnel and Access application have been properly configured. This makes it easier to debug connectivity issues. + When creating a new Hyperdrive configuration to a private database using Tunnels, Hyperdrive will verify that it can connect to the database to ensure that your Tunnel and Access application have been properly configured. This makes it easier to debug connectivity issues. Refer to [documentation on connecting to private databases](/hyperdrive/configuration/connect-to-private-database/) for more information. - publish_date: "2024-09-20" title: The `node-postgres` (pg) driver is now supported for Pages applications using Hyperdrive. description: |- - The popular `pg` ([node-postgres](https://github.com/brianc/node-postgres) driver no longer requires the legacy `node_compat` mode, and can now be used in both Workers and Pages for connecting to Hyperdrive. This uses the new (improved) Node.js compatibility in Workers and Pages. + The popular `pg` ([node-postgres](https://github.com/brianc/node-postgres) driver no longer requires the legacy `node_compat` mode, and can now be used in both Workers and Pages for connecting to Hyperdrive. This uses the new (improved) Node.js compatibility in Workers and Pages. You can set [`compatibility_flags = ["nodejs_compat_v2"]`](/workers/runtime-apis/nodejs/) in your `wrangler.toml` or via the Pages dashboard to benefit from this change. Visit the [Hyperdrive documentation on supported drivers](/hyperdrive/configuration/connect-to-postgres/#supported-drivers) to learn more about the driver versions supported by Hyperdrive. - publish_date: "2024-08-19" From ebae615a349e34ac396c7e8ad23e5a1370311fb9 Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Tue, 11 Mar 2025 10:57:06 +0000 Subject: [PATCH 4/4] Fixing circular redirect --- public/_redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/_redirects b/public/_redirects index 1b2eea4554b55e4..875b73336ef1a28 100644 --- a/public/_redirects +++ b/public/_redirects @@ -1679,7 +1679,7 @@ # hyperdrive -/hyperdrive/key-concepts/how-hyperdrive-works/ /hyperdrive/key-concepts/how-hyperdrive-works/ 301 +/hyperdrive/configuration/how-hyperdrive-works/ /hyperdrive/key-concepts/how-hyperdrive-works/ 301 /hyperdrive/learning/how-hyperdrive-works/ /hyperdrive/key-concepts/how-hyperdrive-works/ 301 /hyperdrive/learning/connect-to-postgres/ /hyperdrive/configuration/connect-to-postgres/ 301 /hyperdrive/learning/query-caching/ /hyperdrive/configuration/query-caching/ 301