Should you use Prisma ORM?
Prisma ORM is a new kind of ORM that - like any other tool - comes with its own tradeoffs. This page explains when Prisma ORM would be a good fit, and provides alternatives for other scenarios.
Prisma ORM likely is a good fit for you if ...
... you are building a server-side application that talks to a database
This is the main use case for Prisma ORM. Server-side applications typically are API servers that expose data operations via technologies like REST, GraphQL or gRPC. They are commonly built as microservices or monolithic apps and deployed via long-running servers or serverless functions. Prisma ORM is a great fit for all of these application and deployment models.
Refer to the full list of databases (relational, NoSQL, and NewSQL) that Prisma ORM supports.
... you care about productivity and developer experience
Productivity and developer experience are core to how we're building our tools. We're looking to build developer-friendly abstractions for tasks that are complex, error-prone and time-consuming when performed manually.
No matter if you're a SQL newcomer or veteran, Prisma ORM will give you a significant productivity boost for the most common database workflows.
Here are a couple of the guiding principles and general practices we apply when designing and building our tools:
- make the right thing easy
- pit of success
- offer intelligent autocompletion where possible
- build powerful editor extensions (e.g. for VS Code)
- go the extra mile to achieve full type-safety
... you are working in a team
Prisma ORM shines especially when used in collaborative environments.
The declarative Prisma schema provides an overview of the current state of the database that's easy to understand for everyone. This is a major improvement to traditional workflows where developers have to dig through migration files to understand the current table structure.
Prisma Client's minimal API surface enables developers to pick it up quickly without much learning overhead, so onboarding new developers to a team becomes a lot smoother.
The Prisma Migrate workflows are designed in a way to cover database schema changes in collaborative environments. From the initial schema creation up to the point of deploying schema changes to production and resolving conflicts that were introduced by parallel modifications, Prisma Migrate has you covered.
... you want a tool that holistically covers your database workflows
Prisma ORM is a lot more than "just another ORM". We are building a database toolkit that covers the daily workflows of application developers that interact with databases. A few examples are:
- querying (with Prisma Client)
- data modeling (in the Prisma schema)
- migrations (with Prisma Migrate)
- prototyping (via
prisma db push
) - seeding (via
prisma db seed
) - visual viewing and editing (with Prisma Studio)
... you value type-safety
Prisma ORM is the only fully type-safe ORM in the TypeScript ecosystem. The generated Prisma Client ensures typed query results even for partial queries and relations. You can learn more about this in the type-safety comparison with TypeORM.
... you want to write raw, type-safe SQL
In addition to the intuitive, higher-level query API, Prisma ORM also offers a way for you to write raw SQL with full type safety.
... you want an ORM with a transparent development process, proper maintenance & support
Development of Prisma ORM's open source tools is happening in the open. Most of it happens directly on GitHub in the main prisma/prisma
repo:
- issues and PRs in our repos are triaged and prioritized (usually within 1-2 days)
- new releases with new features and improvements are issued every three weeks
- we have a dedicated support team that responds to questions in GitHub Discussions
... you want to be part of an awesome community
Prisma has a lively community that you can find on Discord. We also regularly host Meetups, conferences and other developer-focused events. Join us!
Prisma ORM likely is not a good fit for you if ...
... you need full control over all database queries
Prisma ORM is an abstraction. As such, an inherent tradeoff of Prisma ORM is a reduced amount of control in exchange for higher productivity. This means, the Prisma Client API might have less capabilities in some scenarios than you get with plain SQL.
If your application has requirements for database queries that Prisma ORM does not provide and the workarounds are too costly, you might be better off with a tool that allows you to exercise full control over your database operations using plain SQL.
Note: If you can work around a certain limitation but still would like to see an improvement in the way how Prisma ORM handles the situation, we encourage you to create a feature request on GitHub so that our Product and Engineering teams can look into it.
Alternatives: SQL drivers (e.g. node-postgres
, mysql
, sqlite3
, ...)
... you do not want to write any code for your backend
If you don't want to write any code for your backend and just be able to generate your API server and the database out-of-the-box, you might rather choose a Backend-as-a-Service (BaaS) for your project.
With a BaaS, you can typically configure your data model via a high-level API (e.g. GraphQL SDL) or a visual editor. Based on this data model, the BaaS generates a CRUD API and provisions a database for you. With this setup, you typically don't have control over the infrastructure the API server and database are running on.
With Prisma ORM, you are building the backend yourself using Node.js or TypeScript. This means you'll have to do a lot more coding work compared to using a BaaS. The benefit of this approach is that you have full flexibility for building, deploying, scaling and maintaining your backend and are not dependent on 3rd party software for a crucial part of your stack.
Alternatives: AWS AppSync, 8base, Nhost, Supabase, Firebase, Amplication
... you want a CRUD GraphQL API without writing any code
While tools like the nexus-plugin-prisma
and typegraphql-prisma
allow you to quickly generate CRUD operations for your Prisma ORM models in a GraphQL API, these approaches still require you to set up your GraphQL server manually and do some work to expose GraphQL queries and mutations for the models defined in your Prisma schema.
If you want to get a GraphQL endpoint for your database out-of-the box, other tools might be better suited for your use case.
Alternatives: Hasura, Postgraphile