-
Notifications
You must be signed in to change notification settings - Fork 876
Add Encore guide #7466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Encore guide #7466
Conversation
WalkthroughAdds 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ 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. Comment |
There was a problem hiding this 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.
There was a problem hiding this 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
Userinterface, but line 129 already re-exports all Prisma-generated types viaexport * from "./generated/client". If the generatedUsertype 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.
There was a problem hiding this 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 usingprisma generateinstead ofnpx prisma generateinpostinstall.Since
prismais already installed as a dev dependency (line 36), npm lifecycle scripts automatically havenode_modules/.binonPATH. You can simplify:Suggested simplification
{ "scripts": { - "postinstall": "npx prisma generate" + "postinstall": "prisma generate" } }This avoids the
npxlookup overhead and is the more common pattern in Prisma projects. Minor nit — both work fine.
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:
source: "prisma")Links to:
Summary by CodeRabbit