Prisma Getting Started
What is Prisma?
Section titled βWhat is Prisma?β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.
Example Prima Query
Section titled βExample Prima QueryβTake a look at the following example 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.
- Firstly, we are querying the
User
table.
await prisma.user
- We are asking the database to find a single, unique user
where
theemail
field isalice@prisma.io
.
await prisma.user .findUnique({ where: { email: 'alice@prisma.io' } })
- We are then asking for the
posts
that this user has written.
.findUnique({ where: { email: 'alice@prisma.io' } }) .posts
- Finally, we are asking for the
post
where thetitle
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.