Nuxt3 中文课程《实战全栈开发简书》限时优惠

prisma
prisma

Integrate Nuxt with Prisma ORM to simplify database access!

Nuxt Prisma

npm version npm downloads License Nuxt

Are you a Nuxt developer? Or are you familiar with Prisma ORM and want to use it easily with Nuxt? Then this module is for you.

With this module, you can easily integrate Prisma ORM in your Nuxt app.

Features

  • Seamlessly set up Prisma CLI, Prisma schema, Prisma Migrate, and Prisma Client
  • Easily access Prisma Studio within Nuxt DevTools
  • Auto-imported usePrismaClient() composable for your Vue files

Quick setup

  1. Add @prisma/nuxt dependency to your project
    npm install @prisma/nuxt
    
  2. Add @prisma/nuxt to the modules section of nuxt.config.ts
    export default defineNuxtConfig({
      modules: ["@prisma/nuxt"],
    });
    
  3. Start the development server:
    npm run dev
    

    Starting the development server will:
    1. Automatically install the Prisma CLI
    2. Initialize a Prisma project with a SQLite database
    3. Create an User and Post example model in the Prisma Schema
    4. Prompt you to run a migration to create database tables with Prisma Migrate
    5. Install and generate a Prisma Client
    6. Prompt you to start the Prisma Studio

To learn more about how to use the module, visit our documentation