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
pnpm
pnpm create sidebase@latest
yarn
# Note: Due to a known problem with `yarn`, it is not possible to force yarn to always use `@latest`: https://github.com/yarnpkg/yarn/issues/6587yarn create sidebase

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 the event.context.prisma which allows you to access a PrismaClient 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 a beforeEach 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.