prisma/prisma
Tooling
Build pipelines, runners, and quality gates used inside prisma/prisma.
Workspace layout
pnpm-workspace.yaml— defines the workspace globs (packages/*).turbo.json— Turborepo task graph forbuildanddev. Dependent builds run in topological order; outputs are cached.- Engine constraints —
package.jsonenginesfield requires Node^20.19 || ^22.12 || >=24.0and pnpm>=10.15 <11.
The preinstall script (scripts/only-allow-pnpm.js) hard-fails any attempt to run npm or yarn against the repo.
Build pipeline (esbuild)
The shared build code lives in helpers/compile/:
helpers/compile/build.ts— the build orchestrator. Each package'shelpers/build.tscalls into this with package-specific config.helpers/compile/configs.ts— reusable config presets (bundledConfig, etc.).helpers/compile/plugins/— esbuild plugins. The most notable istsc/(the in-process tsc step that emits.d.ts) andfill-plugin/(which polyfills missing Node modules in browser builds).
Most packages opt in to bundledConfig, which produces:
- A CommonJS bundle (
dist/index.js) - An ESM bundle (
dist/index.mjs) - Type declarations (
dist/index.d.tsanddist/index.d.mts)
Test files (*.test.ts) are explicitly excluded from build output by esbuild config; place tests anywhere in src/.
Turborepo
pnpm build # turbo build
pnpm dev # turbo dev (no tsc)
pnpm watch # one-shot dev + parallel watchTurbo's task definitions in turbo.json:
builddepends on upstreambuild. Inputs includehelpers/**/*.tsso editing the shared builder invalidates every cache.devmirrorsbuildbut skips the type-emit step.@prisma/type-benchmark-tests#devhas its own outputs (**/generated).
ESLint
eslint.config.cjs is the flat-config root. Plugins in use:
@typescript-eslint/*— TypeScript-aware ruleseslint-plugin-import-x— import resolution and orderingeslint-plugin-simple-import-sort— deterministic import sorteslint-plugin-prettier— wraps Prettier as a lint ruleeslint-plugin-jest— Jest-specific lintseslint-plugin-local-rules— loadseslint-local-rules/for project-specific rules@eslint-community/eslint-plugin-eslint-comments— guardseslint-disableusage
Run lint with:
pnpm lint # check
pnpm lint-fix # autofixPrettier
Prettier 3 is the formatter (prettier@3.6.2); the legacy prettier2 is also installed for tools that need v2 output.
pnpm format # write
pnpm prettier-check # check, no writes.prettierrc.yml and .prettierignore at the root configure it. Some packages have their own .prettierrc.yml overrides.
Husky + lint-staged
.husky/ registers Git hooks. precommit runs lint-staged, which:
- Runs Prettier on every staged file (
prettier --ignore-unknown --write) - Runs ESLint with
--fixon staged.js/.tsfiles
The hook is installed automatically via the prepare script (is-ci || husky) on pnpm install.
CI workflows
.github/workflows/:
| Workflow | Purpose |
|---|---|
test.yml |
Top-level CI orchestrator |
test-template.yml |
Reusable matrix template for per-package tests |
benchmark.yml |
CodSpeed benchmarks |
bundle-size.yml |
Tracks packages/cli/build/index.js size |
build-engine-branch.yml |
Builds engines from a custom branch when /engine-branch is set |
release.yml, release-ci.yml |
Production releases and integration tag pre-releases |
update-engines-version.yml |
Bumps engine versions automatically |
update-studio-version.yml |
Bumps the bundled Studio |
manage-dist-tag.yml |
npm dist-tag management |
codeql-analysis.yml |
Security scanning |
lint-workflow-files.yml |
Lint the workflow YAMLs themselves |
test-template.yml partitions the workspace into jobs by purpose:
others(Linux, no Docker) — utility packages:debug,generator-helper,get-platform,fetch-engine,engines,instrumentation,instrumentation-contract,schema-files-loader,config,dmmf,generator,credentials-store,sqlcommenter-*client-packages—client-common,client-engine-runtime,ts-builders,client-generator-js,client-generator-ts,client-generator-registrydriver-adapter-unit-tests—adapter-libsql,adapter-mariadb,adapter-d1,adapter-pg,adapter-planetscale,adapter-mssql,adapter-neonno-docker(Windows/macOS) — mirrorsothersandclient-packages
When you add a new package with tests, edit test-template.yml to include it in the right job.
Bundle-size enforcement
The root package.json declares size-limit paths covering the CLI bundle, the Client browser bundle, the Client tarball, the CLI tarball, and several driver-adapter worker outputs. CI (bundle-size.yml) posts a comment on every PR. The CLI bundle ceiling is ~6MB; the Client tarball ceiling is also tracked.
Engine downloads
packages/engines has a postinstall hook that downloads Schema Engine binaries from S3 for the host platform. This is what gives pnpm install its long install times.
The download wrapper is in packages/fetch-engine. To override, see Custom engines.
Ad-hoc scripts
scripts/ and helpers/:
scripts/ci/publish.ts— backbone ofpnpm build/test/status/pull/publish-allscripts/bench.ts— benchmark runnerscripts/bump-engines.ts— engine version bumperscripts/check-engines-override.ts— fail-safe to prevent shipping a custom engines overridescripts/run-studio.ts— convenience for spinning up Studio locallyscripts/graph-dependencies.ts— regenerates the dependency graph PNGs ingraphs/(needs GraphViz installed)
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.