Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/lychee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
--scheme http
--scheme https
--exclude '^https?://local\.invalid/'
--exclude '^https?://localhost'
--exclude 'https://www.gnu.org'
--exclude 'https://docs.solidjs.com'
--accept 200,201,204,301,302,303,307,308,403,429
Expand Down Expand Up @@ -77,6 +78,7 @@ jobs:
--scheme http
--scheme https
--exclude '^https?://local\.invalid/'
--exclude '^https?://localhost'
--exclude 'https://www.gnu.org'
--exclude 'https://docs.solidjs.com'
--accept 200,201,204,301,302,303,307,308,403,429
Expand Down
14 changes: 9 additions & 5 deletions apps/docs/content/docs/accelerate/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ metaTitle: Prisma Accelerate
metaDescription: Prisma Accelerate is a global database cache with built-in connection pooling that helps improve database performance in Serverless and Edge applications.
---

[Prisma Accelerate](https://www.prisma.io/accelerate) is a fully managed global connection pool and caching layer for your existing database, enabling query-level cache policies directly from the Prisma ORM.
[Prisma Accelerate](https://www.prisma.io/accelerate) is a managed connection pool and global cache for your database. It works with Prisma ORM and supports PostgreSQL, MySQL, MongoDB, and more.

With 15+ global regions, the connection pool scales your app for a global audience, particularly for serverless deployments that risk connection timeouts during peak times.
Prisma ORM supports connection pooling and query caching through Accelerate — you don't need a separate pooler or caching layer. Accelerate is included with [Prisma Postgres](/postgres) and also available as a standalone add-on for external databases.

Accelerate's global cache, hosted in 300+ locations, ensures a fast experience for users, regardless of your database's location.
**Connection pooling.** Accelerate manages a global connection pool across 15+ regions. This matters most in serverless and edge environments, where connection exhaustion is a real failure mode. Prisma ORM routes through the pool automatically once you swap in the Accelerate connection string.

You can configure query-level caching strategies directly in your code with Prisma ORM, making setup and tuning easy.
**Query caching.** Add a `cacheStrategy` to any Prisma ORM query to cache results at the edge using TTL or stale-while-revalidate. Results are served from 300+ cache locations. No Redis, no Memcached, no separate service.

Together, the connection pool and cache allow you to scale effortlessly and handle traffic spikes without infrastructure concerns.
```typescript title="src/lib/posts.ts"
const posts = await prisma.post.findMany({
cacheStrategy: { ttl: 60, swr: 10 }, // serve from cache for 60s (TTL); after TTL expires, serve stale for up to 10s while revalidating in the background (SWR)
})
```

## Supported databases

Expand Down
29 changes: 15 additions & 14 deletions apps/docs/content/docs/guides/deployment/cloudflare-workers.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
---
title: Cloudflare Workers
description: Learn how to use Prisma ORM in a Cloudflare Workers project
description: Learn how to use Prisma ORM and Prisma Postgres in a Cloudflare Workers project
image: /img/guides/prisma-cloudflare-workers-cover.png
url: /guides/deployment/cloudflare-workers
metaTitle: How to use Prisma ORM and Prisma Postgres with Cloudflare Workers
metaDescription: Learn how to use Prisma ORM in a Cloudflare Workers project
metaDescription: Prisma Postgres works on Cloudflare Workers. Standard PostgreSQL clients use TCP which Cloudflare Workers doesn't support, but Prisma Postgres solves this via Node.js compatibility mode. This guide shows how to set it up.
---

## Introduction

Prisma ORM provides type-safe database access, and [Cloudflare Workers](https://workers.cloudflare.com/) enables you to deploy serverless code at the edge. Together with [Prisma Postgres](https://www.prisma.io/postgres), you get a globally distributed backend with low-latency database access.
**Yes, Prisma Postgres works on Cloudflare Workers.**

In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres database in a Cloudflare Workers project. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/cloudflare-workers).
Standard PostgreSQL clients (like `pg` or `postgres.js`) use TCP connections, and Cloudflare Workers doesn't support TCP by default. That's why most Postgres databases can't be accessed directly from Workers. There are two ways around it with Prisma Postgres:

1. **Node.js compatibility mode** — add the `nodejs_compat` flag to your `wrangler.jsonc` and Prisma ORM can use TCP via Cloudflare's Node.js TCP API. That's what this guide does.
2. **Serverless HTTP driver** — the [`@prisma/ppg` driver](/postgres/database/serverless-driver) connects over HTTP instead of TCP. No compatibility flag needed.

This guide uses the `nodejs_compat` approach. Prisma Postgres handles connection pooling, so you don't have to worry about Workers spinning up a new connection per request.

You can find a complete example on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/cloudflare-workers).

## Prerequisites

Expand Down Expand Up @@ -399,10 +406,6 @@ Once deployed, Cloudflare will provide you with a URL where your Worker is live

Visit the URL in your browser, and you'll see your Worker creating users in production!

## Summary

You've successfully created a Cloudflare Workers application with Prisma ORM connected to a Prisma Postgres database. Your Worker is now running at the edge with low-latency database access.

## Next steps

Now that you have a working Cloudflare Workers app connected to a Prisma Postgres database, you can:
Expand All @@ -411,9 +414,7 @@ Now that you have a working Cloudflare Workers app connected to a Prisma Postgre
- Extend your Prisma schema with more models and relationships
- Implement authentication and authorization
- Use [Hono](https://hono.dev/) for a more robust routing framework with Cloudflare Workers (see our [Hono guide](/guides/frameworks/hono))

### More info

- [Prisma Documentation](/orm)
- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)
- [Deploy to Cloudflare](/orm/prisma-client/deployment/edge/deploy-to-cloudflare)
- Use the [`@prisma/ppg` serverless driver](/postgres/database/serverless-driver) to connect over HTTP instead of TCP — no `nodejs_compat` flag needed
- [Deploy to Cloudflare](/orm/prisma-client/deployment/edge/deploy-to-cloudflare) — deeper reference on edge deployment options
- [Cloudflare Workers documentation](https://developers.cloudflare.com/workers/)
- [Prisma ORM documentation](/orm)
11 changes: 10 additions & 1 deletion apps/docs/content/docs/postgres/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ metaTitle: Overview | Prisma Postgres
metaDescription: Learn everything you need to know about Prisma Postgres.
---

[Prisma Postgres](https://www.prisma.io/postgres?utm_source=docs) is a managed PostgreSQL service built for modern app development.
[Prisma Postgres](https://www.prisma.io/postgres?utm_source=docs) is a managed PostgreSQL database with built-in connection pooling, query caching, and edge runtime support.
Use this page to choose a connection path and get started quickly.

## What's included

Everything below is included with every Prisma Postgres database. No extra services to configure.

- **Connection pooling** — A dedicated PgBouncer instance runs alongside your database. You don't need to set one up or manage it. Works automatically for serverless and edge deployments. See [Connection pooling](/postgres/database/connection-pooling).
- **Query caching** — Add a `cacheStrategy` to any Prisma ORM query to cache results at the edge, using TTL or stale-while-revalidate. See [Caching](/accelerate/caching).
- **Edge and serverless support** — Connect from Cloudflare Workers, Vercel Edge Functions, and other edge runtimes via the [serverless driver](/postgres/database/serverless-driver), which uses HTTP instead of TCP.
- **Automated backups** — Daily backups with point-in-time recovery. See [Backups](/postgres/database/backups).

## Getting started

### Create a database
Expand Down
Loading