Skip to content

Prisma Getting Started

Prisma is a modern database toolkit that makes database setup and access easy in a NodeJS-based project like Remix.

It uses Typescript to define the database schema and provides a powerful query engine to access the database.

Take a look at the following example Prisma query:

Prisma Query

Take a minute to read through this carefully. See if you can work out what the query is asking the database for before reading the solution below.

  1. Firstly, we are querying the User table.
await prisma.user
  1. We are asking the database to find a single, unique user where the email field is alice@prisma.io.
await prisma.user
.findUnique({
where: { email: 'alice@prisma.io' }
})
  1. We are then asking for the posts that this user has written.
.findUnique({
where: { email: 'alice@prisma.io' }
})
.posts
  1. Finally, we are asking for the post where the title contains a certain word or string which we haven’t described yet.
.posts({
where: { title: { contains: '...' } }
})
Click to reveal

There are lots of resources online to help you get started with Prisma. Some of the best have been collected for you in the resources section of this site.

For now, let’s get started with the Prisma schema.