Open-Source Wikis

/

Prisma

/

Primitives

/

DMMF

prisma/prisma

DMMF

The Datamodel Meta Format is the JSON AST representation of a Prisma schema. It's the contract between the schema parser (Wasm) and every Prisma generator.

The DMMF is a Prisma ORM internal API with no guarantees for stability to outside users. — ARCHITECTURE.md

Where it's defined

Type definitions: packages/dmmf/src/. The package re-exports types used by:

  • @prisma/internals (getDMMF)
  • @prisma/get-dmmf (the wrapper around the Wasm call)
  • @prisma/client-generator-ts and @prisma/client-generator-js (the consumers)

The actual structure originates in prisma-engines (Rust) and is preserved when serialized through the Wasm boundary.

Shape (high level)

A DMMF object includes:

  • datamodel.models — array of Model objects (each with fields, uniqueFields, idFields, …)
  • datamodel.enums — array of DatamodelEnum
  • datamodel.types — composite types (Mongo-only)
  • datamodel.indexes@@index declarations
  • mappings.modelOperations — per-model action map
  • schema.inputObjectTypes / outputObjectTypes / enumTypes — full type universe used by the generator to emit Prisma input/output types

packages/client/src/__tests__/__helpers__/dmmf-types.ts (~7,910 lines) is the canonical fixture for what these look like in practice.

Stability

DMMF changes with engine versions. From ARCHITECTURE.md:

Oftentimes, the Rust team did a change in DMMF, which you now need to integrate.

The signal that DMMF moved is a snapshot diff in packages/internals/src/__tests__/. From AGENTS.md:

If there is a change in the snapshots, only accept them if you're 100% certain that these changes are expected. If not, please always ping the Rust team, if this is an intended change.

How to inspect DMMF locally

packages/client/sandbox/dmmf.ts is a pre-wired playground. Run it with the tasks suggested in ARCHITECTURE.md:

ndb -r ts-node/register ./packages/client/sandbox/dmmf.ts

or, in VS Code, copy .vscode/launch.json.default to .vscode/launch.json and use the "Client - Current TS File" launch task.

Consumers

graph LR
    Schema[schema.prisma] --> Wasm[prisma-schema-wasm]
    Wasm --> DMMF[DMMF AST]
    DMMF --> GenJS[client-generator-js]
    DMMF --> GenTS[client-generator-ts]
    DMMF --> External[external generators<br/>via generator-helper]
    DMMF --> Tests[internals snapshot tests]

See also

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

DMMF – Prisma wiki | Factory