Skip to content

Add Encore guide#7466

Open
ivancernja wants to merge 8 commits intoprisma:mainfrom
ivancernja:add-encore-guide
Open

Add Encore guide#7466
ivancernja wants to merge 8 commits intoprisma:mainfrom
ivancernja:add-encore-guide

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 a comprehensive guide for integrating Prisma ORM with Encore apps, covering prerequisites, project setup, installation, schema design, client usage patterns, API endpoint examples, migrations (including shadow DB and automatic migrations), and deployment steps.
    • Includes runnable examples, migration and deployment guidance, and testing/operational considerations for end-to-end, type-safe database usage.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

Walkthrough

Adds a new MDX guide documenting how to integrate Prisma ORM with Encore: prerequisites, project and Prisma setup, Prisma schema and client wrapper, migration workflow (including shadow DB and Encore automatic migrations), example API endpoints, run/start scripts, and Encore Cloud deployment notes (documentation-only, +255 lines).

Changes

Cohort / File(s) Summary
New Integration Guide
content/800-guides/460-encore.mdx
Adds a comprehensive Prisma+Encore MDX guide: installation and init steps, Prisma schema example, database.ts Prisma client wrapper, migration instructions (shadow DB, initial migration, automatic migrations on startup), example API endpoint (users.ts), run/start scripts, and deployment guidance for Encore Cloud.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Add Encore guide' is vague and generic, lacking specificity about what the guide covers or its primary value. Consider a more descriptive title like 'Add guide for integrating Prisma with Encore' or 'Document Prisma ORM integration with Encore framework' to better convey the changeset's purpose.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

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: 3

🤖 Fix all issues with AI agents
In `@content/800-guides/460-encore.mdx`:
- Around line 66-70: Update the example CLI commands so they pass the database
name used in the code (SQLDatabase("mydb", ...)) instead of the app name;
replace uses of `my-app` with `mydb` in the `encore db conn-uri` examples
(`encore db conn-uri mydb` and `encore db conn-uri mydb --shadow`) so the
command looks up the correct database defined by SQLDatabase("mydb", ...).
- Around line 35-38: Remove the unnecessary `dotenv` dependency from the install
instructions in the code block — update the terminal snippet that currently
shows `npm install `@prisma/client` `@prisma/adapter-pg` dotenv` to only install the
required packages (`@prisma/client` and `@prisma/adapter-pg`) so readers aren't
instructed to add a dead dependency; keep the first line `npm install prisma
--save-dev` as-is and ensure any mention of `dotenv` elsewhere in this file
(e.g., surrounding the Prisma setup steps) is not present or referenced.
- Around line 87-97: The schema includes a now-unnecessary preview feature flag:
remove the previewFeatures = ["driverAdapters"] entry from the generator block
(generator client with provider = "prisma-client") so the generator block only
contains provider and output; leave the datasource db with url
env("SHADOW_DB_URL") unchanged.
🧹 Nitpick comments (1)
content/800-guides/460-encore.mdx (1)

146-191: Consider using Prisma-generated types instead of hand-rolled interfaces.

Lines 150–154 manually define a User interface, but line 129 already re-exports all Prisma-generated types via export * from "./generated/client". If the generated User type drifts from this manual interface (e.g., a field is added to the schema), the endpoint types will silently diverge. Using the generated type keeps things in sync:

import { prisma, User } from "./prisma/client";

That said, for a guide aimed at teaching the integration, keeping explicit interfaces has pedagogical value — so this is a judgment call for the doc maintainers.

Removed 'dotenv' from the installation command for Prisma.
Removed 'driverAdapters' from previewFeatures in Prisma schema.
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: 1

🤖 Fix all issues with AI agents
In `@content/800-guides/460-encore.mdx`:
- Around line 72-77: The guide currently lists DB_URL in the .env sample but
never uses it (the Prisma schema references env("SHADOW_DB_URL") and runtime
uses Encore's DB.connectionString), so either remove DB_URL from the .env
snippet or add a short explanatory sentence after the snippet clarifying that
DB_URL is optional and only needed for manual DB access or debugging (e.g.,
direct psql connections), and keep SHADOW_DB_URL as-is; reference DB_URL,
SHADOW_DB_URL, env("SHADOW_DB_URL"), and Encore's DB.connectionString when
making the change so the correct locations are updated.
🧹 Nitpick comments (1)
content/800-guides/460-encore.mdx (1)

225-233: Consider using prisma generate instead of npx prisma generate in postinstall.

Since prisma is already installed as a dev dependency (line 36), npm lifecycle scripts automatically have node_modules/.bin on PATH. You can simplify:

Suggested simplification
 {
   "scripts": {
-    "postinstall": "npx prisma generate"
+    "postinstall": "prisma generate"
   }
 }

This avoids the npx lookup overhead and is the more common pattern in Prisma projects. Minor nit — both work fine.

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.

2 participants