Prisma Client

Intuitive Database Client for TypeScript and Node.js

The Prisma Client works seamlessly across languages and databases. Ship faster by writing less SQL. Avoid mistakes with a fully type-safe API tailored specifically for your app.

Prisma Client

Explore the
Prisma Client API

From simple reads to complex nested writes, the Prisma Client supports a wide range of operations to help you make the most of your data.

  TypeScript
Get Started
Reading Data
1// Find all posts
2const allPosts: Post[] = await prisma.post.findMany()
1// Find a user by ID
2const userById: User | null = await prisma.user.findUnique({
3 where: {
4 id: 2,
5 },
6})
1// Find a user by email
2const userByEmail = await prisma.user.findUnique({
3 where: {
4 email: 'ada@prisma.io',
5 },
6})
1// Find the first user that contains Ada
2const userByName = await prisma.user.findFirst({
3 where: {
4 name: {
5 contains: 'Ada',
6 },
7 },
8})
1// Select specific fields
2const userName = await prisma.user.findUnique({
3 where: {
4 email: 'ada@prisma.io',
5 },
6 select: {
7 name: true,
8 email: true,
9 },
10})
1// Find all posts
2const allPosts: Post[] = await prisma.post.findMany()
1// Find a user by ID
2const userById: User | null = await prisma.user.findUnique({
3 where: {
4 id: 2,
5 },
6})
1// Find a user by email
2const userByEmail = await prisma.user.findUnique({
3 where: {
4 email: 'ada@prisma.io',
5 },
6})
1// Find the first user that contains Ada
2const userByName = await prisma.user.findFirst({
3 where: {
4 name: {
5 contains: 'Ada',
6 },
7 },
8})
1// Select specific fields
2const userName = await prisma.user.findUnique({
3 where: {
4 email: 'ada@prisma.io',
5 },
6 select: {
7 name: true,
8 email: true,
9 },
10})

Supported Databases

index.tsx
1await prisma.user.findMany({
2 where: {
3 email: {
4 endsWith: '@prisma.io',
5 }
6 },
7 include: {
8 p
9 }
10})
 
postsPost[]
profileProfile

Editor Integration

Autocomplete your

way to Success

The best code is the code that writes itself. Prisma Client gives you a fantastic autocomplete experience so you can move quickly and be sure you don't write an invalid query. Our obsession with type safety means you can rest assured that your code works as expected, every time.

Interface sketch and icon of Prisma studio

Prisma Studio

Visual database browser

The easiest way to explore and manipulate Data in your Prisma projects. Understand your data by browsing across tables and their relations and edit them with safety. Available for macOS, Windows and Linux.

diagram showing model schema evolution

Prisma Migrate

Hassle-free migrations

Based on the Prisma Schema, Prisma Migrate automatically generates SQL database migrations, that are fully customizable. For quick data model prototyping in development, prisma db push lets you make changes to the database without generating migration files.

Get Involved

Join the Prisma Community

Join us on Slack

Get help and engage with thousands of Node.js, Typescript and Prisma developers on Slack

Join Prisma Slack

Get TypeScript stickers

Show your TS + Prisma love with custom free stickers

Order stickers

Get Node.js stickers

Show your Node.js + Prisma love with custom free stickers

Order stickers