Skip to content

Conversation

@ivancernja
Copy link

@ivancernja ivancernja commented Feb 2, 2026

Adds a guide for using Prisma ORM with Encore under the guides section.

Encore is an open source backend framework for TypeScript with built-in infrastructure automation and observability.

The guide covers:

  • Project setup with Encore CLI
  • Installing and configuring Prisma
  • Encore database with Prisma migrations (source: "prisma")
  • Shadow database configuration
  • Prisma client wrapper using Encore's connection string
  • API endpoints using Prisma
  • Schema changes and migration workflow
  • Deployment configuration

Links to:

Summary by CodeRabbit

Documentation

  • Added comprehensive guide for integrating Prisma ORM with Encore applications, covering prerequisites, project setup, database configuration, schema definition, API endpoint creation, migrations, and deployment with practical code examples.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

Walkthrough

A new guide document is added that provides step-by-step instructions for integrating Prisma ORM with Encore, covering setup, configuration, schema definition, API endpoints, migrations, and deployment.

Changes

Cohort / File(s) Summary
New Integration Guide
content/800-guides/460-encore.mdx
Added comprehensive guide for Prisma ORM integration with Encore, including prerequisites, project setup, database configuration, schema definition, client wrapper creation, migrations, API endpoint examples, and deployment instructions with code snippets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Encore guide' directly corresponds to the main change: introducing a new MDX guide for integrating Prisma ORM with Encore, clearly summarizing the primary contribution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@content/800-guides/460-encore.mdx`:
- Line 13: Change the phrase "open source backend framework" to the hyphenated
adjective form "open-source backend framework" in the sentence that references
Encore ("Prisma ORM provides type-safe database access, and Encore is an
open-source backend framework..."); update that exact phrase in content to
maintain grammatical correctness.
- Around line 94-97: The datasource currently sets url to env("SHADOW_DB_URL")
causing migrations to run against the shadow DB; change the datasource to point
url at your primary DB (e.g., env("DB_URL")) and add a separate
shadowDatabaseUrl set to env("SHADOW_DB_URL") so Prisma applies migrations to
the main DB while using the shadow DB only for migrate dev; update the
datasource block fields "url" and add "shadowDatabaseUrl" accordingly.


## Introduction

Prisma ORM provides type-safe database access, and [Encore](https://encore.dev) is an open source backend framework with built-in infrastructure automation and observability. Together, you get type-safe database queries with automatic database provisioning and migrations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Hyphenate “open-source” when used as an adjective.

Minor grammar polish: “open-source backend framework.”

🧰 Tools
🪛 LanguageTool

[grammar] ~13-~13: Use a hyphen to join words.
Context: ... Encore is an open source backend framework with built-in i...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
In `@content/800-guides/460-encore.mdx` at line 13, Change the phrase "open source
backend framework" to the hyphenated adjective form "open-source backend
framework" in the sentence that references Encore ("Prisma ORM provides
type-safe database access, and Encore is an open-source backend framework...");
update that exact phrase in content to maintain grammatical correctness.

Comment on lines +94 to +97
datasource db {
provider = "postgresql"
url = env("SHADOW_DB_URL")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Prisma datasource url shadowDatabaseUrl migrate dev behavior

💡 Result:

  • datasource db { url = ... } is the main/dev database connection Prisma uses to apply migrations when you run prisma migrate dev. [2]
  • shadowDatabaseUrl is a separate database connection Prisma Migrate uses only during migrate dev (and some migrate diff cases) to:
    • replay your existing migrations,
    • detect schema drift,
    • generate and validate the next migration (including data-loss checks). [1][2]

What changes when you set shadowDatabaseUrl:

  • If you don’t set it, Prisma Migrate typically creates and drops a temporary shadow database automatically (requires privileges to create/drop databases). [1]
  • If you do set shadowDatabaseUrl, Prisma uses that pre-created shadow database and will reset/clean it at the start of migrate dev (and it is not dropped automatically afterward). [1]

Important behavior / safety:

  • Never set shadowDatabaseUrl to the same value as url—you can wipe or reset the wrong database. [1]
  • In many cloud-hosted DB setups where creating/dropping databases isn’t allowed, you must manually create a dedicated shadow database and point shadowDatabaseUrl at it. [1]

Related gotcha (often confused with shadow DB):

  • If you use connection pooling (e.g., PgBouncer), Prisma recommends using directUrl for Migrate operations; Prisma Client uses url, while Migrate can use directUrl. [7]

Sources: Prisma docs on shadow DB and migrate dev workflow. [1][2]


Use the main DB URL for datasource url and set shadowDatabaseUrl explicitly.

The schema currently points url to the shadow database. This causes migrations to apply against the shadow DB instead of your primary database, and leaves the actual DB_URL environment variable unused. In Prisma, url is where migrations are applied, while shadowDatabaseUrl is a separate database Prisma uses during migrate dev to detect schema drift and validate migrations safely. The correct pattern is to point url at your primary database and explicitly configure shadowDatabaseUrl for the shadow database.

✅ Suggested update
 datasource db {
   provider  = "postgresql"
-  url       = env("SHADOW_DB_URL")
+  url               = env("DB_URL")
+  shadowDatabaseUrl = env("SHADOW_DB_URL")
 }
🤖 Prompt for AI Agents
In `@content/800-guides/460-encore.mdx` around lines 94 - 97, The datasource
currently sets url to env("SHADOW_DB_URL") causing migrations to run against the
shadow DB; change the datasource to point url at your primary DB (e.g.,
env("DB_URL")) and add a separate shadowDatabaseUrl set to env("SHADOW_DB_URL")
so Prisma applies migrations to the main DB while using the shadow DB only for
migrate dev; update the datasource block fields "url" and add
"shadowDatabaseUrl" accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant