Open-Source Wikis

/

Prisma

/

Packages

/

client-generator-js

prisma/prisma

client-generator-js

Active contributors: jacek-prisma, Oleksii Orlenko

Purpose

packages/client-generator-js is the legacy generator that backs the provider = "prisma-client-js" directive. It is the original Prisma Client generator — the one most older user projects still use.

It coexists with client-generator-ts (the modern prisma-client generator) in Prisma 7. Both are built and tested simultaneously; users migrate to the new generator on their own schedule.

What it produces

The same shape as client-generator-ts — a typed PrismaClient class, a Prisma namespace, and supporting types — but with subtle output differences chosen for compatibility with older bundlers and pre-ESM environments. Default output path historically was node_modules/.prisma/client.

Directory layout

packages/client-generator-js/src/
├── TSClient/
│   ├── PrismaClient.ts          # buildClientOptions method emits constructor option types
│   └── ...                       # Other TSClient parts
└── ...

Key abstractions

Symbol File What it does
buildClientOptions method packages/client-generator-js/src/TSClient/PrismaClient.ts Emits the TS declaration for PrismaClientOptions (legacy flavor)
TSClient generator packages/client-generator-js/src/TSClient/ The class hierarchy that turns DMMF into generated code

Differences from client-generator-ts

The two generators produce semantically equivalent clients but differ in:

  • Module format — JS-flavored generator produces output suited to CJS-first projects; TS-flavored generator targets modern ESM/TS toolchains.
  • Runtime selection — both delegate to the same @prisma/client/runtime, but the generated re-exports and types are slightly different.
  • Future — the JS generator is in maintenance mode. New features land in client-generator-ts first.

Synchronization with client-generator-ts

When a PrismaClient constructor option changes, both generators must emit the new declaration. The two seams are:

  • packages/client-generator-js/src/TSClient/PrismaClient.ts buildClientOptions method
  • packages/client-generator-ts/src/TSClient/file-generators/PrismaNamespaceFile.ts buildClientOptions function

Reviewers watch for diffs that touch one and not the other.

Integration points

  • Same as client-generator-ts — DMMF input, ts-builders for output, registered in client-generator-registry, runtime imports from @prisma/client/runtime.

Entry points for modification

  • Change emitted types: src/TSClient/
  • Synchronize a new constructor option: PrismaClient.ts buildClientOptions method (don't forget the TS-flavored sibling)

See also

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

client-generator-js – Prisma wiki | Factory