Introduction
nuxt-prisma
was an open source Nuxt layer that provided an Prisma ORM integration for Nuxt 3 applications. It is now in the process of being deprecated in favor of the sidebase CLI:
npm
npm create sidebase@latest
It also allows adding Prisma to Nuxt 3 projects and exposes the same helpers and utilities as this layer. The deprecation will comeplete on the 31.01.2023. Afterwards these docs will forward to the sidebase CLI. Follow this issue for the deprecation.
nuxt-prisma
:
- Adds
prisma: PrismaClient
to theevent.context.prisma
which allows you to access aPrismaClient
on the server-side, the client is setup following prisma best practices - Adds
resetDatabase
, a testing utility that resets your database, this can be useful for testing, e.g., in abeforeEach
hook
After setting up your Nuxt 3 app with the sidebase CLI your endpoints will be able to do this:
// file: ~/server/api/example.get.tsexport default eventHandler((event) => { return event.context.prisma.example.findMany()})
See more in the Quick Start section.