Faster, more flexible, better DX: This is what our move from Rust to TypeScript unlocks! But it’s even more, it’s not just a re-write from one language to another, it’s a fundamental improvement in the Prisma ORM architecture—and you can try it now!
A brief history of Prisma ORM
Let’s take a quick look back to understand the origins of the Prisma architecture and its Rust-based query engine.
From GraphQL to databases
If you're newer to the Prisma community, this may surprise you: Prisma ORM emerged out of a GraphQL Backend-as-a-Service called Graphcool. After several iterations where abstraction layers were peeled off and we moved down from the API layer to the database, we released Prisma ORM back in 2020:
Why the Rust query engine in the first place?
When Prisma ORM was conceived in 2020, we had the ambition of building Prisma ORM for various languages. So, we chose an architecture that would support us in that effort and split the query layer of Prisma ORM into two parts:
- A query engine: Does the heavy-lifting of generating SQL queries and managing DB connections.
- A lightweight language-specific client: Lets developers easily send queries to the DB.
Faster, more flexible, better DX
Five years later, the developer ecosystem has changed a lot: TypeScript is becoming the predominant language for the web and developers gravitate towards serverless deployments. We also gained valuable insights into the friction points our approach with the Rust engine has caused, most notably compatibility issues with modern runtimes, deployment complexities (e.g., due to the engine binary size or the need to compile it for a specific target), and performance overhead due to extra serialization steps between language boundaries.
With all that knowledge, we embarked on a journey of removing Rust from the architecture to create a version of Prisma ORM that's faster, more flexible and provides an overall much better developer experience! If you want to learn more about the migration process, check out our previous two articles on the topic:
- From Rust to TypeScript: A New Chapter for Prisma ORM
- Rust to TypeScript Update: Boosting Prisma ORM Performance
Prisma ORM v6.7.0: A new architecture without Rust engines (Early Access)
Following our previous updates, we're excited to release the new, Rust-free architecture in Early Access for PostgreSQL and SQLite with this week's v6.7.0 release. Please try it out and let us know what you think!
Usage with native JavaScript driver packages
The Rust-based query engine used to be responsible for managing database connections via built-in database drivers (that were also written in Rust). That's why, unlike other ORMs, Prisma ORM never required you to install additional packages (like pg
or better-sqlite3
).
By moving away from Rust, Prisma ORM also won't have built-in drivers anymore and now depends on a native JS driver to be used. This works via driver adapters which have been part of Prisma ORM since v5.4.0 and are available via the driverAdapters
Preview feature flag.
Getting started with the new Prisma ORM architecture
To get started with the new Rust-free version of Prisma ORM, you need to update your prisma
and @prisma/client
versions to 6.7.0
, and then set the queryCompiler
and driverAdapters
feature flags on your Prisma Client generator:
Next, you need to re-generate Prisma Client by running the following command:
Depending on whether you're using PostgreSQL or SQLite, you'll need to install the driver adapter for pg
or better-sqlite3
:
After installation, you can instantiate your PrismaClient
instance as follows:
At this point, you can use your PrismaClient
instance as usual — there are no other changes to how you use it for interacting with your database. The switch will be especially useful if you're using Prisma ORM in monorepos, newer runtimes like Bun and Deno, or deploy your application to Serverless and Edge environments.
Performance boosts of Prisma ORM without Rust engines
The new architecture not only is more flexible and provides a friendlier DX. It also shows much better numbers when it comes to query performance. That's not because Rust itself is slow (quite the contrary), but because some queries experience a notable serialization overhead when queries and data are passing language boundaries. This overhead is saved with the new architecture, making query execution leaner and faster.
We've started comparing the performance of the old with the new architecture and found that almost all queries become notably faster, sometimes they're twice as fast or even faster!
For details on that, you can check out our recent article where we presented these measurements in detail.
What's next for Prisma ORM?
Prisma ORM is undergoing major changes at the moment. We've announced our ORM manifesto a few months ago with all details about changes to our OSS governance process. Since then, we've been working hard at making Prisma ORM simpler, more robust, and more flexible with features like the new prisma-client
generator, a TypeScript-based configuration file (called prisma.config.ts
, and removing magic behaviors, like generating Prisma Client into node_modules
). Check out our roadmap to see what's next!
Try out Prisma ORM without Rust
To summarize, the new Prisma ORM architecture without Rust:
- makes Prisma ORM more lightweight by removing the need for extra binaries
- makes Prisma ORM faster by saving serialization overhead across language boundaries
- provides a better DX because deployment is simpler (no more "binary targets")
Give it a shot and let us know what you think of it on X and our Discord!
Try Prisma ORM without Rust engines
Don’t miss the next post!
Sign up for the Prisma Newsletter