Skip to content
Strata v1.2.6

2026-05-08: Fix missing prisma generate in Tauri dev/build flow

Running npm run tauri:dev (or tauri:build) failed with 100 TypeScript compilation errors because Prisma-generated types were missing:

Module '"@prisma/client"' has no exported member 'PrismaClient'
Module '"@prisma/client"' has no exported member 'Prisma'
Module '"@prisma/client"' has no exported member 'AssetTypeGroup'
Property 'asset' does not exist on type 'PrismaService'
… (100 errors total)

Root cause: node_modules/.prisma/client/ (the generated Prisma client) was never created in the Tauri flow. Prisma 7 does not auto-generate the client on npm install — an explicit prisma generate call is required.

  • Docker handles this correctly: the backend Dockerfile line 40 runs RUN npx prisma generate explicitly.
  • backend/.env has DATABASE_URL set, so local prisma generate works.
  • tauri-dev.sh / tauri-build.sh: ran npm installnpm run build, but skipped prisma generate.
  • backend/package.json: no postinstall or prebuild step for prisma generate.

Three options were considered:

OptionProsCons
postinstall in package.jsonAutomatic, universalDocker sets DATABASE_URL after npm cipostinstall would run before the env var is available and fail
Explicit step in shell scripts onlySimple, targetedDoesn’t cover cd backend && npm run build direct usage
prebuild in package.json + shell scriptsCovers all pathsprebuild is skipped in Docker (Docker calls npx nest build directly, not npm run build) — safe

Chosen: option 3 (belt + suspenders) — add prisma generate to both the shell scripts and the prebuild npm script.


Added an explicit npx prisma generate step after npm install and before npm run build for the backend:

Terminal window
echo "▸ Generating Prisma client …"
npx prisma generate

Same addition after the --omit=dev install.

Changed prebuild from:

"prebuild": "node ../scripts/gen-version.mjs backend"

To:

"prebuild": "prisma generate && node ../scripts/gen-version.mjs backend"

This ensures cd backend && npm run build (direct developer usage outside the Tauri scripts) also generates the Prisma client automatically.


The backend Dockerfile calls RUN npx nest build directly — it never calls npm run build. This means the prebuild npm lifecycle hook is not triggered in Docker. Docker continues to use its own explicit RUN npx prisma generate step (which runs after DATABASE_URL is set via ENV).


  1. npm run tauri:dev completes without TypeScript errors ✅
  2. cd backend && npm run build succeeds from cold state ✅
  3. Backend unit tests pass ✅
  4. Backend e2e tests pass ✅
  5. Docker build still works ✅

Commit: acf15f9

FileChange
scripts/tauri-dev.shAdded echo "▸ Generating Prisma client …" + npx prisma generate after backend npm install
scripts/tauri-build.shSame addition after npm install --omit=dev
backend/package.jsonChanged prebuild to "prisma generate && node ../scripts/gen-version.mjs backend"
docs/src/content/docs/plans/2026-05-08-fix-prisma-generate-tauri.mdThis plan doc (new file)
docs/src/content/docs/dev-setup.mdAdded note about automatic prisma generate in the backend Step 2 section

None. The plan was followed exactly.

GateResult
Backend unit✅ 265 tests passed (28 suites)
Backend e2e✅ 69 tests passed (8 suites)
Frontend unit⏭ skipped (not affected)
Frontend e2e⏭ skipped (not affected)
  • prisma generate in prebuild works for local dev because backend/.env supplies DATABASE_URL via import 'dotenv/config' in prisma.config.ts.
  • Docker calls npx nest build directly — never npm run build — so prebuild is not triggered in Docker. No conflict.
  • The tauri-dev.sh change calls npx prisma generate from the backend/ directory, which correctly picks up prisma.config.ts and backend/.env.