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 namedFirstUser.server.vue
. - How to customize the
PrismaClient
in the file lib/prisma.ts, which is generated by the@prisma/nuxt
module. This customization adds anexists
method to thePrismaClient
instance. The extended instance of thePrismaClient
with theexists
method is then used in the API route located at theuser-exists.ts
file.
-
Download example and install dependencies:
npx try-prisma@latest --template orm/nuxt-prisma-module
-
Navigate into the project directory:
cd nuxt-prisma-module
-
Create a
.env
file:DATABASE_URL="file:./dev.db"
-
Start the development server:
npm run dev
-
Follow the instructions in the terminal to launch Prisma Studio integrated in the Nuxt devtools within your browser.
- Check out the Prisma Nuxt module Documentation
- Check out the Prisma docs
- Join our community on Discord to share feedback and interact with other users.
- Subscribe to our YouTube channel for live demos and video tutorials.
- Follow us on X for the latest updates.
- Report issues or ask questions on GitHub.