feat: Upgrade Prisma to 6.17.1 and use new JS-based generator#677
Conversation
🦋 Changeset detectedLatest commit: 3c9b32f The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds a prismaGeneratedImports provider and rewires generators/templates to consume generated Prisma imports, upgrades Prisma to 6.17.1 with client output moved to src/generated/prisma, updates generated-client imports and adapter wiring (PrismaPg), and adjusts ignore rules and renderer wiring across examples and plugins. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev
participant FastifyGen as Fastify Generators
participant Provider as prismaGeneratedImports
participant PrismaCLI as Prisma (prisma-client)
participant FS as FileSystem (src/generated/prisma)
participant Templates as Generated Templates
Dev->>FastifyGen: run prisma generator
FastifyGen->>Provider: request import mappings (Prisma, PrismaClient, '*')
FastifyGen->>PrismaCLI: generate client (provider=prisma-client, output=src/generated/prisma)
PrismaCLI-->>FS: write generated client files
FastifyGen->>Templates: render templates using Provider module specifiers
Templates->>FS: import { PrismaClient, Prisma, Models } via provider specifier
sequenceDiagram
autonumber
actor Dev
participant VitestGen as Vitest Generator
participant Provider as prismaGeneratedImports
participant Renderers as Renderers
participant FS as FileSystem
Dev->>VitestGen: run vitest prisma generator
VitestGen->>Provider: obtain prisma import mappings
VitestGen->>Renderers: render dbTestHelper & prismaTestHelper with provider-aware templates
Renderers-->>FS: write test helper files referencing generated imports and adapter setup
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 15
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (9)
examples/todo-with-auth0/packages/backend/package.json (2)
7-7: Switch package to ESM.This example must ship as ESM (
"type": "module"), and the JS-based Prisma client generator now emits ESM entrypoints. Keeping"type": "commonjs"here will cause default imports fromsrc/generated/prismato fail at runtime. Flip the type to"module"(and adjust any CJS importers) before landing.
1-33: Add the requiredpackageManagerpin.Per the example guidelines we enforce pnpm ≥10 via the manifest. Please add
"packageManager": "pnpm@10.16.0"(or later) to thispackage.jsonso installs keep using the expected toolchain.examples/todo-with-auth0/packages/backend/src/modules/accounts/users/services/user-image.crud.ts (1)
6-14: Add JSDoc documentation as per coding guidelines.The exported function
deleteUserImageis missing JSDoc comments. According to the coding guidelines for this path pattern, all exported functions should include JSDoc with descriptions, params, and returns.As per coding guidelines, apply this diff to add JSDoc:
+/** + * Deletes a user image by ID. + * + * @param params - The delete operation parameters + * @param params.id - The unique identifier of the user image to delete + * @param params.query - Additional Prisma query options for the delete operation + * @returns A promise that resolves to the deleted UserImage + */ export async function deleteUserImage({ id, query, }: DeleteServiceInput< string, Prisma.UserImageDefaultArgs >): Promise<UserImage> { return prisma.userImage.delete({ where: { id }, ...query }); }examples/todo-with-auth0/packages/backend/src/modules/todos/services/todo-list.crud.ts (3)
17-23: Add JSDoc to exported interface and function.Both the
TodoListCreateDatainterface andcreateTodoListfunction are missing JSDoc documentation.As per coding guidelines for this path: Add JSDoc to all exported functions, interfaces, and classes including descriptions, params, returns, and fields.
Apply this diff to add JSDoc:
+/** + * Data required to create a new todo list. + */ interface TodoListCreateData extends Pick< Prisma.TodoListUncheckedCreateInput, 'position' | 'name' | 'ownerId' | 'status' | 'createdAt' > { + /** Optional cover photo for the todo list */ coverPhoto?: FileUploadInput | null; } +/** + * Creates a new todo list with the provided data. + * + * @param params - The create service input parameters + * @param params.data - The todo list data to create + * @param params.query - Additional Prisma query options + * @param params.context - The request context + * @returns The created todo list + */ export async function createTodoList({Also applies to: 25-53
55-62: Add JSDoc to exported interface and function.Both the
TodoListUpdateDatainterface andupdateTodoListfunction are missing JSDoc documentation.As per coding guidelines for this path: Add JSDoc to all exported functions, interfaces, and classes including descriptions, params, returns, and fields.
Apply this diff to add JSDoc:
+/** + * Data for updating an existing todo list. + */ interface TodoListUpdateData extends Pick< Partial<Prisma.TodoListUncheckedCreateInput>, 'position' | 'name' | 'ownerId' | 'status' | 'createdAt' > { + /** Optional cover photo for the todo list */ coverPhoto?: FileUploadInput | null; } +/** + * Updates an existing todo list with the provided data. + * + * @param params - The update service input parameters + * @param params.id - The ID of the todo list to update + * @param params.data - The todo list data to update + * @param params.query - Additional Prisma query options + * @param params.context - The request context + * @returns The updated todo list + */ export async function updateTodoList({Also applies to: 63-103
105-110: Add JSDoc to exported function.The
deleteTodoListfunction is missing JSDoc documentation.As per coding guidelines for this path: Add JSDoc to all exported functions, interfaces, and classes including descriptions, params, returns, and fields.
Apply this diff to add JSDoc:
+/** + * Deletes a todo list by its ID. + * + * @param params - The delete service input parameters + * @param params.id - The ID of the todo list to delete + * @param params.query - Additional Prisma query options + * @returns The deleted todo list + */ export async function deleteTodoList({packages/fastify-generators/src/generators/prisma/_shared/crud-method/primary-key-input.ts (1)
115-118: Add missing type import for Prisma model in composite primary key inputAt primary-key-input.ts:115-118, the hoisted fragment references
Pick<${model.name}, …>without importing${model.name}. Pass atsTypeImportBuilder([model.name]).from('<prisma-client-path>')as the third argument totsHoistedFragmentto ensure the model type is imported in the generated code.examples/todo-with-auth0/packages/backend/.baseplate-snapshot/diffs/package.json.diff (1)
1-14: Critical: Pipeline failure must be resolved before merging.The Prisma generate command is failing because the output directory
/home/runner/work/baseplate/baseplate/examples/blog-with-auth/packages/backend/src/generated/prismaexists but doesn't contain a valid generated Prisma Client. This indicates incomplete migration or leftover files from the old generator.Required actions:
- Remove the existing
src/generated/prismadirectories across all example projects- Re-run
prisma generateto create fresh output with the new generator- Ensure
.gitignoreproperly excludes these generated directories to prevent future conflicts- Verify all import paths are updated to reference the new generated client location
Run the following script to identify all affected directories that may need cleanup:
#!/bin/bash # Description: Find all Prisma generated directories that may need cleanup # Find all existing prisma generated directories fd -t d -g '**/generated/prisma' examples/ # Check if these directories are gitignored for dir in $(fd -t d -g '**/generated/prisma' examples/); do echo "Checking if $dir is gitignored..." git check-ignore "$dir" || echo "WARNING: $dir is not gitignored" donepackages/fastify-generators/src/generators/prisma/embedded-relation-transformer/embedded-relation-transformer.generator.ts (1)
148-186: Missing Prisma type import in create-only paths (compile-time error).createEmbeddedTransformFunction’s signature/return types reference Prisma.* but the fragment doesn’t include a Prisma type import. In create flows (no getWhereUniqueFunction), generated code will lack the Prisma import and fail to type-check.
Apply this diff to always attach the Prisma type import:
const func = TsCodeUtils.formatFragment( `${ isAsync ? 'async ' : '' }function FUNC_NAME(data: INPUT_DATA_TYPE, context: CONTEXT_TYPE, whereUnique?: WHERE_UNIQUE_TYPE, parentId?: string): OUTPUT_TYPE { FUNCTION_BODY return DATA_RESULT; }`, { FUNC_NAME: name, INPUT_DATA_TYPE: inputDataType, FUNCTION_BODY: functionBody, WHERE_UNIQUE_TYPE: whereUniqueType, DATA_RESULT: TsCodeUtils.mergeFragmentsAsObject({ data: TsCodeUtils.mergeFragmentsAsObject({ where: isOneToOne ? undefined : `whereUnique ?? { ${primaryKey}: '' }`, create: createExpression, update: updateExpression, }), operations: dataPipeNames.length === 0 ? undefined : tsCodeFragment( `mergePipeOperations([${dataPipeNames.join(', ')}])`, prismaUtils.mergePipeOperations.declaration(), ), }), OUTPUT_TYPE: outputType, CONTEXT_TYPE: serviceContextType, - }, - ); + }, + [ + options.dataMethodOptions.prismaGeneratedImports.Prisma.typeDeclaration(), + ], + );
♻️ Duplicate comments (1)
examples/todo-with-auth0/packages/backend/src/modules/storage/services/upload-file.ts (1)
1-1: Critical: Same Prisma client directory conflict as blog-with-auth example.The import syntax is correct (type-only import with .js extension per coding guidelines), but the same pipeline failure affects this example:
The output path exists and is not empty but doesn't look like a generated Prisma Client.The generated Prisma directories across all examples need to be cleaned before regenerating with Prisma 6.17.1. This is likely a one-time migration step when upgrading Prisma versions.
🧹 Nitpick comments (10)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
41-42: Prisma 6.17.1 bump approved; update schema.prisma generator for new JS client
- Version exists with no advisories. Per the 6.17.x migration guide, update your Prisma generator block to
provider = "prisma-client", configureoutput/moduleFormat, remove obsolete preview flags, and install the appropriate JS engine adapter before runningprisma generate.examples/blog-with-auth/packages/backend/src/modules/accounts/services/user.crud.ts (3)
15-20: Add JSDoc to exported function.The exported
createUserfunction lacks JSDoc documentation.As per coding guidelines for this path pattern, apply this diff:
+/** + * Creates a new user in the database. + * @param {CreateServiceInput<UserCreateData, Prisma.UserDefaultArgs>} params - The input containing user data and query options + * @returns {Promise<User>} The created user + */ export async function createUser({ data, query, }: CreateServiceInput<UserCreateData, Prisma.UserDefaultArgs>): Promise<User> { return prisma.user.create({ data, ...query }); }
27-37: Add JSDoc to exported function.The exported
updateUserfunction lacks JSDoc documentation.As per coding guidelines for this path pattern, apply this diff:
+/** + * Updates an existing user in the database. + * @param {UpdateServiceInput<string, UserUpdateData, Prisma.UserDefaultArgs>} params - The input containing user ID, update data, and query options + * @returns {Promise<User>} The updated user + */ export async function updateUser({ id, data, query, }: UpdateServiceInput< string, UserUpdateData, Prisma.UserDefaultArgs >): Promise<User> { return prisma.user.update({ where: { id }, data, ...query }); }
39-44: Add JSDoc to exported function.The exported
deleteUserfunction lacks JSDoc documentation.As per coding guidelines for this path pattern, apply this diff:
+/** + * Deletes a user from the database. + * @param {DeleteServiceInput<string, Prisma.UserDefaultArgs>} params - The input containing user ID and query options + * @returns {Promise<User>} The deleted user + */ export async function deleteUser({ id, query, }: DeleteServiceInput<string, Prisma.UserDefaultArgs>): Promise<User> { return prisma.user.delete({ where: { id }, ...query }); }examples/blog-with-auth/packages/backend/src/services/prisma.ts (2)
1-1: Use absolute import path for consistency.This file uses a relative import path
../generated/prisma/client.js, while other files in the same example use the absolute path@src/generated/prisma/client.js. For consistency across the codebase, prefer the absolute path.Apply this diff:
-import { PrismaClient } from '../generated/prisma/client.js'; +import { PrismaClient } from '@src/generated/prisma/client.js';
3-3: Add JSDoc to exported constant.The exported
prismaconstant lacks JSDoc documentation.As per coding guidelines for this path pattern, apply this diff:
+/** + * Shared Prisma client instance for database operations. + */ export const prisma = new PrismaClient();examples/todo-with-auth0/packages/backend/src/modules/todos/services/todo-list-share.crud.ts (4)
15-23: Add JSDoc to exported function.The exported
createTodoListSharefunction lacks JSDoc documentation.As per coding guidelines for this path pattern, apply this diff:
+/** + * Creates a new todo list share in the database. + * @param {CreateServiceInput<TodoListShareCreateData, Prisma.TodoListShareDefaultArgs>} params - The input containing share data and query options + * @returns {Promise<TodoListShare>} The created todo list share + */ export async function createTodoListShare({ data, query, }: CreateServiceInput< TodoListShareCreateData, Prisma.TodoListShareDefaultArgs >): Promise<TodoListShare> { return prisma.todoListShare.create({ data, ...query }); }
25-28: Add JSDoc to exported type.The exported
TodoListSharePrimaryKeytype lacks JSDoc documentation.As per coding guidelines for this path pattern, apply this diff:
+/** + * Primary key type for TodoListShare composed of todoListId and userId. + */ export type TodoListSharePrimaryKey = Pick< TodoListShare, 'todoListId' | 'userId' >;
35-49: Add JSDoc to exported function.The exported
updateTodoListSharefunction lacks JSDoc documentation.As per coding guidelines for this path pattern, apply this diff:
+/** + * Updates an existing todo list share in the database. + * @param {UpdateServiceInput<TodoListSharePrimaryKey, TodoListShareUpdateData, Prisma.TodoListShareDefaultArgs>} params - The input containing composite key, update data, and query options + * @returns {Promise<TodoListShare>} The updated todo list share + */ export async function updateTodoListShare({ id: todoListId_userId, data, query, }: UpdateServiceInput< TodoListSharePrimaryKey, TodoListShareUpdateData, Prisma.TodoListShareDefaultArgs >): Promise<TodoListShare> { return prisma.todoListShare.update({ where: { todoListId_userId }, data, ...query, }); }
51-62: Add JSDoc to exported function.The exported
deleteTodoListSharefunction lacks JSDoc documentation.As per coding guidelines for this path pattern, apply this diff:
+/** + * Deletes a todo list share from the database. + * @param {DeleteServiceInput<TodoListSharePrimaryKey, Prisma.TodoListShareDefaultArgs>} params - The input containing composite key and query options + * @returns {Promise<TodoListShare>} The deleted todo list share + */ export async function deleteTodoListShare({ id: todoListId_userId, query, }: DeleteServiceInput< TodoListSharePrimaryKey, Prisma.TodoListShareDefaultArgs >): Promise<TodoListShare> { return prisma.todoListShare.delete({ where: { todoListId_userId }, ...query, }); }
| import { Route as rootRouteImport } from './routes/__root' | ||
| import { Route as AuthRouteRouteImport } from './routes/auth_/route' | ||
| import { Route as AdminRouteRouteImport } from './routes/admin/route' | ||
| import { Route as IndexRouteImport } from './routes/index' | ||
| import { Route as AdminIndexRouteImport } from './routes/admin/index' | ||
| import { Route as AuthRegisterRouteImport } from './routes/auth_/register' | ||
| import { Route as AuthLoginRouteImport } from './routes/auth_/login' | ||
| import { Route as AdminAccountsUsersRouteRouteImport } from './routes/admin/accounts/users/route' | ||
| import { Route as AdminAccountsUsersIndexRouteImport } from './routes/admin/accounts/users/index' | ||
| import { Route as AdminAccountsUsersNewRouteImport } from './routes/admin/accounts/users/new' | ||
| import { Route as AdminAccountsUsersIdRouteImport } from './routes/admin/accounts/users/$id' |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Add .js extensions to generated imports.
Per the project guidelines for examples/blog-with-auth/.../src, every import must include a .js extension. These extensionless specifiers can break Node 16 ESM resolution and drift from the enforced convention. Please update this block accordingly.
-import { Route as rootRouteImport } from './routes/__root'
-import { Route as AuthRouteRouteImport } from './routes/auth_/route'
-import { Route as AdminRouteRouteImport } from './routes/admin/route'
-import { Route as IndexRouteImport } from './routes/index'
-import { Route as AdminIndexRouteImport } from './routes/admin/index'
-import { Route as AuthRegisterRouteImport } from './routes/auth_/register'
-import { Route as AuthLoginRouteImport } from './routes/auth_/login'
-import { Route as AdminAccountsUsersRouteRouteImport } from './routes/admin/accounts/users/route'
-import { Route as AdminAccountsUsersIndexRouteImport } from './routes/admin/accounts/users/index'
-import { Route as AdminAccountsUsersNewRouteImport } from './routes/admin/accounts/users/new'
-import { Route as AdminAccountsUsersIdRouteImport } from './routes/admin/accounts/users/$id'
+import { Route as rootRouteImport } from './routes/__root.js'
+import { Route as AuthRouteRouteImport } from './routes/auth_/route.js'
+import { Route as AdminRouteRouteImport } from './routes/admin/route.js'
+import { Route as IndexRouteImport } from './routes/index.js'
+import { Route as AdminIndexRouteImport } from './routes/admin/index.js'
+import { Route as AuthRegisterRouteImport } from './routes/auth_/register.js'
+import { Route as AuthLoginRouteImport } from './routes/auth_/login.js'
+import { Route as AdminAccountsUsersRouteRouteImport } from './routes/admin/accounts/users/route.js'
+import { Route as AdminAccountsUsersIndexRouteImport } from './routes/admin/accounts/users/index.js'
+import { Route as AdminAccountsUsersNewRouteImport } from './routes/admin/accounts/users/new.js'
+import { Route as AdminAccountsUsersIdRouteImport } from './routes/admin/accounts/users/$id.js'As per coding guidelines.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { Route as rootRouteImport } from './routes/__root' | |
| import { Route as AuthRouteRouteImport } from './routes/auth_/route' | |
| import { Route as AdminRouteRouteImport } from './routes/admin/route' | |
| import { Route as IndexRouteImport } from './routes/index' | |
| import { Route as AdminIndexRouteImport } from './routes/admin/index' | |
| import { Route as AuthRegisterRouteImport } from './routes/auth_/register' | |
| import { Route as AuthLoginRouteImport } from './routes/auth_/login' | |
| import { Route as AdminAccountsUsersRouteRouteImport } from './routes/admin/accounts/users/route' | |
| import { Route as AdminAccountsUsersIndexRouteImport } from './routes/admin/accounts/users/index' | |
| import { Route as AdminAccountsUsersNewRouteImport } from './routes/admin/accounts/users/new' | |
| import { Route as AdminAccountsUsersIdRouteImport } from './routes/admin/accounts/users/$id' | |
| import { Route as rootRouteImport } from './routes/__root.js' | |
| import { Route as AuthRouteRouteImport } from './routes/auth_/route.js' | |
| import { Route as AdminRouteRouteImport } from './routes/admin/route.js' | |
| import { Route as IndexRouteImport } from './routes/index.js' | |
| import { Route as AdminIndexRouteImport } from './routes/admin/index.js' | |
| import { Route as AuthRegisterRouteImport } from './routes/auth_/register.js' | |
| import { Route as AuthLoginRouteImport } from './routes/auth_/login.js' | |
| import { Route as AdminAccountsUsersRouteRouteImport } from './routes/admin/accounts/users/route.js' | |
| import { Route as AdminAccountsUsersIndexRouteImport } from './routes/admin/accounts/users/index.js' | |
| import { Route as AdminAccountsUsersNewRouteImport } from './routes/admin/accounts/users/new.js' | |
| import { Route as AdminAccountsUsersIdRouteImport } from './routes/admin/accounts/users/$id.js' |
🤖 Prompt for AI Agents
In examples/blog-with-auth/packages/admin/src/route-tree.gen.ts around lines 11
to 21, the generated import specifiers are missing the required .js extensions;
update each import path to include the .js extension (e.g. './routes/__root' ->
'./routes/__root.js', './routes/auth_/route' -> './routes/auth_/route.js', etc.)
so all ten imports use extensioned specifiers matching the project ESM
convention and Node 16 resolution rules.
| "@baseplate-dev/fastify-generators#pothos/pothos:field-with-input-types": "src/plugins/graphql/FieldWithInputPayloadPlugin/types.ts", | ||
| "@baseplate-dev/fastify-generators#pothos/pothos:strip-query-mutation-plugin": "src/plugins/graphql/strip-query-mutation-plugin.ts", | ||
| "@baseplate-dev/fastify-generators#prisma/prisma-utils:crud-service-types": "src/utils/crud-service-types.ts", | ||
| "@baseplate-dev/fastify-generators#prisma/prisma:client": "src/generated/prisma/client.ts", |
There was a problem hiding this comment.
🧩 Analysis chain
Fix the prisma generate failure for this new output path.
CI is currently failing (Prisma generate failed: The output path .../src/generated/prisma exists and is not empty...) because this directory already contains files that Prisma doesn’t recognise as generated. Before merging, clear or relocate the pre-existing contents (or adjust the generator output path) so prisma generate can succeed and this mapping resolves correctly.
🏁 Script executed:
#!/bin/bash
# Check JSON mapping entry
echo "Mapping entry in file-id-map.json:"
rg -n '"@baseplate-dev/fastify-generators#prisma/prisma:client"' -g 'examples/blog-with-auth/packages/backend/baseplate/file-id-map.json'
# List files under generated/prisma
echo "Files in src/generated/prisma/:"
find examples/blog-with-auth/packages/backend/baseplate/src/generated/prisma -maxdepth 1 -type f -print || echo "No files found in src/generated/prisma"Length of output: 377
Clean or relocate src/generated/prisma before running Prisma generate
CI is failing because the new mapping at examples/blog-with-auth/packages/backend/baseplate/file-id-map.json:74 targets src/generated/prisma/client.ts, but the output directory already exists and isn’t empty. Remove or move its contents (or adjust the generator’s output path) so prisma generate can succeed.
🤖 Prompt for AI Agents
In examples/blog-with-auth/packages/backend/baseplate/file-id-map.json around
line 74, the mapping points the Prisma generator output to
src/generated/prisma/client.ts but generation fails because src/generated/prisma
already exists and is not empty; to fix, either delete or move existing contents
of src/generated/prisma before running prisma generate, or change the
generator's output path in the file-id-map.json (or in prisma schema) to a
non-conflicting directory, then re-run prisma generate so the generator can
write to an empty target directory.
| "@pothos/plugin-tracing": "1.1.0", | ||
| "@pothos/tracing-sentry": "1.1.1", | ||
| "@prisma/client": "6.16.2", | ||
| "@prisma/client": "6.17.1", |
There was a problem hiding this comment.
Prisma 6 upgrade currently breaks prisma generate.
The 6.17.1 JS-based generator refuses to overwrite src/generated/prisma because the directory already contains pre-existing (non-client) files, so every pnpm install now fails (see pipeline error). Please unblock installs by ensuring the output directory is emptied or regenerated before the Prisma CLI runs—for example, delete/relocate the tracked files in that folder or add a rimraf src/generated/prisma && step ahead of prisma generate. Without this fix the new Prisma version can’t be used.
Also applies to: 81-81
🤖 Prompt for AI Agents
In examples/blog-with-auth/packages/backend/package.json around lines 47 and 81,
the Prisma 6 JS generator fails because src/generated/prisma contains
pre-existing tracked files and the generator refuses to overwrite them; update
the package.json scripts (or CI install steps) to ensure that output is removed
or relocated before running prisma generate — for example remove tracked files
from src/generated/prisma and add them to .gitignore and commit that change, or
prepend a cleanup command (e.g., rimraf src/generated/prisma &&) before prisma
generate in the relevant scripts so the directory is emptied/regenerated prior
to running the Prisma CLI.
| provider = "prisma-client" | ||
| output = "../src/generated/prisma" |
There was a problem hiding this comment.
🧩 Analysis chain
Critical: Prisma generation is failing.
The pipeline is failing with:
Prisma generate failed: The output path '/home/runner/work/baseplate/baseplate/examples/blog-with-auth/packages/backend/src/generated/prisma' exists and is not empty but doesn't look like a generated Prisma Client.
This indicates that either:
- The output directory contains stale/incompatible content from the old generator
- The provider name "prisma-client" may not be correct for Prisma 6.17.1
Please verify the following:
-
Confirm that "prisma-client" (not "prisma-client-js") is the correct provider name for Prisma 6.17.1:
-
Check if the output directory needs to be cleaned before running generation:
🏁 Script executed:
#!/bin/bash
# Check the contents of the generated Prisma directory
fd --type f --max-depth 3 . examples/blog-with-auth/packages/backend/src/generated/prisma/
# Check if there's a .gitkeep or other placeholder files
cat examples/blog-with-auth/packages/backend/src/generated/prisma/.gitkeep 2>/dev/null || echo "No .gitkeep found"Length of output: 17
🌐 Web query:
What is the correct generator provider name for Prisma Client in Prisma version 6.17.1?
💡 Result:
The correct provider name is "prisma-client". [1][2]
Sources:
[1] Prisma changelog (v6.x) — shows generator provider = "prisma-client".
[2] Prisma docs — Generators reference describing "prisma-client" and "prisma-client-js".
Clean the generated Prisma output directory before running prisma generate.
Delete or empty examples/blog-with-auth/packages/backend/src/generated/prisma (e.g., via a pre-generate rm -rf) to prevent stale content from causing generation failures.
🤖 Prompt for AI Agents
In examples/blog-with-auth/packages/backend/prisma/schema.prisma around lines 2
to 3, the Prisma generator writes to ../src/generated/prisma and stale files
there can cause generation failures; ensure the generated output directory is
cleaned before running prisma generate by adding a pre-generate step (e.g., npm
script or build hook) that deletes or empties
examples/blog-with-auth/packages/backend/src/generated/prisma (rm -rf or
equivalent cross-platform tool) and then run prisma generate so only fresh files
are written.
| @@ -1,5 +1,4 @@ | |||
| import type { Prisma, User } from '@prisma/client'; | |||
|
|
|||
| import type { Prisma, User } from '@src/generated/prisma/client.js'; | |||
There was a problem hiding this comment.
🧩 Analysis chain
Critical: Prisma generation failing - blocks all changes.
The pipeline failure indicates the Prisma client generation is failing because the output directory exists but doesn't look like a generated Prisma Client. This blocks the entire migration to the new generator.
Additionally, this import should use import type since it only imports types.
As per coding guidelines, apply this diff to use import type:
-import type { Prisma, User } from '@src/generated/prisma/client.js';
+import type { Prisma, User } from '@src/generated/prisma/client.js';Wait, that's already correct. Let me verify if the issue is with the generated directory. Run this script to check the directory state:
🏁 Script executed:
#!/bin/bash
# Check if the generated Prisma directory exists and what it contains
fd -t d "generated/prisma" examples/blog-with-auth/packages/backend/src/ --exec ls -laLength of output: 0
🏁 Script executed:
#!/bin/bash
find examples/blog-with-auth/packages/backend/src -type d \( -name generated -o -name prisma \) -maxdepth 6 -print -exec ls -la {} \;Length of output: 827
Critical: Generated Prisma client missing — blocks import
The src/generated/prisma directory only contains .templates-info.json and no client code. Verify your Prisma generator config and run prisma generate to populate the client before importing @src/generated/prisma/client.js.
- In
examples/blog-with-auth/packages/backend/src/modules/accounts/services/user.crud.ts, exported functions (createUser, updateUser, deleteUser) lack JSDoc comments. Add JSDoc to all exported functions per project guidelines.
🧰 Tools
🪛 GitHub Actions: Lint Examples
[error] 1-1: Prisma generate failed: The output path '/home/runner/work/baseplate/baseplate/examples/blog-with-auth/packages/backend/src/generated/prisma' exists and is not empty but doesn't look like a generated Prisma Client. Please remove the existing directory if you indeed want to generate the Prisma Client in that location. Command: prisma generate.
| @@ -1,5 +1,4 @@ | |||
| import type { Prisma, User } from '@prisma/client'; | |||
|
|
|||
| import type { Prisma, User } from '@src/generated/prisma/client.js'; | |||
There was a problem hiding this comment.
🧩 Analysis chain
Import path change looks correct, but investigate the pipeline failure.
The updated import statement correctly uses import type for type-only imports and follows the Node 16 module resolution guidelines with the .js extension. The path @src/generated/prisma/client.js aligns with the PR objective to use the new Prisma generator.
However, the pipeline failure indicates a Prisma generation issue in the blog-with-auth package:
The output path '/home/runner/work/baseplate/baseplate/examples/blog-with-auth/packages/backend/src/generated/prisma' exists and is not empty but doesn't look like a generated Prisma Client.
This suggests the generated Prisma directories may need to be cleaned before regeneration, or there may be a configuration issue affecting multiple example packages.
Please run the following script to verify the Prisma generation setup across all example packages and identify any pre-existing generated directories that might be causing conflicts:
Consider cleaning the pre-existing generated directories before running prisma generate to resolve the pipeline failure.
🏁 Script executed:
#!/bin/bash
# Description: Check Prisma generation setup and identify potential conflicts
# Find all Prisma schema files
echo "=== Prisma schema files ==="
fd -t f "schema.prisma" examples/
# Check for existing generated directories
echo -e "\n=== Existing generated Prisma directories ==="
fd -t d "generated/prisma" examples/ --exec sh -c 'echo "{}:"; ls -la "{}" | head -5'
# Check Prisma generator output configuration in schema files
echo -e "\n=== Generator output configuration ==="
fd -t f "schema.prisma" examples/ --exec sh -c 'echo "File: {}"; grep -A 2 "output.*=.*generated" "{}" || echo "No output config found"'
# Check .gitignore rules for generated directories
echo -e "\n=== .gitignore rules for generated directories ==="
fd -t f ".gitignore" examples/ --exec sh -c 'echo "File: {}"; grep -i "generated" "{}" || echo "No generated rules found"'Length of output: 938
Import path update is correct; CI is failing due to stale Prisma client outputs.
- Remove existing
src/generated/prismadirectories in all example packages before runningprisma generate. - Add
.gitignoreentries to exclude these generated Prisma client folders.
🧰 Tools
🪛 GitHub Actions: Lint Examples
[error] 1-1: Prisma generate failed: The output path '/home/runner/work/baseplate/baseplate/examples/blog-with-auth/packages/backend/src/generated/prisma' exists and is not empty but doesn't look like a generated Prisma Client. Please remove the existing directory if you indeed want to generate the Prisma Client in that location. Command: prisma generate.
🤖 Prompt for AI Agents
In
examples/todo-with-auth0/packages/backend/src/modules/accounts/users/services/user.crud.ts
around line 1, CI is failing due to stale generated Prisma client outputs;
delete any existing src/generated/prisma directories across all example packages
(remove them from working tree and history if needed), add .gitignore entries to
ignore those generated Prisma client folders (e.g., src/generated/prisma or
packages/*/src/generated/prisma) in each example package and the repo root to
prevent committing them, then run prisma generate in each package to regenerate
the client and commit only the regenerated artifacts if required by build
(preferably keep generated clients out of repo).
| import type { File } from '@prisma/client'; | ||
| import type { Readable } from 'node:stream'; | ||
|
|
||
| import type { File } from '@src/generated/prisma/client.js'; |
There was a problem hiding this comment.
🧩 Analysis chain
Switch to generated Prisma client path LGTM.
Type‑only import, absolute alias, and .js extension comply with our guidelines. As per coding guidelines.
CI is failing Prisma generate due to a non‑empty output dir in a different example (blog-with-auth). Please audit generated dirs and remove stray/tracked files before generation.
Run:
Also confirm that @src/generated/prisma/client.js exports the File type as expected in this example after generation.
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Scanning for generated Prisma output directories under examples/* ..."
find examples -type d -path '*/src/generated/prisma' -print
echo
echo "Listing contents and git-tracked files in each:"
while IFS= read -r d; do
echo "=== $d"
ls -la "$d" || true
echo "--- git tracked:"
git ls-files -- "$d" || true
done < <(find examples -type d -path '*/src/generated/prisma' -print)
echo
echo "Hint: remove tracked files/dirs under these paths, and ensure .gitignore covers them."Length of output: 301
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Generated Prisma dirs under examples/:"
find examples -type d -path '*/src/generated/prisma'
echo
for d in $(find examples -type d -path '*/src/generated/prisma'); do
echo "=== Contents of $d ==="
ls -la "$d" || true
echo "--- Git-tracked files in $d ---"
git ls-files -- "$d" || true
echo
done
echo "Checking for 'File' export in todo-with-auth0 generated client files:"
grep -R "export.*File" -n examples/todo-with-auth0/packages/backend/src/generated/prisma || trueLength of output: 1107
Remove tracked Prisma artifacts and verify client exports
- Untrack and gitignore
examples/*/src/generated/prisma/.templates-info.jsonsoprisma generatecan run cleanly. - Run
npx prisma generatein each example and confirm that@src/generated/prisma/client.jsexports theFiletype in the todo-with-auth0 backend.
| @@ -1,5 +1,4 @@ | |||
| import type { Prisma, TodoList } from '@prisma/client'; | |||
|
|
|||
| import type { Prisma, TodoList } from '@src/generated/prisma/client.js'; | |||
There was a problem hiding this comment.
🧩 Analysis chain
Verify the generated Prisma client path is properly set up.
The import path change aligns with the PR's migration to the new Prisma generator architecture. However, a pipeline failure in a related example (blog-with-auth) indicates that the output path may not be correctly initialized. Ensure that:
- The Prisma generator is configured to output to
src/generated/prisma - The generated files exist at
@src/generated/prisma/client.js - The
@src/path alias is correctly configured in tsconfig - The
.gitignorehas been updated to handle the generated directory appropriately
Run the following script to verify the setup:
🏁 Script executed:
#!/bin/bash
# Verify Prisma client generation setup
# Check if the generated client file exists
if [ -f "examples/todo-with-auth0/packages/backend/src/generated/prisma/client.js" ]; then
echo "✓ Generated client file exists"
else
echo "✗ Generated client file NOT found at expected location"
fi
# Check Prisma schema generator configuration
echo "--- Prisma generator config ---"
rg -A 5 'generator.*client' examples/todo-with-auth0/packages/backend/prisma/schema.prisma
# Check tsconfig path alias configuration
echo "--- TypeScript path alias for @src ---"
rg '"@src/\*"' examples/todo-with-auth0/packages/backend/tsconfig.json
# Check gitignore for generated directory
echo "--- Gitignore entries ---"
rg 'generated' examples/todo-with-auth0/packages/backend/.gitignore examples/todo-with-auth0/.gitignore .gitignore 2>/dev/null || echo "No gitignore entries found"Length of output: 842
Run prisma generate and add JSDoc
- Prisma client file (
src/generated/prisma/client.js) is missing; configure local/CI builds to runprisma generatebefore building. - Add JSDoc to all exported functions and interfaces in this file.
🧰 Tools
🪛 GitHub Actions: Lint Examples
[error] 1-1: Prisma generate failed: The output path '/home/runner/work/baseplate/baseplate/examples/blog-with-auth/packages/backend/src/generated/prisma' exists and is not empty but doesn't look like a generated Prisma Client. Please remove the existing directory if you indeed want to generate the Prisma Client in that location. Command: prisma generate.
🤖 Prompt for AI Agents
In
examples/todo-with-auth0/packages/backend/src/modules/todos/services/todo-list.crud.ts
around line 1, the file imports the generated Prisma client which is missing
because prisma generate hasn't been run; update local and CI build steps to run
`prisma generate` (e.g., add it to npm scripts or CI pipeline before build) so
src/generated/prisma/client.js is created and the import resolves, and ensure
the TS/JS project paths point to the generated output; additionally, add JSDoc
comments to every exported function and interface in this file (brief
description, parameter and return tags) to satisfy the documentation
requirement.
| import { PrismaClient } from '../generated/prisma/client.js'; | ||
|
|
||
| export const prisma = new PrismaClient(); |
There was a problem hiding this comment.
🧩 Analysis chain
Critical: Pipeline failure due to existing generated directory.
The import path change is correct, but the pipeline is failing because the generated Prisma client directory already exists and conflicts with the new generation process.
Error from pipeline:
The output path '/home/runner/work/baseplate/baseplate/examples/blog-with-auth/packages/backend/src/generated/prisma' exists and is not empty but doesn't look like a generated Prisma Client.
Migration steps needed:
- Remove existing generated Prisma directories in all examples before running
prisma generate - Update the migration documentation or PR description with these cleanup steps
- Consider adding a pre-generate cleanup script or updating
.gitignoreif these directories should not be committed
Run the following script to identify all examples that may need cleanup:
🏁 Script executed:
#!/bin/bash
# Find all generated prisma directories that might conflict
fd -t d -p 'src/generated/prisma' examples/Length of output: 126
Critical: Remove conflicting generated Prisma client directories before running prisma generate.
- Delete
examples/*/packages/backend/src/generated/prismain bothblog-with-authandtodo-with-auth0. - Add a pre-generate cleanup script or hook to remove these directories automatically.
- Update documentation or PR description with these cleanup steps.
- Consider updating
.gitignoreto prevent committing generated client directories.
🧰 Tools
🪛 GitHub Actions: Lint Examples
[error] 1-1: Prisma generate failed: The output path '/home/runner/work/baseplate/baseplate/examples/blog-with-auth/packages/backend/src/generated/prisma' exists and is not empty but doesn't look like a generated Prisma Client. Please remove the existing directory if you indeed want to generate the Prisma Client in that location. Command: prisma generate.
🤖 Prompt for AI Agents
In examples/todo-with-auth0/packages/backend/src/services/prisma.ts around lines
1 to 3, the repo contains committed/generated Prisma client directories that
conflict with prisma generate; remove the directories
examples/*/packages/backend/src/generated/prisma in both blog-with-auth and
todo-with-auth0, add a pre-generate cleanup step (package script or prisma
generate hook) that deletes those generated folders before running prisma
generate, update the repo docs/PR template to mention the cleanup step, and add
the generated client paths to .gitignore to prevent committing them in the
future.
| "prismaGeneratedImportsProvider": { | ||
| "importName": "prismaGeneratedImportsProvider", | ||
| "packagePathSpecifier": "@baseplate-dev/fastify-generators:src/generators/prisma/_providers/prisma-generated-imports.ts" | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
Good addition for types-file-category.
This enables Prisma type imports from the generated client in the types template. Consistent with the new architecture.
Double‑check if services/upload-file (variables include TPL_FILE_MODEL_TYPE) needs Prisma types. If so, mirror this provider there as well to avoid falling back to @prisma/client.
🏁 Script executed:
#!/bin/bash
# Inspect the upload-file template for Prisma type usage
set -euo pipefail
fd -a -H 'upload-file.ts' | while read -r f; do
echo "=== $f"
rg -n -C2 -e 'Prisma\.' -e 'TPL_FILE_MODEL_TYPE' "$f" || true
doneLength of output: 1029
Add Prisma import provider to service-file-category
The upload-file template uses TPL_FILE_MODEL_TYPE, so include prismaGeneratedImportsProvider under service-file-category in extractor.json to import types from the generated Prisma client instead of falling back to @prisma/client.
🤖 Prompt for AI Agents
In plugins/plugin-storage/src/generators/fastify/storage-module/extractor.json
around lines 250 to 253, the service-file-category is missing the
prismaGeneratedImportsProvider used by the upload-file template (which relies on
TPL_FILE_MODEL_TYPE); add an entry for "prismaGeneratedImportsProvider" under
the "service-file-category" array/object with the same shape as other providers
(importName: "prismaGeneratedImportsProvider" and packagePathSpecifier:
"@baseplate-dev/fastify-generators:src/generators/prisma/_providers/prisma-generated-imports.ts")
so generated Prisma client types are imported instead of falling back to
@prisma/client.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
examples/todo-with-auth0/packages/backend/package.json (1)
1-8: Switch to ESM and add packageManager per guidelines.This example package should be ESM-only and enforce pnpm 10+ via packageManager. Update:
- "type": "module"
- Add top-level: "packageManager": "pnpm@10.16.0"
This also avoids potential interop issues with the ESM-ready Prisma Client. As per coding guidelines.
Example:
{ "packageManager": "pnpm@10.16.0", "type": "module", "engines": { "node": "^22.18.0", "pnpm": "^10.16.0" }, "volta": { "node": "22.18.0" } }Also applies to: 109-115
examples/blog-with-auth/packages/backend/package.json (1)
7-7: Switch to ESM: set"type": "module"for examples/blog-with-auth packages.This example must be ESM-only, and Prisma 6’s client is ESM. Keeping CommonJS risks import errors. Change to ESM.
As per coding guidelines
- "type": "commonjs", + "type": "module",
♻️ Duplicate comments (3)
examples/blog-with-auth/packages/backend/prisma/schema.prisma (1)
2-4: engineType value likely invalid; set to "library" or remove. Provider/output look good.
provider = "prisma-client"is correct. However,engineType = "client"is not a valid value; use"library"(Node-API, recommended) or omit to use default. Also, ensure the target output directory is cleaned before generation to avoid the “exists and is not empty” error reported in CI.Apply one of:
generator client { provider = "prisma-client" output = "../src/generated/prisma" - engineType = "client" + engineType = "library" }or
generator client { provider = "prisma-client" output = "../src/generated/prisma" - engineType = "client" }Verification script to find invalid values and stale dirs:
#!/bin/bash # 1) Check for invalid engineType values rg -nP --type=prisma -C1 'generator\s+\w+\s*\{(?s).*?engineType\s*=\s*"client"' examples/ # 2) List existing generated Prisma dirs that may block generation fd -td 'generated/prisma' examples/ -x sh -c 'echo "Dir: $1"; fd -t f . "$1" | head -n 5; echo' sh {}examples/todo-with-auth0/packages/backend/prisma/schema.prisma (1)
2-4: engineType must not be "client"; use "library" or remove. Also clean output dir pre-generate.
provider = "prisma-client"is correct. ChangeengineType = "client"to"library"(Node-API) or remove it. Keepoutput = "../src/generated/prisma", but ensure the folder is emptied before generation to avoid the known Prisma error.Apply one of:
generator client { provider = "prisma-client" output = "../src/generated/prisma" - engineType = "client" + engineType = "library" }or
generator client { provider = "prisma-client" output = "../src/generated/prisma" - engineType = "client" }Quick check:
#!/bin/bash rg -nP --type=prisma 'engineType\s*=\s*"client"' examples/examples/blog-with-auth/packages/backend/package.json (1)
21-21: Blocker: pre-clean generated client directory beforeprisma generate.The new JS-based generator refuses to overwrite a non-empty output (e.g.,
src/generated/prisma). Add a pre-clean to unblock installs.Apply this minimal, cross-platform change (no extra deps):
- "postinstall": "prisma generate", + "postinstall": "node -e \"try{require('fs').rmSync('src/generated/prisma',{recursive:true,force:true})}catch(e){}\" && prisma generate",If you prefer a cleaner script, add
rimrafas a devDependency and userimraf src/generated/prisma && prisma generate.
🧹 Nitpick comments (3)
packages/fastify-generators/src/generators/prisma/prisma/prisma.generator.ts (3)
123-123: Add return type annotation.The
runfunction should have an explicit return type annotation to comply with TypeScript strict typing guidelines.As per coding guidelines.
Apply this diff:
- run({ eslintConfig, prettier }) { + run({ eslintConfig, prettier }): void {
209-224: Add return type annotation.The gitignore task logic is sound and correctly excludes generated Prisma files while conditionally including template metadata. However, the
runfunction should have an explicit return type annotation.As per coding guidelines.
Apply this diff:
- run({ nodeGitIgnore }) { + run({ nodeGitIgnore }): { build: (builder: any) => void } {
287-291: Remove redundantengineTypefrom Prisma generator.
provider: 'prisma-client'is correct for Prisma v6.17.1;engineType: 'client'is optional (only needed to force the JS-only engine) and can be omitted.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (17)
examples/blog-with-auth/packages/backend/baseplate/generated/.gitignoreis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/baseplate/generated/package.jsonis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/baseplate/generated/src/generated/prisma/client.tsis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/src/generated/prisma/client.tsis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlexamples/todo-with-auth0/packages/backend/baseplate/generated/.gitignoreis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/baseplate/generated/package.jsonis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/baseplate/generated/src/generated/prisma/client.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/src/generated/prisma/client.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamltests/simple/packages/backend/baseplate/generated/package.jsonis excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/packages/backend/package.jsonis excluded by!tests/**tests/simple/packages/backend/prisma/schema.prismais excluded by!tests/**tests/simple/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!tests/**
📒 Files selected for processing (8)
examples/blog-with-auth/packages/backend/.gitignore(1 hunks)examples/blog-with-auth/packages/backend/package.json(2 hunks)examples/blog-with-auth/packages/backend/prisma/schema.prisma(1 hunks)examples/todo-with-auth0/packages/backend/.gitignore(1 hunks)examples/todo-with-auth0/packages/backend/package.json(2 hunks)examples/todo-with-auth0/packages/backend/prisma/schema.prisma(1 hunks)packages/fastify-generators/src/constants/fastify-packages.ts(1 hunks)packages/fastify-generators/src/generators/prisma/prisma/prisma.generator.ts(10 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- examples/blog-with-auth/packages/backend/.gitignore
- examples/todo-with-auth0/packages/backend/.gitignore
🧰 Additional context used
📓 Path-based instructions (6)
**/*
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
Use kebab-case for file names
Files:
examples/blog-with-auth/packages/backend/prisma/schema.prismaexamples/todo-with-auth0/packages/backend/package.jsonpackages/fastify-generators/src/constants/fastify-packages.tsexamples/blog-with-auth/packages/backend/package.jsonexamples/todo-with-auth0/packages/backend/prisma/schema.prismapackages/fastify-generators/src/generators/prisma/prisma/prisma.generator.ts
examples/todo-with-auth0/{package.json,packages/**/package.json}
📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)
examples/todo-with-auth0/{package.json,packages/**/package.json}: Module system must be ESM only ("type": "module"in package.json)
Package manager is pnpm 10+ (enforce viapackageManagerfield)
Node version 22+ with Volta pinned to 22.18.0
Files:
examples/todo-with-auth0/packages/backend/package.json
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{ts,tsx}: TypeScript with strict type checking
Always include return types on top-level functions including React components (React.ReactElement)
Include absolute paths in import statements via tsconfig paths (@src/is the alias forsrc/)
If a particular interface or type is not exported, change the file so it is exportedIf a particular interface or type is not exported, update the TypeScript file so it is exported
Files:
packages/fastify-generators/src/constants/fastify-packages.tspackages/fastify-generators/src/generators/prisma/prisma/prisma.generator.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
Node 16 module resolution - include file extensions in imports (
.js)
Files:
packages/fastify-generators/src/constants/fastify-packages.tspackages/fastify-generators/src/generators/prisma/prisma/prisma.generator.ts
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{ts,tsx,js}: Sort imports by group: external libs first, then local imports
Use camelCase for variables/functions, PascalCase for types/classes
Order functions such that functions are placed below the variables/functions they use
We use the prefer using nullish coalescing operator (??) ESLint rule instead of a logical or (||), as it is a safer operator
Use console.info/warn/error instead of console.log
Files:
packages/fastify-generators/src/constants/fastify-packages.tspackages/fastify-generators/src/generators/prisma/prisma/prisma.generator.ts
examples/blog-with-auth/{package.json,packages/**/package.json}
📄 CodeRabbit inference engine (examples/blog-with-auth/CLAUDE.md)
Use ESM only by setting
"type": "module"in package.json
Files:
examples/blog-with-auth/packages/backend/package.json
🧠 Learnings (1)
📚 Learning: 2025-09-03T17:03:33.250Z
Learnt from: CR
PR: halfdomelabs/baseplate#0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-09-03T17:03:33.250Z
Learning: Applies to examples/todo-with-auth0/{package.json,packages/**/package.json} : Node version 22+ with Volta pinned to 22.18.0
Applied to files:
examples/todo-with-auth0/packages/backend/package.json
🧬 Code graph analysis (1)
packages/fastify-generators/src/generators/prisma/prisma/prisma.generator.ts (8)
packages/core-generators/src/utils/extract-packages.ts (1)
extractPackageVersions(7-14)packages/fastify-generators/src/constants/fastify-packages.ts (1)
FASTIFY_PACKAGES(1-90)packages/core-generators/src/generators/node/prettier/prettier.generator.ts (1)
prettierProvider(64-65)packages/core-generators/src/generators/node/node-git-ignore/node-git-ignore.generator.ts (1)
nodeGitIgnoreProvider(25-25)packages/fastify-generators/src/generators/prisma/_providers/prisma-generated-imports.ts (1)
prismaGeneratedImportsProvider(16-19)packages/fastify-generators/src/generators/prisma/prisma/generated/index.ts (1)
PRISMA_PRISMA_GENERATED(6-11)packages/fastify-generators/src/writers/prisma-schema/schema.ts (2)
PrismaSchemaFile(81-136)createPrismaSchemaGeneratorBlock(37-50)packages/utils/src/string/quot.ts (1)
doubleQuot(15-17)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test E2E
- GitHub Check: Lint
🔇 Additional comments (9)
packages/fastify-generators/src/constants/fastify-packages.ts (2)
41-42: LGTM! Version alignment is correct.The Prisma package versions are properly aligned at 6.17.1, which follows best practices for keeping Prisma CLI, engines, and @prisma/client versions synchronized.
Based on learnings.
43-43: @prisma/adapter-pg usage confirmed: It’s referenced insrc/generators/prisma/prisma/prisma.generator.ts(line 108) withinnode.packages.addPackagesfor prod dependencies.packages/fastify-generators/src/generators/prisma/prisma/prisma.generator.ts (5)
7-7: LGTM! Import additions align with the new Prisma generator structure.The new imports for
nodeGitIgnoreProvider,prettierProvider,doubleQuot, andprismaGeneratedImportsProviderare properly placed and necessary for the updated Prisma generation workflow.Also applies to: 12-12, 24-24, 47-47
106-111: LGTM! Package dependencies correctly updated for Prisma 6.17.1.The prod dependencies now explicitly include
@prisma/clientand@prisma/adapter-pg, whileprismaCLI remains in dev dependencies. This aligns with the Prisma 6.17.1 upgrade. Based on learnings.
125-126: LGTM! Ignore paths updated to match new Prisma output location.The eslint and prettier ignore patterns now correctly reference
src/generated/prisma/**/*.ts, consistent with the new output path configuration.
252-252: LGTM! Rendering order ensures generated code is available before service.Rendering
generatedGroupbeforeserviceensures the generated Prisma client code is properly emitted before the service code that depends on it.
357-357: prismaGeneratedImports['*'] wildcard accessor is correct TheprismaGeneratedImportsSchemaexplicitly includes a'*'key, so usingprismaGeneratedImports['*'].moduleSpecifierproperly resolves to your generated Prisma client.examples/blog-with-auth/packages/backend/package.json (2)
82-82: Prisma versions aligned—LGTM.
prismaand@prisma/clientare both at 6.17.1. Good consistency.
47-49: Removepgdependency suggestion
@prisma/adapter-pg@6.17.1already listspgunder its own dependencies, so the driver installs automatically and no manual addition is needed.Likely an incorrect or invalid review comment.
| "@prisma/adapter-pg": "6.17.1", | ||
| "@prisma/client": "6.17.1", |
There was a problem hiding this comment.
🧩 Analysis chain
Prisma bumped correctly; align generator engineType and add pre-generate clean.
Deps pinned to 6.17.1 look good, including @prisma/adapter-pg. Ensure your Prisma schema uses engineType = "library" (or omit) rather than "client", and clean the output dir before prisma generate to avoid CI failures.
Suggested scripts (apply in "scripts"):
{
"clean:prisma": "rimraf src/generated/prisma",
"postinstall": "pnpm clean:prisma && prisma generate"
}Verification:
Also applies to: 99-99
🏁 Script executed:
#!/bin/bash
rg -nP 'engineType\s*=\s*"client"' examples/Length of output: 393
🏁 Script executed:
#!/bin/bash
rg -n '"clean:prisma"' -n examples/todo-with-auth0/packages/backend/package.json
rg -n '"postinstall"' -n examples/todo-with-auth0/packages/backend/package.jsonLength of output: 40
Align Prisma engineType and add pre-generate clean script
- In prisma/schema.prisma, change
engineType = "client"→engineType = "library"(or remove line for default). - In examples/todo-with-auth0/packages/backend/package.json scripts, add:
"clean:prisma": "rimraf src/generated/prisma", "postinstall": "npm run clean:prisma && prisma generate"
🤖 Prompt for AI Agents
In examples/todo-with-auth0/packages/backend/package.json around lines 51-52,
update the Prisma runtime configuration by aligning prisma engine type in
prisma/schema.prisma: change engineType = "client" to engineType = "library" (or
remove the engineType line to use the default); then in package.json add two npm
scripts to ensure generated client is cleaned and regenerated: a "clean:prisma"
script that removes src/generated/prisma (e.g., using rimraf) and a
"postinstall" script that runs the clean and then prisma generate; ensure rimraf
is added to devDependencies if not present.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
examples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts (1)
12-84: Add JSDoc comments to all exported functions.All exported functions are missing JSDoc documentation. Per the coding guidelines for this path pattern, JSDoc must document parameters, return values, and function purpose.
As per coding guidelines.
Apply this diff to add JSDoc for all exported functions:
+/** + * Replaces the database name in a PostgreSQL connection string. + * + * @param connectionString - The original PostgreSQL connection string + * @param database - The new database name to use + * @returns A new connection string with the replaced database name + */ export function replaceDatabase( connectionString: string, database: string, ): string { const { host, user, password, port } = parse(connectionString); return `postgresql://${user ?? ''}:${password ?? ''}@${host ?? ''}:${ port ? port : 5432 }/${database}`; } +/** + * Creates a PrismaClient instance configured for testing with the Prisma Pg adapter. + * + * @param databaseUrl - The PostgreSQL database connection URL + * @returns A configured PrismaClient instance + */ export function getTestPrisma(databaseUrl: string): PrismaClient { return new PrismaClient({ adapter: new PrismaPg({ connectionString: databaseUrl }), }); } +/** + * Creates a fresh test database by dropping and recreating it, then applying migrations. + * + * @param databaseUrl - The PostgreSQL database connection URL for the default database + * @returns A connection string for the newly created test database + */ export async function createTestDatabase(databaseUrl: string): Promise<string> { const prismaClient = getTestPrisma(databaseUrl); try { await prismaClient.$executeRaw`DROP DATABASE IF EXISTS ${Prisma.raw( TEST_DATABASE_NAME, )}`; await prismaClient.$executeRaw`CREATE DATABASE ${Prisma.raw( TEST_DATABASE_NAME, )}`; } finally { await prismaClient.$disconnect(); } const testDatabaseUrl = replaceDatabase(databaseUrl, TEST_DATABASE_NAME); execSync('pnpm prisma migrate deploy', { cwd: path.resolve(__dirname, '../../../'), env: { ...process.env, DATABASE_URL: testDatabaseUrl, }, }); return testDatabaseUrl; } +/** + * Creates a test database from a template database for faster test setup. + * + * @param databaseUrl - The PostgreSQL database connection URL for the default database + * @param templateDatabaseName - The name of the template database to clone from + * @returns A connection string for the newly created test database + */ export async function createTestDatabaseFromTemplate( databaseUrl: string, templateDatabaseName: string, ): Promise<string> { const prismaClient = getTestPrisma(databaseUrl); const newDatabaseName = `${templateDatabaseName}-${nanoid(8)}`; try { await prismaClient.$executeRaw`CREATE DATABASE ${Prisma.raw( newDatabaseName, )} WITH TEMPLATE ${Prisma.raw(templateDatabaseName)}`; } finally { await prismaClient.$disconnect(); } return replaceDatabase(databaseUrl, newDatabaseName); } +/** + * Destroys the test database by dropping it. + * + * @param databaseUrl - The PostgreSQL database connection URL for the default database + */ export async function destroyTestDatabase(databaseUrl: string): Promise<void> { const prismaClient = getTestPrisma(databaseUrl); try { await prismaClient.$executeRaw`DROP DATABASE IF EXISTS ${Prisma.raw( TEST_DATABASE_NAME, )}`; } finally { await prismaClient.$disconnect(); } }examples/todo-with-auth0/packages/backend/package.json (1)
7-7: Switch to ESM: set "type": "module" (policy).Examples must be ESM-only. Update the module type.
As per coding guidelines
- "type": "commonjs", + "type": "module",
♻️ Duplicate comments (2)
examples/blog-with-auth/packages/backend/package.json (1)
21-21: Prisma generate still blocked by pre-existing output directory
postinstallcontinues to callprisma generatewithout first clearingsrc/generated/prisma, so the 6.17.1 JS generator will refuse to overwrite the tracked files already living there and everypnpm installwill keep failing (same pipeline error as before). Please delete/relocate the committed files undersrc/generated/prismaor add a cleanup step (e.g., remove the directory before running Prisma) so the generator can complete.examples/todo-with-auth0/packages/backend/package.json (1)
20-21: Add pre-generate clean and chain in postinstall (prevents stale Prisma client).Clean the output dir before prisma generate, and add rimraf devDep.
"scripts": { @@ - "postinstall": "prisma generate", + "clean:prisma": "rimraf src/generated/prisma", + "postinstall": "pnpm run clean:prisma && prisma generate",Add devDependency (version per your constraints):
{ "devDependencies": { "rimraf": "^6" } }If the generator now writes to src/generated/prisma, confirm this matches schema and tooling.
🧹 Nitpick comments (4)
packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.ts (1)
3-8: Consider reordering imports per coding guidelines.The imports are slightly out of order according to the coding guidelines, which specify external libraries first, then local imports. Consider grouping node built-in modules together and placing them before or after external packages consistently.
Apply this diff to improve import organization:
-import { Prisma, PrismaClient } from '%prismaGeneratedImports'; -import { PrismaPg } from '@prisma/adapter-pg'; -import { nanoid } from 'nanoid'; -import { execSync } from 'node:child_process'; -import path from 'node:path'; -import { parse } from 'pg-connection-string'; +import { PrismaPg } from '@prisma/adapter-pg'; +import { nanoid } from 'nanoid'; +import { parse } from 'pg-connection-string'; +import { execSync } from 'node:child_process'; +import path from 'node:path'; + +import { Prisma, PrismaClient } from '%prismaGeneratedImports';packages/fastify-generators/src/generators/prisma/prisma/templates/src/services/prisma.ts (1)
1-1: Template directive—ensure generated code is type-safe.The
ts-nocheckdirective disables all TypeScript checking. While necessary for template files with placeholders like%configServiceImports, ensure that the generated code (post-template processing) removes this directive to maintain type safety.examples/todo-with-auth0/packages/backend/package.json (1)
109-115: Add packageManager field to enforce pnpm 10+ (policy).Examples must enforce pnpm via packageManager.
As per coding guidelines
"volta": { "node": "22.18.0" - } + }, + "packageManager": "pnpm@10.16.0"packages/fastify-generators/src/generators/prisma/prisma/extractor.json (1)
42-47: Normalize provider path extension to .js (ESM consistency)packagePathSpecifier points at a .ts file. Our guidelines prefer .js in imports under Node 16 module resolution; other imports in this PR use .js.
As long as the generator loader resolves compiled outputs, switch to .js:
- "packagePathSpecifier": "@baseplate-dev/fastify-generators:src/generators/core/config-service/generated/ts-import-providers.ts" + "packagePathSpecifier": "@baseplate-dev/fastify-generators:src/generators/core/config-service/generated/ts-import-providers.js"If the loader intentionally reads source .ts, ignore this and keep as-is. As per coding guidelines.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (34)
examples/blog-with-auth/packages/admin/src/generated/graphql.tsxis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/baseplate/generated/package.jsonis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/baseplate/generated/src/plugins/graphql/builder.tsis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/baseplate/generated/src/services/prisma.tsis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/baseplate/generated/src/tests/helpers/db.test-helper.tsis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/packages/backend/src/generated/prisma/.templates-info.jsonis excluded by!**/generated/**,!**/generated/**examples/blog-with-auth/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlexamples/todo-with-auth0/packages/backend/baseplate/generated/package.jsonis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/baseplate/generated/src/plugins/graphql/builder.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/baseplate/generated/src/services/prisma.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/baseplate/generated/src/tests/helpers/db.test-helper.tsis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/src/generated/prisma/.templates-info.jsonis excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlpackages/fastify-generators/src/generators/pothos/pothos-prisma/generated/index.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/pothos/pothos-prisma/generated/template-paths.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/pothos/pothos-prisma/generated/template-renderers.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/pothos/pothos-prisma/generated/ts-import-providers.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/pothos/pothos-prisma/generated/typed-templates.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/prisma/prisma/generated/template-renderers.tsis excluded by!**/generated/**,!**/generated/**packages/fastify-generators/src/generators/prisma/prisma/generated/typed-templates.tsis excluded by!**/generated/**,!**/generated/**tests/simple/packages/backend/baseplate/file-id-map.jsonis excluded by!tests/**tests/simple/packages/backend/baseplate/generated/package.jsonis excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/packages/backend/baseplate/generated/src/plugins/graphql/builder.tsis excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/packages/backend/baseplate/generated/src/services/prisma.tsis excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/packages/backend/baseplate/generated/src/tests/helpers/db.test-helper.tsis excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/packages/backend/package.jsonis excluded by!tests/**tests/simple/packages/backend/prisma/schema.prismais excluded by!tests/**tests/simple/packages/backend/src/plugins/graphql/builder.tsis excluded by!tests/**tests/simple/packages/backend/src/services/prisma.tsis excluded by!tests/**tests/simple/packages/backend/src/tests/helpers/db.test-helper.tsis excluded by!tests/**tests/simple/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!tests/**
📒 Files selected for processing (22)
.changeset/short-files-jam.md(1 hunks)examples/blog-with-auth/packages/backend/baseplate/file-id-map.json(2 hunks)examples/blog-with-auth/packages/backend/package.json(2 hunks)examples/blog-with-auth/packages/backend/prisma/schema.prisma(1 hunks)examples/blog-with-auth/packages/backend/schema.graphql(3 hunks)examples/blog-with-auth/packages/backend/src/plugins/graphql/builder.ts(2 hunks)examples/blog-with-auth/packages/backend/src/services/prisma.ts(1 hunks)examples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts(2 hunks)examples/todo-with-auth0/packages/backend/baseplate/file-id-map.json(2 hunks)examples/todo-with-auth0/packages/backend/package.json(2 hunks)examples/todo-with-auth0/packages/backend/prisma/schema.prisma(1 hunks)examples/todo-with-auth0/packages/backend/src/plugins/graphql/builder.ts(2 hunks)examples/todo-with-auth0/packages/backend/src/services/prisma.ts(1 hunks)examples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.ts(2 hunks)packages/core-generators/src/renderers/typescript/import-maps/ts-import-map.ts(2 hunks)packages/fastify-generators/src/constants/fastify-packages.ts(2 hunks)packages/fastify-generators/src/generators/pothos/pothos-prisma/extractor.json(1 hunks)packages/fastify-generators/src/generators/pothos/pothos-prisma/index.ts(1 hunks)packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts(5 hunks)packages/fastify-generators/src/generators/prisma/prisma/extractor.json(2 hunks)packages/fastify-generators/src/generators/prisma/prisma/templates/src/services/prisma.ts(1 hunks)packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.ts(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/fastify-generators/src/generators/pothos/pothos-prisma/extractor.json
🚧 Files skipped from review as they are similar to previous changes (3)
- examples/todo-with-auth0/packages/backend/prisma/schema.prisma
- examples/blog-with-auth/packages/backend/src/services/prisma.ts
- examples/blog-with-auth/packages/backend/prisma/schema.prisma
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{ts,tsx}: TypeScript with strict type checking
Always include return types on top-level functions including React components (React.ReactElement)
Include absolute paths in import statements via tsconfig paths (@src/is the alias forsrc/)
If a particular interface or type is not exported, change the file so it is exportedIf a particular interface or type is not exported, update the TypeScript file so it is exported
Files:
packages/fastify-generators/src/constants/fastify-packages.tspackages/core-generators/src/renderers/typescript/import-maps/ts-import-map.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/plugins/graphql/builder.tspackages/fastify-generators/src/generators/prisma/prisma/templates/src/services/prisma.tsexamples/blog-with-auth/packages/backend/src/plugins/graphql/builder.tspackages/fastify-generators/src/generators/pothos/pothos-prisma/index.tsexamples/todo-with-auth0/packages/backend/src/services/prisma.tspackages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.tsexamples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
Node 16 module resolution - include file extensions in imports (
.js)
Files:
packages/fastify-generators/src/constants/fastify-packages.tspackages/core-generators/src/renderers/typescript/import-maps/ts-import-map.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/plugins/graphql/builder.tspackages/fastify-generators/src/generators/prisma/prisma/templates/src/services/prisma.tsexamples/blog-with-auth/packages/backend/src/plugins/graphql/builder.tspackages/fastify-generators/src/generators/pothos/pothos-prisma/index.tsexamples/todo-with-auth0/packages/backend/src/services/prisma.tspackages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.tsexamples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{ts,tsx,js}: Sort imports by group: external libs first, then local imports
Use camelCase for variables/functions, PascalCase for types/classes
Order functions such that functions are placed below the variables/functions they use
We use the prefer using nullish coalescing operator (??) ESLint rule instead of a logical or (||), as it is a safer operator
Use console.info/warn/error instead of console.log
Files:
packages/fastify-generators/src/constants/fastify-packages.tspackages/core-generators/src/renderers/typescript/import-maps/ts-import-map.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/plugins/graphql/builder.tspackages/fastify-generators/src/generators/prisma/prisma/templates/src/services/prisma.tsexamples/blog-with-auth/packages/backend/src/plugins/graphql/builder.tspackages/fastify-generators/src/generators/pothos/pothos-prisma/index.tsexamples/todo-with-auth0/packages/backend/src/services/prisma.tspackages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.tsexamples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts
**/*
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
Use kebab-case for file names
Files:
packages/fastify-generators/src/constants/fastify-packages.tsexamples/todo-with-auth0/packages/backend/baseplate/file-id-map.jsonpackages/fastify-generators/src/generators/prisma/prisma/extractor.jsonexamples/todo-with-auth0/packages/backend/package.jsonpackages/core-generators/src/renderers/typescript/import-maps/ts-import-map.tspackages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.tsexamples/blog-with-auth/packages/backend/baseplate/file-id-map.jsonexamples/todo-with-auth0/packages/backend/src/plugins/graphql/builder.tsexamples/blog-with-auth/packages/backend/package.jsonpackages/fastify-generators/src/generators/prisma/prisma/templates/src/services/prisma.tsexamples/blog-with-auth/packages/backend/schema.graphqlexamples/blog-with-auth/packages/backend/src/plugins/graphql/builder.tspackages/fastify-generators/src/generators/pothos/pothos-prisma/index.tsexamples/todo-with-auth0/packages/backend/src/services/prisma.tspackages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.tsexamples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts
examples/todo-with-auth0/{package.json,packages/**/package.json}
📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)
examples/todo-with-auth0/{package.json,packages/**/package.json}: Module system must be ESM only ("type": "module"in package.json)
Package manager is pnpm 10+ (enforce viapackageManagerfield)
Node version 22+ with Volta pinned to 22.18.0
Files:
examples/todo-with-auth0/packages/backend/package.json
**/*.test-helper.ts
📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)
Extract common setup code into test helpers, which can be new files named
*.test-helper.ts
Files:
packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.tsexamples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts
**/*.{test,test-helper}.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)
Extract repeated logic into reusable helper functions
Files:
packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.tsexamples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts
examples/todo-with-auth0/packages/{admin,backend}/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)
examples/todo-with-auth0/packages/{admin,backend}/src/**/*.{ts,tsx}: Always use .js extensions in import statements, even when importing from TypeScript files
Useimport typefor type-only imports in TypeScript
Always specify explicit return types for all functions
Files:
examples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.tsexamples/todo-with-auth0/packages/backend/src/plugins/graphql/builder.tsexamples/todo-with-auth0/packages/backend/src/services/prisma.ts
examples/todo-with-auth0/{packages/admin/src/{app,components,pages,hooks,services}/**/*.{ts,tsx},packages/backend/src/{modules,plugins,prisma,services,utils}/**/*.{ts,tsx}}
📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)
Add JSDoc to all exported functions, interfaces, and classes including descriptions, params, returns, and fields (exclude generated code)
Files:
examples/todo-with-auth0/packages/backend/src/plugins/graphql/builder.tsexamples/todo-with-auth0/packages/backend/src/services/prisma.ts
examples/blog-with-auth/{package.json,packages/**/package.json}
📄 CodeRabbit inference engine (examples/blog-with-auth/CLAUDE.md)
Use ESM only by setting
"type": "module"in package.json
Files:
examples/blog-with-auth/packages/backend/package.json
examples/blog-with-auth/packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (examples/blog-with-auth/CLAUDE.md)
examples/blog-with-auth/packages/**/src/**/*.{ts,tsx}: Always use .js extensions in import statements (even when importing from TypeScript files)
Useimport typefor type-only imports
Always specify explicit return types for all functions
Add JSDoc to all exported functions, interfaces, and classes (document parameters, return values, and fields)
Files:
examples/blog-with-auth/packages/backend/src/plugins/graphql/builder.tsexamples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts
.changeset/**/*.md
📄 CodeRabbit inference engine (AGENTS.md)
.changeset/**/*.md: When adding a new feature or changing an existing feature, add a new Changeset in the .changeset/ directory
Changeset files must follow the specified frontmatter format with a package entry set to patch and a description body
Files:
.changeset/short-files-jam.md
**/index.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
Prefer barrel exports e.g. export * from './foo.js' instead of individual named exports
Files:
packages/fastify-generators/src/generators/pothos/pothos-prisma/index.ts
🧠 Learnings (2)
📚 Learning: 2025-09-03T17:03:33.250Z
Learnt from: CR
PR: halfdomelabs/baseplate#0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-09-03T17:03:33.250Z
Learning: Applies to examples/todo-with-auth0/{package.json,packages/**/package.json} : Node version 22+ with Volta pinned to 22.18.0
Applied to files:
examples/todo-with-auth0/packages/backend/package.json
📚 Learning: 2025-05-05T06:36:50.687Z
Learnt from: kingston
PR: halfdomelabs/baseplate#521
File: packages/react-generators/src/generators/admin/admin-crud-edit/admin-crud-edit.generator.ts:90-94
Timestamp: 2025-05-05T06:36:50.687Z
Learning: In this codebase, import paths can include `.ts` extensions, and the `resolveModuleSpecifier` function will handle them appropriately. There's no need to strip file extensions before passing paths to functions like `TsCodeUtils.importFragment`.
Applied to files:
packages/core-generators/src/renderers/typescript/import-maps/ts-import-map.ts
🧬 Code graph analysis (3)
packages/core-generators/src/renderers/typescript/import-maps/ts-import-map.ts (1)
packages/core-generators/src/renderers/typescript/fragments/creators.ts (1)
tsCodeFragment(73-83)
examples/todo-with-auth0/packages/backend/src/services/prisma.ts (6)
examples/blog-with-auth/packages/backend/src/services/prisma.ts (1)
prisma(7-7)packages/fastify-generators/src/generators/prisma/prisma/templates/src/services/prisma.ts (1)
prisma(8-8)examples/blog-with-auth/packages/backend/baseplate/generated/src/services/prisma.ts (1)
prisma(7-7)examples/todo-with-auth0/packages/backend/baseplate/generated/src/services/prisma.ts (1)
prisma(7-7)tests/simple/packages/backend/baseplate/generated/src/services/prisma.ts (1)
prisma(7-7)tests/simple/packages/backend/src/services/prisma.ts (1)
prisma(7-7)
packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts (5)
packages/fastify-generators/src/generators/pothos/pothos-prisma/generated/index.ts (1)
POTHOS_POTHOS_PRISMA_GENERATED(6-11)packages/fastify-generators/src/generators/pothos/pothos-prisma/generated/ts-import-providers.ts (1)
pothosPrismaImportsProvider(24-27)packages/core-generators/src/providers/scopes.ts (1)
packageScope(3-6)examples/blog-with-auth/packages/backend/src/plugins/graphql/builder.ts (1)
builder(26-76)packages/utils/src/string/quot.ts (1)
doubleQuot(15-17)
🔇 Additional comments (30)
.changeset/short-files-jam.md (1)
1-5: Changeset format looks goodFrontmatter and summary follow our required format; no issues spotted.
examples/blog-with-auth/packages/backend/schema.graphql (2)
62-71: Verify the JSON/JSONObject scalar wiring.
Declaring these new scalars in SDL isn’t enough; the executable schema also needs resolver implementations (e.g.,GraphQLJSON/GraphQLJSONObject). Please confirm the backend now exports those resolvers and they’re stitched into the schema so runtime parsing/serialization works.
72-93: Double-check the logOut resolver & clients.
Changing the mutation to returnLogOutPayload { success }is schema-breaking. Make sure the resolver now returns an object with that shape (not the previous boolean) and that any frontend queries/docs were updated to selectsuccess.examples/todo-with-auth0/packages/backend/baseplate/file-id-map.json (2)
76-76: New pothos-prisma types mapping looks goodGlad to see the generated types rerouted to
src/generated/prisma; this keeps the file map aligned with the new Prisma output location.
115-115: New Prisma client mapping confirmedThe file map now points the client entry at the generated JS client in
src/generated/prisma/client.ts, matching the new generator output path.packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.ts (1)
23-27: LGTM! Adapter-based initialization is correct.The migration to adapter-based PrismaClient initialization aligns with Prisma 6.x patterns. The
PrismaPgadapter will create and manage its own connection pool from the provided connection string, and the code properly calls$disconnect()in finally blocks throughout the file to clean up connections.packages/core-generators/src/renderers/typescript/import-maps/ts-import-map.ts (1)
58-71: Approve default export fragment logic
ThefragmentNameupdate correctly ensures default imports use their local binding in all generated fragments without altering the API.examples/todo-with-auth0/packages/backend/src/plugins/graphql/builder.ts (2)
62-62: LGTM! Valid Prisma plugin configuration.The addition of
dmmf: getDatamodel()is a valid configuration option for the Pothos Prisma plugin. This provides the Data Model Meta Format at build time, which is the correct approach when the Prisma client is generated separately.
8-8: Could not locateexamples/todo-with-auth0/packages/backend/src/generated/prisma/pothos-prisma-types.js; please verify that this generated file exists and exports a defaultPrismaTypesand a namedgetDatamodel.packages/fastify-generators/src/constants/fastify-packages.ts (2)
27-27: Verified Pothos versions and security
@pothos/core@4.10.0 and @pothos/plugin-prisma@4.12.0 are latest, peerDependency '*' supports Prisma 6.17.1, no security advisories found.
41-43: Prisma packages verified and secure
All Prisma packages (@prisma/client, prisma, @prisma/adapter-pg) are at version 6.17.1 (latest) with no security advisories.examples/todo-with-auth0/packages/backend/src/tests/helpers/db.test-helper.ts (1)
1-7: LGTM! Prisma migration implemented correctly.The changes successfully migrate to the generated Prisma client with adapter-based initialization:
- Correct use of absolute import path with
@src/alias (line 7)- Proper
.jsextension included per coding guidelines- Adapter pattern correctly applied with
PrismaPg(line 25)- Import order follows guidelines (external libraries first, then local imports)
Also applies to: 25-25
examples/todo-with-auth0/packages/backend/src/services/prisma.ts (1)
1-1: LGTM! Adapter-based initialization correctly implemented.The migration to adapter-based Prisma client initialization is correctly implemented:
- Proper import of
PrismaPgadapter- Configuration integration via
config.DATABASE_URL- Correct adapter instantiation and PrismaClient initialization pattern
Also applies to: 4-7
examples/blog-with-auth/packages/backend/src/tests/helpers/db.test-helper.ts (2)
1-1: LGTM! Prisma adapter imports correctly configured.The migration to
@prisma/adapter-pgand the new generated client path (@src/generated/prisma/client.js) aligns with the PR objectives for Prisma 6.17.1. The.jsextension is correctly included per the coding guidelines.Also applies to: 7-8
23-27: Approve PrismaPg constructor usageconnectionStringis confirmed as the correct parameter name forPrismaPg.examples/blog-with-auth/packages/backend/src/plugins/graphql/builder.ts (1)
62-62: LGTM! dmmf initialization updated correctly.The
dmmfconfiguration now uses the importedgetDatamodel()function, which aligns with the migration to the new Prisma generator structure. This change is consistent with the updated imports and the broader PR objectives.packages/fastify-generators/src/generators/prisma/prisma/templates/src/services/prisma.ts (2)
3-5: LGTM! Imports align with Prisma 6.x migration.The imports correctly reflect the migration:
$clientreplaces@prisma/clientas the generated client import path%configServiceImportsis an appropriate template placeholder@prisma/adapter-pgimport follows the Prisma 6.x adapter pattern
7-8: Install pg, validate DATABASE_URL, and disconnect PrismaClient on shutdown.
- Add
pg(peer dependency of@prisma/adapter-pg) topackage.json- Validate
config.DATABASE_URLinsrc/services/config.tsbefore importingPrismaClient- Hook into Fastify shutdown to call
prisma.$disconnect()examples/todo-with-auth0/packages/backend/package.json (3)
45-46: Pothos bumps look fine; check peer compat.Upgrades to @pothos/* are OK; verify no peer/TypeScript constraint changes with GraphQL 16.x.
51-52: Prisma 6.17.1 + adapter-pg: good; ensure generator/output alignment.Deps are aligned. Confirm schema uses the JS generator and correct output path, and that runtime uses @prisma/adapter-pg everywhere.
99-99: Prisma devDependency pinned to 6.17.1: LGTM.packages/fastify-generators/src/generators/pothos/pothos-prisma/index.ts (1)
1-2: Barrel surface looks goodRe-exports with .js extensions align with ESM resolution; no issues.
packages/fastify-generators/src/generators/prisma/prisma/extractor.json (3)
11-19: Ensure the client wrapper actually re-exports from the JS clientYou route Prisma’s clientOutput to @src/generated/prisma/client.js. This template exposes {src-root}/generated/prisma/client.ts — make sure that file exists and re-exports from the .js client (Node 16 ESM + TS paths).
If needed, the wrapper could be:
// src/generated/prisma/client.ts export * from '@src/generated/prisma/client.js'; export { Prisma, PrismaClient } from '@src/generated/prisma/client.js';
50-50: Good: declare dependency on the "client" templateReferencing "client" ensures the Prisma client wrapper is generated before the service consumes it.
3-9: Confirm extractor schema property name Double-check that the extractor.json schema expectsimportProvidersand notimportMapProviders.packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts (5)
25-27: Expose generated wiring from index — goodImporting POTHOS_POTHOS_PRISMA_GENERATED and the imports provider with .js extensions is consistent with our ESM setup.
40-43: Good: surface paths/imports/renderers as build tasksPublishing these via the generator task graph makes downstream consumption explicit and avoids hidden coupling.
50-52: Dependencies wiring looks rightUsing pothosPrismaImports and generated renderers as explicit deps is clean. No cycles apparent.
61-85: Prisma integration via imports provider — verify dmmf resolverSetting SchemaBuilder options:
- PrismaTypes via pothosPrismaImports.PrismaTypes.typeFragment()
- dmmf via pothosPrismaImports.getDatamodel.fragment()()
Looks correct; please confirm getDatamodel() returns the DMMF expected by PrismaPlugin.
98-104: prisma-pothos-types clientOutput/output options are correct
BothclientOutputandoutputare supported for Prisma 6 JS client; your@srcalias and relative path will resolve in the generated TS.
| import type PrismaTypes from '@src/generated/prisma/pothos-prisma-types.js'; | ||
| import type { AuthRole } from '@src/modules/accounts/constants/auth-roles.constants.js'; | ||
| import type { RequestServiceContext } from '@src/utils/request-service-context.js'; | ||
|
|
||
| import { getDatamodel } from '@src/generated/prisma/pothos-prisma-types.js'; |
There was a problem hiding this comment.
🧩 Analysis chain
LGTM! Verify generated file exports.
The import changes correctly migrate to internal generated paths as intended by the Prisma upgrade. The code follows guidelines:
- ✓ Uses
.jsextensions - ✓ Uses
import typefor type-only import - ✓ Proper import ordering
Verify that the generated file exports the expected symbols.
🏁 Script executed:
#!/bin/bash
# Verify that the generated file exists and exports PrismaTypes and getDatamodel
# Check if the file exists
fd --type f "pothos-prisma-types.ts" examples/blog-with-auth/packages/backend/src/generated/prisma/ --exec cat {} \; | head -50
# Search for PrismaTypes type export
echo "=== Searching for PrismaTypes export ==="
rg -n "export.*PrismaTypes" examples/blog-with-auth/packages/backend/src/generated/prisma/
# Search for getDatamodel function export
echo "=== Searching for getDatamodel export ==="
rg -n "export.*getDatamodel" examples/blog-with-auth/packages/backend/src/generated/prisma/Length of output: 82
🏁 Script executed:
#!/usr/bin/env bash
set -e
# Locate the generated JS file
file=$(fd --type f "pothos-prisma-types.js" examples/blog-with-auth/packages/backend/src/generated/prisma/)
echo "Found file: $file"
# Show its beginning
head -n 50 "$file"
# Verify exports
echo "=== Searching for PrismaTypes export ==="
rg -n "export.*PrismaTypes" "$file"
echo "=== Searching for getDatamodel export ==="
rg -n "export.*getDatamodel" "$file"Length of output: 72
🏁 Script executed:
#!/usr/bin/env bash
set -e
echo "=== Listing files in generated directory ==="
fd --type f examples/blog-with-auth/packages/backend/src/generated | sed 's/^/FILE: /'
echo
echo "=== Searching globally for pothos-prisma-types.js ==="
fd --type f --hidden pothos-prisma-types.js || echo "Not found"
echo
echo "=== Searching for exports in generated folder ==="
rg -nE "export.*(PrismaTypes|getDatamodel)" examples/blog-with-auth/packages/backend/src/generated || echo "No exports found"Length of output: 761
🏁 Script executed:
#!/usr/bin/env bash
set -e
echo "=== Listing all files under generated/prisma ==="
fd . examples/blog-with-auth/packages/backend/src/generated/prisma -t f | sed 's/^/FILE: /'
echo
echo "=== Searching for pothos-prisma-types.js under src/generated ==="
fd --type f examples/blog-with-auth/packages/backend/src/generated -I "pothos-prisma-types.js" || echo "Not found"
echo
echo "=== Grep for exports of PrismaTypes or getDatamodel in all generated files ==="
grep -RnE "export .*PrismaTypes|export .*getDatamodel" examples/blog-with-auth/packages/backend/src/generated || echo "No exports found"Length of output: 409
Missing generated exports module
The import path @src/generated/prisma/pothos-prisma-types.js isn’t present in examples/blog-with-auth/packages/backend/src/generated/prisma. Ensure pothos-prisma-types.js is generated at that location and exports both PrismaTypes and getDatamodel.
| import { PrismaPg } from '@prisma/adapter-pg'; | ||
|
|
||
| export const prisma = new PrismaClient(); | ||
| import { PrismaClient } from '../generated/prisma/client.js'; |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Use absolute import path with @src/ alias.
The import uses a relative path ../generated/prisma/client.js, but the coding guidelines require absolute paths via tsconfig paths. Additionally, this is inconsistent with the test helper file (db.test-helper.ts) which correctly uses the @src/ alias for the same import.
As per coding guidelines for **/*.{ts,tsx}: "Include absolute paths in import statements via tsconfig paths (@src/ is the alias for src/)"
Apply this diff to use the absolute import path:
-import { PrismaClient } from '../generated/prisma/client.js';
+import { PrismaClient } from '@src/generated/prisma/client.js';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { PrismaClient } from '../generated/prisma/client.js'; | |
| import { PrismaClient } from '@src/generated/prisma/client.js'; |
🤖 Prompt for AI Agents
In examples/todo-with-auth0/packages/backend/src/services/prisma.ts around line
3, the file imports the generated Prisma client via a relative path; change that
import to use the project's tsconfig path alias by importing from
'@src/generated/prisma/client.js' instead of '../generated/prisma/client.js';
ensure the tsconfig/paths are configured and the import preserves the .js
extension used by the build/runtime, then run tests/build to verify no path
errors.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
examples/todo-with-auth0/packages/backend/prisma/schema.prisma (1)
3-3: Ensure clean output dirs before prisma generate (CI/local).Reiterating prior finding: generation to ../src/generated/prisma can fail if the directory contains residual files. Add a cleanup step before prisma generate and exclude these folders from CI cache.
Example CI step: rm -rf examples//packages//src/generated/prisma
Also applies to: 10-10
🧹 Nitpick comments (2)
packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts (2)
56-87: Consider adding explicit return type for type safety.According to the coding guidelines, top-level functions should include return types. While the
runfunction's return type is partially enforced through the task system, adding an explicit return type would improve code clarity and type safety.Consider adding an explicit return type:
- run({ pothosConfig, prismaImports, pothosPrismaImports, renderers }) { + run({ pothosConfig, prismaImports, pothosPrismaImports, renderers }): { + providers: { pothosPrisma: PothosPrismaProvider }; + build: (builder: any) => Promise<void>; + } {As per coding guidelines.
61-85: LGTM! Async build pattern correctly implemented.The build function is properly converted to async (line 61) to support the awaited renderer invocation (line 84). The integration with
pothosPrismaImportsfor type fragments (line 73) and datamodel (line 79) follows the expected pattern for the new Prisma import system.Consider adding an explicit return type to the build function for clarity:
- build: async (builder) => { + build: async (builder): Promise<void> => {As per coding guidelines.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (4)
examples/blog-with-auth/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!**/generated/**examples/todo-with-auth0/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!**/generated/**tests/simple/packages/backend/baseplate/generated/prisma/schema.prismais excluded by!**/generated/**,!tests/**,!**/generated/**tests/simple/packages/backend/prisma/schema.prismais excluded by!tests/**
📒 Files selected for processing (3)
examples/blog-with-auth/packages/backend/prisma/schema.prisma(1 hunks)examples/todo-with-auth0/packages/backend/prisma/schema.prisma(1 hunks)packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- examples/blog-with-auth/packages/backend/prisma/schema.prisma
🧰 Additional context used
📓 Path-based instructions (4)
**/*
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
Use kebab-case for file names
Files:
examples/todo-with-auth0/packages/backend/prisma/schema.prismapackages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{ts,tsx}: TypeScript with strict type checking
Always include return types on top-level functions including React components (React.ReactElement)
Include absolute paths in import statements via tsconfig paths (@src/is the alias forsrc/)
If a particular interface or type is not exported, change the file so it is exportedIf a particular interface or type is not exported, update the TypeScript file so it is exported
Files:
packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
Node 16 module resolution - include file extensions in imports (
.js)
Files:
packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
**/*.{ts,tsx,js}: Sort imports by group: external libs first, then local imports
Use camelCase for variables/functions, PascalCase for types/classes
Order functions such that functions are placed below the variables/functions they use
We use the prefer using nullish coalescing operator (??) ESLint rule instead of a logical or (||), as it is a safer operator
Use console.info/warn/error instead of console.log
Files:
packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts
🧠 Learnings (1)
📚 Learning: 2025-09-03T17:03:33.250Z
Learnt from: CR
PR: halfdomelabs/baseplate#0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-09-03T17:03:33.250Z
Learning: Applies to examples/todo-with-auth0/packages/backend/**/schema.graphql : Backend must generate `schema.graphql` for the admin package to consume for code generation
Applied to files:
examples/todo-with-auth0/packages/backend/prisma/schema.prisma
🧬 Code graph analysis (1)
packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts (4)
packages/fastify-generators/src/generators/pothos/pothos-prisma/generated/index.ts (1)
POTHOS_POTHOS_PRISMA_GENERATED(6-11)packages/fastify-generators/src/generators/pothos/pothos-prisma/generated/ts-import-providers.ts (1)
pothosPrismaImportsProvider(24-27)examples/blog-with-auth/packages/backend/baseplate/generated/src/plugins/graphql/builder.ts (1)
builder(26-76)packages/utils/src/string/quot.ts (1)
doubleQuot(15-17)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test E2E
- GitHub Check: Lint
🔇 Additional comments (5)
packages/fastify-generators/src/generators/pothos/pothos-prisma/pothos-prisma.generator.ts (4)
14-14: LGTM! Proper utility import for string escaping.The
doubleQuotutility is correctly imported and used in lines 99-102 to properly escape the Prisma generator configuration paths.
25-26: LGTM! Generated artifacts properly imported.The imports for
POTHOS_POTHOS_PRISMA_GENERATEDandpothosPrismaImportsProvidercorrectly integrate the new code generation architecture for Prisma imports.
40-42: LGTM! Task wiring properly updated.The generator tasks correctly expose the new paths, imports, and renderers outputs (lines 40-42), and the main task correctly declares dependencies on the new providers (lines 50-51).
Also applies to: 50-51
98-103: Verify Pothos Prisma generator output paths
After runningprisma generate, confirm:
clientOutput: "./client.js"resolves to the actual Prisma client entrypoint undersrc/generated/prisma(e.g. rename to./index.jsif that’s the filename).output: "../src/generated/prisma/pothos-prisma-types.ts"matches the location of the generated Pothos types file.
Adjust these relative paths if the filenames or directory structure differ.examples/todo-with-auth0/packages/backend/prisma/schema.prisma (1)
2-4: engineType="client" is supported in Prisma v6.17.1; no change needed.Likely an incorrect or invalid review comment.
| provider = "pnpm prisma-pothos-types" | ||
| clientOutput = "./client.js" | ||
| output = "../src/generated/prisma/pothos-prisma-types.ts" |
There was a problem hiding this comment.
🧩 Analysis chain
pothos generator: provider string and clientOutput need verification.
provider = "pnpm prisma-pothos-types" includes a space; Prisma expects a resolvable module or path (e.g., "prisma-pothos-types"). Also ensure clientOutput points to a real module exporting Prisma types (e.g., the generated client entry).
- Verify provider correctness and clientOutput existence:
If incorrect, likely fixes:
- provider = "pnpm prisma-pothos-types"
+ provider = "prisma-pothos-types"
- clientOutput = "./client.js"
+ clientOutput = "../src/generated/prisma"Adjust clientOutput to the actual import path (index.js/ts) your pothos generator expects (ESM/CJS).
🏁 Script executed:
#!/bin/bash
# Show all pothos generator providers across the repo for consistency
for f in $(fd -t f -e prisma schema.prisma); do
echo "File: $f"
sed -n '/generator pothos/,/}/p' "$f" | sed 's/^/ /'
echo
done
# Check for a local prisma client shim next to schema (client.js)
fd -t f "(^|/)client\.js$" examples/ packages/ -E "node_modules" -E "dist" | sed -n '1,200p'Length of output: 1485
🏁 Script executed:
#!/bin/bash
# Search for Prisma client generator declarations
for f in $(fd -t f -e prisma schema.prisma); do
echo "File: $f"
sed -n '/generator client/,/}/p' "$f" | sed 's/^/ /'
echo
doneLength of output: 1215
Fix pothos generator provider and clientOutput paths
Replace in examples/todo-with-auth0/packages/backend/prisma/schema.prisma (and other schemas):
- provider = "pnpm prisma-pothos-types"
+ provider = "prisma-pothos-types"
- clientOutput = "./client.js"
+ clientOutput = "../src/generated/prisma"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| provider = "pnpm prisma-pothos-types" | |
| clientOutput = "./client.js" | |
| output = "../src/generated/prisma/pothos-prisma-types.ts" | |
| provider = "prisma-pothos-types" | |
| clientOutput = "../src/generated/prisma" | |
| output = "../src/generated/prisma/pothos-prisma-types.ts" |
🤖 Prompt for AI Agents
In examples/todo-with-auth0/packages/backend/prisma/schema.prisma around lines
8-10, the generator block uses an incorrect provider ("pnpm
prisma-pothos-types") and a wrong clientOutput ("./client.js"); replace the
provider with the correct Prisma client provider ("prisma-client-js") and update
clientOutput to the project’s canonical Prisma client output path (for example
"../src/generated/prisma/client" or the same output used by other schemas in the
repo) so the generator and output location match the rest of the codebase.
Summary by CodeRabbit
New Features
Refactor
Chores
Tests
Style