Prisma ORM Gets Full TypeScript Rewrite

The popular Prisma ORM is getting a ground-up rewrite called Prisma Next, built natively in TypeScript. The new version features a cleaner query API, a type-safe SQL builder, streaming support, and a graph-based migration system. While not yet recommended for production over Prisma 7, it's being watched for its potential to improve developer ergonomics and type safety.

The rewrite to TypeScript is a significant architectural shift for Prisma, moving away from its previous Rust-based query engine. This change was motivated by a desire to lower the barrier for community contributions, as the majority of Prisma's user base is within the TypeScript ecosystem. The previous Rust engine, while performant, created deployment complexities due to the need for different binaries for various operating systems and OpenSSL versions. This isn't the first major change for Prisma's core. The move away from Rust was a gradual process, with Prisma 7 already shipping a major rewrite of the query system that removed Rust native binaries from user applications. While the Rust engine was fast, the communication layer between Rust and JavaScript introduced a performance bottleneck. The new TypeScript and WebAssembly-based architecture in Prisma 7 resulted in up to 3.4x faster queries and a 90% smaller bundle size. A key motivator for the full TypeScript rewrite in Prisma Next was the difficulty in extending the previous architecture to non-SQL databases like MongoDB. While Prisma 7 aimed to support MongoDB, the required effort was larger and riskier than anticipated, prompting a more fundamental redesign. Prisma Next is being built to be extensible and composable from the ground up to better accommodate different database types. The new graph-based migration system in Prisma Next is designed to provide more transparency and safety compared to the linear migration files in Prisma 7. This new model is better equipped to handle real-world development scenarios like parallel migrations from multiple developers and squashing old migrations. Additionally, a long-requested feature, data migrations, is being worked on for Prisma Next, allowing for type-safe data transformations alongside schema changes. Prisma Next is also being designed with AI agent-centric development in mind. The goal is to provide structured, machine-readable output for every operation, including query plans, schema details, and diagnostics. This will enable AI agents to better understand failures, suggest fixes, and adjust their queries more effectively. The project's origins trace back to a company called Graphcool, founded by Søren Bramer Schmidt, who is now the CEO of Prisma. The initial focus was on simplifying GraphQL API building, which evolved into the standalone Prisma ORM with the release of Prisma 2.0 in 2020. The core features at that time were the auto-generated and type-safe Prisma Client, Prisma Migrate for automated migrations, and the Prisma Studio visual database editor.

Get your own daily briefing

Scout delivers personalized news, insights, and conversations tailored to your role and industry.

Download on the App Store

Shared from Scout - Be the smartest in the room.