Skip to content

Support multi-file Prisma Schema/Contract in Prisma 8 #30157

Description

@zalaghi-dev

What problem are you trying to solve?

In Prisma 7, we can organize large Prisma schemas across multiple .prisma files using the multi-file schema feature.

For example:

prisma/
├── schema/
│ ├── schema.prisma
│ ├── user.prisma
│ ├── project.prisma
│ ├── task.prisma
│ └── comment.prisma
└── migrations/

This is especially useful for large projects with dozens or hundreds of models, where keeping everything in a single file becomes difficult to navigate and maintain.

In Prisma 8, the new contract-based architecture currently expects a single contract source:

contract: "./prisma/contract.prisma"

This means that the previous multi-file .prisma organization is no longer available when using PSL as the contract authoring format.

I understand that Prisma 8 provides a TypeScript contract builder that can split and compose model definitions across TypeScript modules. However, requiring users to migrate their existing Prisma Schema Language models to TypeScript just to keep a multi-file structure feels like an unnecessary trade-off.

Feature request

Please consider bringing multi-file Prisma Schema Language support to Prisma 8 contracts.

For example:

prisma/
├── contract/
│ ├── contract.prisma
│ ├── user.prisma
│ ├── project.prisma
│ ├── task.prisma
│ └── comment.prisma
└── migrations/

Or something similar to the existing Prisma 7 multi-file schema behavior.

The goal would be for Prisma 8 to treat all .prisma files within the configured contract directory as a single contract, while still emitting the same:

contract.json
contract.d.ts
Why this matters

For small projects, a single contract.prisma file is perfectly reasonable.

For large applications, however, a single file can become very difficult to maintain. Domain-based organization is much easier to work with:

auth/
user.prisma
role.prisma
permission.prisma

projects/
project.prisma
project-member.prisma

tasks/
task.prisma
task-comment.prisma
task-label.prisma

This also makes it easier to:

navigate large schemas
separate domains
review changes in pull requests
reduce merge conflicts
maintain large NestJS applications
migrate existing Prisma 7 projects to Prisma 8 without restructuring the entire data layer
Expected behavior

I would like to be able to configure something along the lines of:

export default definePrismaConfig({
orm: ormConfig({
contract: "./prisma/contract",
}),
});

and have Prisma automatically load all .prisma files in that directory as a single PSL contract.

This would preserve the existing Prisma Schema Language workflow while making it compatible with the new Prisma 8 contract architecture.

Thanks for considering this. Multi-file schema support was extremely valuable for large Prisma projects, and having the same capability in Prisma 8 would make migration to the new architecture much easier.

Proposed solution

Allow Prisma 8 contracts written in Prisma Schema Language (.prisma) to be split across multiple files, similar to the multi-file schema support available in Prisma 7.

For example:

prisma/
├── contract/
│   ├── schema.prisma
│   ├── user.prisma
│   ├── project.prisma
│   ├── task.prisma
│   └── comment.prisma

When the contract path points to the contract/ directory, Prisma should automatically discover and combine all .prisma files into a single contract.

This would preserve the existing Prisma Schema Language workflow while allowing large projects to organize models by domain without having to migrate their schemas to the TypeScript Contract Builder.

Ideally, the generated contract should behave exactly like a single .prisma contract from Prisma 8, including relations, enums, indexes, and other schema definitions across files.

Alternatives considered

No response

Scope and impact

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions