npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zrosenbauer/fastify-prisma

v7.0.2

Published

Fastify Prisma plugin connection to share the same connection across your entire server.

Readme

fastify-prisma

npm version ci: Code Standards & Testing Linted with oxlint

Fastify Prisma plugin to share the same PrismaClient across your entire server.

const allTheDucks = await server.prisma.rubberDucky.findMany();

Requirements

  • fastify >= 5.x
  • @prisma/client >= 6.x
  • prisma set up using the output config 👉 see docs

Getting Started

Before using this plugin you will need to have prisma set up. Once you are all set with prisma install the package and register the plugin on your server.

Install the package

npm

npm i @zrosenbauer/fastify-prisma

yarn

yarn add @zrosenbauer/fastify-prisma

pnpm

pnpm add @zrosenbauer/fastify-prisma

Register the plugin

javascript

const fastifyPrisma = require("@zrosenbauer/fastify-prisma");
const { PrismaClient } = require("../my-prisma-client");

await fastify.register(fastifyPrisma, {
  client: new PrismaClient(),
});

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(),
});

[!WARNING] Make sure you add in the module declaration or you won't have types!

Accessing the prisma client

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! 🐥🐥");
}

[!TIP] You can see a working example of this in the examples directory.

Version Compatibility

Different versions of this library support different versions of fastify and @prisma/client. Please use the version you need based on your project's dependencies.

The table below shows the compatibility matrix.

| @zrosenbauer/fastify-prisma | fastify | @prisma/client | status | | ---------------------------------- | --------- | ---------------- | ----------------------------------------------------- | | 7.x | 5.x | 7.x | active | | @joggr/fastify-prisma <= 7.0.1 | — | — | deprecated — renamed to @zrosenbauer/fastify-prisma |

License

Licensed under MIT.