Prisma is the next generation of Node.js and TypeScript ORM. After more than two years in development, we are happy to share that all Prisma tools are ready to go into production!

A new paradigm for object-relational mapping

Prisma is the next open source ORM for Node.js and TypeScript. It contains the following tools:

  • Prisma Client — an automatically generated and type-safe database Client
  • Prisma Migrate — Declarative data modeling and customizable migration
  • Prisma Studio — Modern user interface for viewing and editing data

These tools can be used together or separately in any Node.js or TypeScript project. Prisma currently supports PostgreSQL, MySQL, SQLite, and SQL Server (preview). MongoDB connectors are being developed, register for the Early Access program here.

Databases are hard

Working with databases is one of the most challenging areas of application development. Data modeling, schema migration, and writing database queries are common tasks that application developers deal with every day.

At Prisma, we found that the Node.js ecosystem, while increasingly popular for building database-enabled applications, does not provide modern tools for application developers to handle these tasks.

Application developers should care about data, not SQL

As tools become more specialized, application developers should be able to focus on adding value to the organization rather than spending time writing glued code to traverse the layers of the application.

Prisma-node. js and TypeScript complete ORM

Although Prisma addresses similar problems as traditional ORMs, it addresses these problems in a fundamentally different way.

Data modeling in Prisma schema

With Prisma, you can define data models in Prisma schemas. Here is a sample Prisma model:

model Post {
  id        Int     @id @default(autoincrement())
  title     String
  content   String?
  published Boolean @default(false)
  author    User?   @relation(fields: [authorId], references: [id])
  authorId  Int?
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
  posts Post[]
}
Copy the code

Each of these models maps to tables in the underlying database and serves as the basis for the generated data access API provided by Prisma Client. Prisma’s VS Code extension provides syntax highlighting, auto-completion, quick fixes, and many other features to make data modeling a magical and enjoyable experience.

Prisma Migrate was used for database migration

Prisma Migrate converts Prisma schemas into the SQL required to create and change tables in a database. You can use it through the Prisma migration command provided with the Prisma CLI.

PostgreSQL:

CREATE TABLE "Post" (
    "id" SERIAL NOT NULL,
    "title" TEXT NOT NULL,
    "content" TEXT,
    "published" BOOLEAN NOT NULL DEFAULT false,
    "authorId" INTEGER.PRIMARY KEY ("id")
);

CREATE TABLE "User" (
    "id" SERIAL NOT NULL,
    "email" TEXT NOT NULL,
    "name" TEXT,

    PRIMARY KEY ("id")
);

CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");

ALTER TABLE "Post" ADD FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
Copy the code

While automatically generating SQL based on Prisma patterns, you can easily customize it to your specific needs. In this way Prisma Migrate achieves a good balance between productivity and control.

Use Prisma Client for intuitive and type-safe database access

The main benefit of working with Prisma Client is that it allows developers to think inside objects, thus providing a familiar and natural way to reason about their data.

Prisma Client has no concept of model instances. Instead, it helps to formulate database queries that always return pure JavaScript objects. Thanks to the generated types, you also get auto-completion for these queries.

Also, as a bonus to TypeScript developers. All results of Prisma Client queries are fully typed. In fact, Prisma provides the strongest type-safety guarantee of any TypeScript ORM (you can read a type-safety comparison with TypeORM here).

Prisma Studio’s modern management interface

Prisma also provides a modern management interface for your database — think phpMyAdmin, but in 2021. 😉

Prisma fits any technology stack

Prisma is independent of the application you build and will complement your technology stack nicely, no matter what your favorite technology is. You can find more information about how Prisma works with your favorite framework or library here.

Prepare for the production of mission-critical applications

Prisma has grown a lot over the past three years and we are excited to share the results with the developer community.

From GraphQL to the database

Since we started building developer tools, as a company, we have gone through a number of major product iterations and development processes over the past few years:

Prisma is the result of the lessons we learned from being early innovators in the GraphQL ecosystem and insights we gained from data layers of all sizes, from small startups to large enterprises.

Prisma has been used by thousands of companies since it was first released three years ago, and Prisma is battle-tested and ready for mission-critical applications.

We care about developers

Prisma is open to development. Our product and engineering teams are monitoring GitHub for issues and typically respond within 24 hours of issues opening.

New releases are released every two weeks and include new features, bug fixes, and numerous improvements. After each launch, we broadcast the new features live on Youtube and get feedback from the community.

We also try to help developers with any questions they have about Prisma through dedicated community support teams, whether it’s on Slack, GitHub discussion boards or Stackoverflow.

Here’s the number of our communities:

The company uses Prisma in its manufacturing

We are excited to see how Prisma is helping companies of all sizes increase productivity and deliver products faster.

During our trip, companies like Adidas, HyreCar, Agora Systems, Labelbox, and others gave us valuable advice on how to grow our products. We are privileged to work with some of the most innovative and ingenious technology leaders.

If you want to learn more about how Prisma can help these companies become more productive, check out the following resources:

  • Rapha

    • Blog – How does Prisma help Rapha manage its mobile application data
    • Talk – Prisma Rapha
  • iopool

    • Blog – How did Iopool use Prisma to refactor its application in less than 6 months
    • Talk – Prisma ipool

From prototype to development to production

The best developer tools are those that go off the beaten track and can easily adapt to the growing complexity of a project. That’s exactly how we designed Prisma.

Prisma has built-in workflows for all phases of the development life cycle, from prototyping to development, to deployment, to CI/CD, to testing, and more.

The next generation Web framework is built on Prisma

We are particularly humble that many framework and library authors have chosen Prisma as the default ORM for their tools. Here are some options for using Prisma’s advanced frameworks:

  • RedwoodJS – A full stack framework based on React and GraphQL
  • Blitz — A full-stack framework based on next.js
  • KeystoneJS – headless CMS
  • Wasp — DSL for developing full-stack Web applications based on React
  • Amplication — a tool set for building full-stack applications based on React and NestJS

Open Source and others

We are a VC-funded company whose team is passionate about improving the lives of application developers. When we started our journey by building open source tools, our long-term vision for Prisma was much bigger than building “just” ORM.

At our recent corporate events and Prisma gatherings, we began to share this vision, which we call an Application Data Platform.

Prisma’s vision is to democratize the custom data access layers used by companies like Facebook, Twitter, and Airbnb and make them accessible to development teams and organizations of all sizes.

The idea is largely inspired by companies like Facebook, Twitter, and Airbnb, which have built custom data access layers on top of their databases and other data sources to make it easier for application developers to access the data they need in a secure and efficient way.

Prisma aims to democratize the idea of this custom data access layer and make it available to development teams and organizations of any size.


Translated from www.prisma.io/blog/prisma…