Manage your data at scale with CockroachDB and Prisma – a next-generation ORM for Node.js and TypeScript.
Prisma makes working with data easy! It offers a type-safe Node.js & TypeScript ORM, global database caching, connection pooling, and real-time database events.
// Creating a new recordawait prisma.user.create({ firstName: “Alice”, email: “alice@prisma.io”})
id firstName email 1 Bobby bobby@tables.io2 Nilufar nilu@email.com3 Jürgen jums@dums.edu4 Alice alice@prisma.io
CockroachDB is a relational, PostgreSQL wire-protocol-compatible database built for cloud applications and services. It automates the task of scale, so developers no longer have to choose between the data integrity offered by a relational database or the availability of NoSQL. And, when using CockroachDB developers don’t have to worry about deployment or ongoing administration/management of the database.
Prisma is an open-source ORM that integrates seamlessly with CockroachDB and supports the full development cycle. Prisma helps you define your database schema declaratively using the Prisma schema and fetch data from CockroachDB with full type safety using Prisma Client.
Together the two technologies give developers access to the scalable infrastructure of a distributed database without requiring them to be experts in hosting and scaling databases.
The Prisma schema uses Prisma's modeling language to define your database schema. It makes data modeling easy and intuitive, especially when it comes to modeling relations.
Migrating your database schema is painless: you update the data model in your Prisma schema, run prisma db push
to apply the schema changes, and CockroachDB will handle applying those changes to each database in your cluster.
1// Define the `User` table in the database2model User {3 id String @id @default(cuid())4 email String @unique5 password String 6 name String? 7 posts Post[]8}9
10// Define the `Post` table in the database11model Post {12 id String @id @default(cuid())13 title String14 content String?15 authorId String16 author User @relation(fields: [authorId], references: [id])17}
"CockroachDB and Prisma is a match made in heaven. Not only does it simplify data but it also eliminates database operations so you can focus on what you want to…your code."
CockroachDB clusters your databases into a single logical database, allowing it to apply schema migrations incrementally.
Introspection allows you to pull down and easy-to-read representation of your database's schema. Here you have the ability to view and modify your indexes.
CockroachDB multi-cloud deployments allow you to avoid cloud-specific outages by deploying your database cluster to multiple providers at once.
Prisma Client ensures fully type-safe database queries with benefits like autocompletion - even in JavaScript.
CockroachDB's distributed data model allows you to manage your relational data as if it were in a single logical database.
Prisma's modeling language is declarative and lets you intuitively describe your database schema.
In this article, we announce the general availability of the Prisma CockroachDB connector and take a look at some of the reasons why you should use Prisma and CockroachDB together.
How Tryg transforms billions of records from different data sources, and expose a single data model via GraphQL and Prisma.
This section of the docs covers the details of Prisma's CockroachDB data source connector.
In this section of the docs, you will learn about the concepts behind using Prisma and CockroachDB, the commonalities and differences between CockroachDB and other database providers, and the process for configuring your application to integrate with CockroachDB.
We have multiple channels where you can engage with members of our community as well as the Prisma team.