Self-hosted service
prisma/prisma-engines avatar
prisma/prisma-engines

Prisma Engines: building the Rust core of Prisma

🚂 Engine components of Prisma ORM

1,340 stars330 forksRustApache-2.0

At a glance

What is it?
Prisma Engines contains the Rust compilers, migration engine, schema tooling, and TypeScript executor layer used by Prisma Client and Prisma Migrate. It is a contributor-focused repository rather than a standalone engine package, with native binaries and Wasm artifacts built through Cargo and Make targets.
Who is it for?
Engine contributors and Prisma extension developers should adopt this repository when they need to modify query planning, schema migrations, formatting, or the JavaScript executor harness. Application developers should normally use Prisma through its documented Getting Started guide instead of building these binaries.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 8 days ago.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The query, schema, and executor layers in prisma-engines

Prisma Engines addresses the internal work required to connect Prisma schemas, application queries, and databases. Its audience is primarily contributors working on Prisma's core stack, along with developers extending or testing engine behavior. It is not positioned as the usual installation route for an application that merely needs Prisma Client or Prisma Migrate. The README directs ordinary installers to Prisma's Getting Started guide instead.

The repository separates several responsibilities. The query compiler turns Prisma Client operations into executable plans containing SQL and orchestration steps. The Schema Engine compares a Prisma schema with a live database, creates and runs migrations, records applied migrations, and can generate a schema from an existing database. Prisma Format handles schema formatting and also supports language server features. The `psl` crate defines the Prisma Schema Language, including its syntax, parsing rules, connectors, and annotated DataModel representation.

This is a Rust workspace with many narrowly scoped crates. `Cargo.toml` lists schema-engine connectors, schema inspection and migration tests, query compiler crates, driver-related code, formatting, Wasm packages, PSL components, and `quaint`. That breadth makes the project suitable for engine development, but it also means the repository is more than one application or one command-line tool.

From Prisma DataModel to JavaScript database execution

The query path crosses a clear language boundary. Rust code consumes the DataModel produced from Prisma Schema Language input. The query compiler then produces a query plan that describes the SQL and orchestration needed for an operation. JavaScript code in `libs/driver-adapters` loads those plans, talks to database drivers, and exposes a legacy protocol for existing tooling.

The main Prisma repository supplies `@prisma/client-engine-runtime`, which implements the query plan interpreter and transaction management. This division matters for debugging. A change to planner behavior can require Rust-side changes across `query-compiler`, `query-core`, and `query-structure`, while execution or transaction behavior may involve `libs/driver-adapters/executor`. The connector test kit exercises the arrangement by spawning the executor process and driving requests through the adapters. The README identifies `cargo test -p query-engine-tests` as the usual integration test entry point, commonly driven through `make dev-*-qc` targets.

There is no standalone query engine binary anymore, according to the README. That removes a familiar deployment shape and introduces a packaging boundary: the compiler is a library, Wasm bundles are required for its JavaScript runtime path, and the compatibility harness is assembled with `make build-driver-adapters-kit-qc`. Adopters modifying query execution must therefore reason across Rust compilation and JavaScript interpretation instead of searching for one query-engine executable.

Migration state across schema files, files, and _prisma_migrations

The Schema Engine relies on three connected sources. Prisma schema files describe the intended data model. The `prisma/migrations` directory stores existing migration files. The live database supplies the current state and contains applied migration metadata in `_prisma_migrations`.

When creating a migration, the engine compares the Prisma file with the database to calculate the difference. When running migrations, it uses the migration directory and database tracking to determine what still needs execution. Its introspection path works in the opposite direction by regenerating a Prisma schema from a live database. These operations explain why migration bugs can involve schema parsing, database introspection, filesystem state, and migration tracking at once.

The workspace includes SQL migration tests, SQL introspection tests, connector-specific crates, a JSON-RPC API, and a schema-engine Wasm package. The README also notes early-stage, work-in-progress use of driver adapters by a Wasm port of the Schema Engine. That status should prevent readers from treating every Wasm path as interchangeable with the native binary. The documented native build still produces `schema-engine` under `target/debug` or `target/release`.

Building schema-engine and prisma-fmt from main

This is a source build for engine contributors. The README requires the latest stable Rust toolchain. On Linux, OpenSSL must be installed. The repository also expects `direnv`, shell hook integration, and permission to load `.envrc` at the repository root. Contributors can alternatively load the environment defined by `.envrc` manually. A `shell.nix` file is available for Nix users, but the README says Nix is optional.

First, allow the repository environment to load. Run this command at the repository root to permit the environment described by `.envrc`:

bash
direnv allow

Build the debug binaries from the workspace root with Cargo:

bash
cargo build

After this completes, the README places `schema-engine` in `target/debug` and `prisma-fmt` in the same directory. These are non-production debug binaries.

For optimized binaries, use the documented release command:

bash
cargo build --release

The corresponding outputs are written under `target/release`. This is the repository's first concrete use: it builds the Schema Engine CLI and the Prisma Format binary from the current `main` branch. It does not install a copy into a Prisma application. The README points application users to the separate Getting Started guide for that purpose.

Wasm compilation needs different Make targets

A successful `cargo build` does not produce every runtime form mentioned in the repository. The query compiler is a library crate, so the JavaScript runtime needs a Wasm bundle. The README gives `make build-qc-wasm` for that job. This target is distinct from building `schema-engine` and `prisma-fmt` as native executables.

Use this command from the repository root when preparing the query compiler's Wasm artifact:

bash
make build-qc-wasm

Driver adapters have their own build command because they are compiled into the kit used by the compatibility harness and runtime packages:

bash
make build-driver-adapters-kit-qc

The repository Makefile also contains target-specific query compiler builds, a `build-se-wasm` recipe for the Schema Engine Wasm package, and clean recipes that remove generated package contents and run `cargo clean`. These distinctions matter for continuous integration and release packaging. Choosing `cargo build` because the workspace compiles is not enough to conclude that every expected JavaScript or Wasm artifact exists.

For local database integration work, the repository includes a `docker-compose.yml` and a `.test_database_urls/` directory. The Compose file defines multiple database versions and a PgBouncer service. It is test infrastructure, not an application deployment recipe, and starting it requires the database-specific targets and credentials expected by the test suites. The README does not provide a short, universal first-run command for the entire Compose stack.

Trade-offs, maintenance, and the Prisma package boundary

The largest limitation is scope. This repository is not a single embeddable service and does not offer a standalone query engine binary. Contributors must identify whether a change belongs in schema parsing, query planning, execution, connector behavior, migration handling, or packaging. Cross-layer query work also carries Rust, Wasm, and TypeScript implications.

The repository is not archived, and its last push was on 2026-10-09. The README does not document a stable release process for standalone consumers, while the repository has no GitHub releases. Upgrading source checkouts therefore appears tied to the `main` codebase and its Cargo and Make build targets rather than to versioned GitHub release artifacts. The documentation also points to published Cargo API docs.

The project is licensed under Apache-2.0. That identifier covers the repository's stated licensing terms, but this review does not interpret the license or provide legal advice. Consumers should separately examine notices and dependency terms when redistributing compiled artifacts.

A real alternative is to consume Prisma through the main `prisma/prisma` packages instead of building this repository. That approach uses Prisma's published client and migration integration path, while `prisma-engines` exposes engine source for compilation, testing, and contribution. For database access that does not use Prisma plans, application code can instead call a database driver directly. That approach bypasses Prisma schema compilation and migration orchestration, but it also does not provide Prisma Migrate's comparison between the Prisma file and database. The right boundary is therefore based on the task: use Prisma packages for application consumption, use this workspace to modify the engine core, and use a direct driver when Prisma's schema and migration model is unnecessary.

Editorial conclusion

Engine contributors and Prisma extension developers should adopt this repository when they need to modify query planning, schema migrations, formatting, or the JavaScript executor harness. Application developers should normally use Prisma through its documented Getting Started guide instead of building these binaries. Before adoption, verify that your target database has the required local development services, that the generated artifact you need is native or Wasm, and that your changes account for the separate Rust and JavaScript layers.

Frequently asked questions

Does building Prisma Engines install Prisma Client for an application?

No. The README directs people looking to install Prisma or its engines to the Prisma Getting Started guide. The Cargo build produces binaries and library artifacts from this repository for contributor and development use.

Why is there no standalone query engine binary?

The README states that there is no standalone query engine binary anymore. Query compilation is handled by a Rust library, while JavaScript driver adapters and the query plan interpreter execute the resulting plans.

How do I build the Prisma Engines Wasm artifacts?

The query compiler Wasm bundle uses `make build-qc-wasm`, and the driver adapter kit uses `make build-driver-adapters-kit-qc`. These are separate from the native `cargo build` output documented in the README.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. prisma/prisma-engines on GitHub
  4. Project website
  5. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/prisma-prisma-engines.svg)](https://hysenlabs.com/projects/prisma-prisma-engines)

Was this useful?