### Example Usage Source: https://github.com/zrosenbauer/fastify-prisma/blob/main/README.md Example of accessing the PrismaClient after registering the plugin. ```typescript const allTheDucks = await server.prisma.rubberDucky.findMany(); ``` -------------------------------- ### Install the package Source: https://github.com/zrosenbauer/fastify-prisma/blob/main/README.md Instructions for installing the package using different package managers. ```shell npm i @zrosenbauer/fastify-prisma ``` ```shell yarn add @zrosenbauer/fastify-prisma ``` ```shell pnpm add @zrosenbauer/fastify-prisma ``` -------------------------------- ### Install Husky and Pre-Commit Hooks Source: https://github.com/zrosenbauer/fastify-prisma/blob/main/CONTRIBUTING.md This command installs Husky, which is necessary for linting and testing commits before they are pushed. ```bash husky install ``` -------------------------------- ### Register the plugin (javascript) Source: https://github.com/zrosenbauer/fastify-prisma/blob/main/README.md Example of registering the plugin with Fastify using JavaScript. ```javascript const fastifyPrisma = require("@zrosenbauer/fastify-prisma"); const { PrismaClient } = require("../my-prisma-client"); await fastify.register(fastifyPrisma, { client: new PrismaClient(), }); ``` -------------------------------- ### Accessing the prisma client Source: https://github.com/zrosenbauer/fastify-prisma/blob/main/README.md Example of how to access and use the PrismaClient within a Fastify plugin. ```typescript async function somePlugin(server, opts) { const ducks = await server.prisma.rubberDucky.findMany(); // do something with the ducks, log for now server.log.warn({ ducks }, "🐥🐥 There are lots of ducks! 🐥🐥"); } ``` -------------------------------- ### Register the plugin (typescript) Source: https://github.com/zrosenbauer/fastify-prisma/blob/main/README.md Example of registering the plugin with Fastify using TypeScript, including the necessary module declaration for types. ```typescript import fastifyPrisma from "@zrosenbauer/fastify-prisma"; import { PrismaClient } from "../my-prisma-client"; // Add this so you get types across the board declare module "fastify" { interface FastifyInstance { prisma: PrismaClient; } } await fastify.register(fastifyPrisma, { client: new PrismaClient(), }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.