Skip to content

Files

Latest commit

 

History

History

nuxt-prisma-module

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Example Nuxt App Using Prisma Nuxt Module

This example app showcases how to use the Prisma Nuxt module.

The app demonstrates:

  • How to use the usePrismaClient composable in a server-side component named FirstUser.server.vue.
  • How to customize the PrismaClient in the file lib/prisma.ts, which is generated by the @prisma/nuxt module. This customization adds an exists method to the PrismaClient instance. The extended instance of the PrismaClient with the exists method is then used in the API route located at the user-exists.ts file.

Getting started

  1. Download example and install dependencies:

    npx try-prisma@latest --template orm/nuxt-prisma-module
    
  2. Navigate into the project directory:

    cd nuxt-prisma-module
    
  3. Create a .env file:

    DATABASE_URL="file:./dev.db"
    
  4. Start the development server:

    npm run dev
    
  5. Follow the instructions in the terminal to launch Prisma Studio integrated in the Nuxt devtools within your browser.

Resources