You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/connection-pooling.md
+68-4Lines changed: 68 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,77 @@ description: Scale your serverless functions
14
14
15
15
Production Redwood apps should enable connection pooling in order to properly scale with your Serverless functions.
16
16
17
-
## Prisma Data Proxy
17
+
## Prisma Postgres
18
18
19
-
The [Prisma Data Proxy](https://www.prisma.io/docs/data-platform/data-proxy) provides database connection management and pooling for Redwood apps using Prisma. It supports MySQL and Postgres databases in either the U.S. or EU regions.
19
+
[Prisma Postgres](https://www.prisma.io/docs/postgres/introduction/overview?utm_source=redwoodjs_docs&utm_medium=docs) is a managed PostgreSQL database service that includes:
20
20
21
-
To set up a Prisma Data Proxy, sign up for the [Prisma Data Platform](https://www.prisma.io/data-platform) for free. In your onboarding workflow, plug in the connection URL for your database and choose your region. This will generate a connection string for your app. Then follow the instructions in [Prisma's documentation](https://www.prisma.io/docs/concepts/data-platform/data-proxy).
21
+
-**Built-in connection pooling**: No need to configure external pooling services
22
+
-**Global caching**: Query-level caching with TTL and Stale-While-Revalidate strategies
23
+
-**Serverless optimization**: Designed specifically for serverless and edge applications
24
+
-**Easy setup**: Get started in minutes with minimal configuration
22
25
23
-
> Note that the example uses npm. Rather than using npm, you can access the Prisma CLI using `yarn redwood prisma` inside a Redwood app.
26
+
Prisma Postgres supports schema migrations and queries via Prisma ORM, and automatically handles connection pooling and caching.
27
+
28
+
To get started with Prisma Postgres, visit the [Prisma Postgres documentation](https://www.prisma.io/docs/postgres/introduction/overview?utm_source=redwoodjs_docs&utm_medium=docs).
29
+
30
+
### Local Prisma Postgres
31
+
32
+
For local development, you can use [local Prisma Postgres](https://www.prisma.io/docs/postgres/database/local-development?utm_source=redwoodjs_docs&utm_medium=docs) which runs a PostgreSQL-compatible database locally. This eliminates the need to install and manage PostgreSQL locally while maintaining full compatibility with production PostgreSQL databases.
33
+
34
+
:::note
35
+
36
+
To use Local Prisma Postgres, you do not need to create an account or install PostgreSQL locally.
37
+
38
+
:::
39
+
40
+
First, update your Prisma schema to use PostgreSQL as the provider:
41
+
42
+
```graphql title="api/db/schema.prisma"
43
+
datasourcedb {
44
+
provider = "postgresql"
45
+
url = env("DATABASE_URL")
46
+
}
47
+
```
48
+
49
+
Start the local Prisma Postgres server:
50
+
51
+
```bash
52
+
npx prisma dev
53
+
```
54
+
55
+
The server will start and display connection options. Press `t` to get the TCP connection URL for standard PostgreSQL connections, or press `h` if you're planning to use Prisma Postgres in production (which requires the [Prisma Client extension](https://www.prisma.io/docs/postgres/introduction/overview#using-the-client-extension-for-prisma-accelerate-required)).
56
+
57
+
If you're using any other provider for PostgreSQL, use the TCP connection URL in your `.env` file:
58
+
59
+
```env
60
+
DATABASE_URL="postgresql://localhost:54322/main"
61
+
```
62
+
63
+
Keep the server running while performing migrations and using the database for local development.
64
+
65
+
### Temporary Prisma Postgres database
66
+
67
+
For quick testing or prototyping, [Prisma Postgres](https://www.prisma.io/postgres) offers temporary production-ready databases that also requires no setup or accounts. Use [`npx create-db`](https://www.prisma.io/docs/postgres/introduction/npx-create-db?utm_source=redwoodjs_docs&utm_medium=docs) to create a database that's automatically deleted after 24 hours:
68
+
69
+
```bash
70
+
npx create-db@latest
71
+
```
72
+
73
+
This provides both Prisma ORM-optimized and standard PostgreSQL connection strings. You can also claim the database to make it permanent if needed.
74
+
75
+
## Prisma ORM & Prisma Accelerate
76
+
77
+
If you're already using another database provider (like Supabase, Heroku, Digital Ocean, or AWS RDS), you can add connection pooling and caching to your existing setup using [Prisma Accelerate](https://www.prisma.io/docs/accelerate).
78
+
79
+
Prisma Accelerate is a fully managed global connection pool and caching layer that works with your existing database. It provides:
80
+
81
+
-**Connection pooling**: Efficiently manages database connections across 15+ global regions
82
+
-**Global caching**: Hosted in 300+ locations for fast user experiences
83
+
-**Query-level caching**: Configure caching strategies directly in your Prisma ORM code
84
+
-**Serverless scaling**: Handles traffic spikes without infrastructure concerns
85
+
-**Database compatibility**: Works with publicly accessible databases or those behind IP allowlists
86
+
87
+
To enable Prisma Accelerate with your existing database, visit the [Prisma Accelerate documentation](https://www.prisma.io/docs/accelerate).
Copy file name to clipboardExpand all lines: docs/docs/local-postgres-setup.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,48 @@ brew install postgresql@14
24
24
25
25
### Windows and Other Platforms
26
26
27
-
If you're using another platform, see Prisma's [Data Guide](https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database) for detailed instructions on how to get up and running.
27
+
If you're using another platform, see Prisma's [Data Guide](https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database?utm_source=redwoodjs_docs&utm_medium=docs) for detailed instructions on how to get up and running.
28
+
29
+
## Alternatives to local PostgreSQL Installation
30
+
31
+
### Local Prisma Postgres
32
+
33
+
For local development, you can use [local Prisma Postgres](https://www.prisma.io/docs/postgres/database/local-development?utm_source=redwoodjs_docs&utm_medium=docs) which runs a PostgreSQL-compatible database locally. This eliminates the need to install and manage PostgreSQL locally while maintaining full compatibility with production PostgreSQL databases.
34
+
35
+
First, update your Prisma schema to use PostgreSQL as the provider:
36
+
37
+
```graphql title="api/db/schema.prisma"
38
+
datasourcedb {
39
+
provider = "postgresql"
40
+
url = env("DATABASE_URL")
41
+
}
42
+
```
43
+
44
+
Start the local Prisma Postgres server:
45
+
46
+
```bash
47
+
npx prisma dev
48
+
```
49
+
50
+
The server will start and display connection options. Press `t` to get the TCP connection URL for standard PostgreSQL connections, or press `h` if you're planning to use Prisma Postgres in production (which requires the [Prisma Client extension](https://www.prisma.io/docs/postgres/introduction/overview#using-the-client-extension-for-prisma-accelerate-required)).
51
+
52
+
If you're using any other provider for PostgreSQL, use the TCP connection URL in your `.env` file:
53
+
54
+
```env
55
+
DATABASE_URL="postgresql://localhost:54322/main"
56
+
```
57
+
58
+
Keep the server running while performing migrations and using the database for local development.
59
+
60
+
### Temporary Prisma Postgres database
61
+
62
+
For quick testing or prototyping, [Prisma Postgres](https://www.prisma.io/postgres?utm_source=redwoodjs_docs&utm_medium=docs) offers temporary production-ready databases that require no setup or accounts. Use [`npx create-db`](https://www.prisma.io/docs/postgres/introduction/npx-create-db?utm_source=redwoodjs_docs&utm_medium=docs) to create a database that's automatically deleted after 24 hours:
63
+
64
+
```bash
65
+
npx create-db@latest
66
+
```
67
+
68
+
This provides both Prisma ORM-optimized and standard PostgreSQL connection strings. You can also claim the database to make it permanent if needed.
Copy file name to clipboardExpand all lines: docs/versioned_docs/version-0.x/connection-pooling.md
+54-4Lines changed: 54 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,63 @@ description: Scale your serverless functions
14
14
15
15
Production Redwood apps should enable connection pooling in order to properly scale with your Serverless functions.
16
16
17
-
## Prisma Data Proxy
17
+
## Prisma Postgres
18
18
19
-
The [Prisma Data Proxy](https://www.prisma.io/docs/data-platform/data-proxy) provides database connection management and pooling for Redwood apps using Prisma. It supports MySQL and Postgres databases in either the U.S. or EU regions.
19
+
[Prisma Postgres](https://www.prisma.io/docs/postgres/introduction/overview?utm_source=redwoodjs_docs&utm_medium=docs) is a managed PostgreSQL database service that includes:
20
20
21
-
To set up a Prisma Data Proxy, sign up for the [Prisma Data Platform](https://www.prisma.io/data-platform) for free. In your onboarding workflow, plug in the connection URL for your database and choose your region. This will generate a connection string for your app. Then follow the instructions in [Prisma's documentation](https://www.prisma.io/docs/concepts/data-platform/data-proxy).
21
+
-**Built-in connection pooling**: No need to configure external pooling services
22
+
-**Global caching**: Query-level caching with TTL and Stale-While-Revalidate strategies
23
+
-**Serverless optimization**: Designed specifically for serverless and edge applications
24
+
-**Easy setup**: Get started in minutes with minimal configuration
22
25
23
-
> Note that the example uses npm. Rather than using npm, you can access the Prisma CLI using `yarn redwood prisma` inside a Redwood app.
26
+
Prisma Postgres supports schema migrations and queries via Prisma ORM, and automatically handles connection pooling and caching.
27
+
28
+
To get started with Prisma Postgres, visit the [Prisma Postgres documentation](https://www.prisma.io/docs/postgres/introduction/overview?utm_source=redwoodjs_docs&utm_medium=docs).
29
+
30
+
### Local Prisma Postgres
31
+
32
+
For local development, you can use [local Prisma Postgres](https://www.prisma.io/docs/postgres/database/local-development?utm_source=redwoodjs_docs&utm_medium=docs) which runs a PostgreSQL-compatible database locally. This eliminates the need to install and manage PostgreSQL locally while maintaining full compatibility with production PostgreSQL databases.
33
+
34
+
:::note
35
+
36
+
To use Local Prisma Postgres, you do not need to create an account or install PostgreSQL locally.
37
+
38
+
:::
39
+
40
+
First, update your Prisma schema to use PostgreSQL as the provider:
41
+
42
+
```graphql title="api/db/schema.prisma"
43
+
datasourcedb {
44
+
provider = "postgresql"
45
+
url = env("DATABASE_URL")
46
+
}
47
+
```
48
+
49
+
Start the local Prisma Postgres server:
50
+
51
+
```bash
52
+
npx prisma dev
53
+
```
54
+
55
+
The server will start and display connection options. Press `t` to get the TCP connection URL for standard PostgreSQL connections, or press `h` if you're planning to use Prisma Postgres in production (which requires the [Prisma Client extension](https://www.prisma.io/docs/postgres/introduction/overview#using-the-client-extension-for-prisma-accelerate-required)).
56
+
57
+
If you're using any other provider for PostgreSQL, use the TCP connection URL in your `.env` file:
58
+
59
+
```env
60
+
DATABASE_URL="postgresql://localhost:54322/main"
61
+
```
62
+
63
+
Keep the server running while performing migrations and using the database for local development.
64
+
65
+
### Temporary Prisma Postgres database
66
+
67
+
For quick testing or prototyping, [Prisma Postgres](https://www.prisma.io/postgres) offers temporary production-ready databases that also requires no setup or accounts. Use [`npx create-db`](https://www.prisma.io/docs/postgres/introduction/npx-create-db?utm_source=redwoodjs_docs&utm_medium=docs) to create a database that's automatically deleted after 24 hours:
68
+
69
+
```bash
70
+
npx create-db@latest
71
+
```
72
+
73
+
This provides both Prisma ORM-optimized and standard PostgreSQL connection strings. You can also claim the database to make it permanent if needed.
Copy file name to clipboardExpand all lines: docs/versioned_docs/version-0.x/local-postgres-setup.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,48 @@ brew install postgresql@14
24
24
25
25
### Windows and Other Platforms
26
26
27
-
If you're using another platform, see Prisma's [Data Guide](https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database) for detailed instructions on how to get up and running.
27
+
If you're using another platform, see Prisma's [Data Guide](https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database?utm_source=redwoodjs_docs&utm_medium=docs) for detailed instructions on how to get up and running.
28
+
29
+
## Alternatives to local PostgreSQL Installation
30
+
31
+
### Local Prisma Postgres
32
+
33
+
For local development, you can use [local Prisma Postgres](https://www.prisma.io/docs/postgres/database/local-development?utm_source=redwoodjs_docs&utm_medium=docs) which runs a PostgreSQL-compatible database locally. This eliminates the need to install and manage PostgreSQL locally while maintaining full compatibility with production PostgreSQL databases.
34
+
35
+
First, update your Prisma schema to use PostgreSQL as the provider:
36
+
37
+
```graphql title="api/db/schema.prisma"
38
+
datasourcedb {
39
+
provider = "postgresql"
40
+
url = env("DATABASE_URL")
41
+
}
42
+
```
43
+
44
+
Start the local Prisma Postgres server:
45
+
46
+
```bash
47
+
npx prisma dev
48
+
```
49
+
50
+
The server will start and display connection options. Press `t` to get the TCP connection URL for standard PostgreSQL connections, or press `h` if you're planning to use Prisma Postgres in production (which requires the [Prisma Client extension](https://www.prisma.io/docs/postgres/introduction/overview#using-the-client-extension-for-prisma-accelerate-required)).
51
+
52
+
If you're using any other provider for PostgreSQL, use the TCP connection URL in your `.env` file:
53
+
54
+
```env
55
+
DATABASE_URL="postgresql://localhost:54322/main"
56
+
```
57
+
58
+
Keep the server running while performing migrations and using the database for local development.
59
+
60
+
### Temporary Prisma Postgres database
61
+
62
+
For quick testing or prototyping, [Prisma Postgres](https://www.prisma.io/postgres?utm_source=redwoodjs_docs&utm_medium=docs) offers temporary production-ready databases that require no setup or accounts. Use [`npx create-db`](https://www.prisma.io/docs/postgres/introduction/npx-create-db?utm_source=redwoodjs_docs&utm_medium=docs) to create a database that's automatically deleted after 24 hours:
63
+
64
+
```bash
65
+
npx create-db@latest
66
+
```
67
+
68
+
This provides both Prisma ORM-optimized and standard PostgreSQL connection strings. You can also claim the database to make it permanent if needed.
0 commit comments