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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pglabs/next-prisma

v0.3.0

Published

Loving both Prisma and Next.js but struggling to make them work together? This package is for you!

Readme

Next Prisma

NPM Version NPM Downloads NPM Collaborators NPM Last Update

Loving both Prisma and Next.js but struggling to make them work together? This package is for you!

(is now supposed to work for both webpack and turbopack)

Features

  • Automatic Prisma Client Generation: Automatically generates the Prisma client when you run next dev.
  • Automatic Singleton Client Instance: Ensures that the Prisma client is a singleton instance, preventing multiple connections to the database.
  • Complete Automatic Initialization: You do not need to worry about initializing the Prisma client. It is done automatically for you, in the folder of your choice.
  • Automatic Studio Start: Automatically starts Prisma Studio when you run next dev in development mode.

Quick Start

  1. Install the package:
npm install @pglabs/next-prisma
  1. Update the next.config.ts file of your Next.js project:
import { withNextPrisma } from "@pglabs/next-prisma";

const nextConfig = {
  // Your Next.js config
};

export default withNextPrisma(nextConfig);
  1. Run the development server:
npm run dev

It will automatically init prisma, create a first migration and create the prisma client !

Configuration

You can configure the package by adding a second argument to the withNextPrisma function. The configuration object can contain the following properties:

  • runMigration: boolean (default: true)

    • If set to true, the package will automatically run an initial migration if the migrations folder does'nt exists
  • prismaRoot: string (default: "prisma")

    • The folder where prisma lives, where the schema.prisma will be created and where the migrations and clients will be stored.
  • dbProvider: string (default: "sqlite")

    • Tell the package which database provider to use. It will be used to create the schema.prisma file. The default is sqlite, but you can also use postgresql, mysql,sqlserver, mariadb, mongodb and cockroachdb.
  • startStudio: boolean (default: false)

    • If set to true, the package will automatically start Prisma Studio when you run next dev in development mode.

Contributing

If you want to contribute to the project, feel free to open an issue or a pull request. We welcome any contributions, whether it's bug fixes, new features, or improvements to the documentation.

Read the contributing guide and code of conduct for more information.

git clone https://github.com/pglabs/next-prisma.git
cd next-prisma
pnpm install

Make sure to use pnpm to install the dependencies or at least make sure to have it installed globally since some tests require it ( most of them actually, especially the one under the directory e2e, that init several next.js projects and test the package usecase scenarios).

Here are the available scripts:

  • pnpm build: Build the package in dist folder
  • pnpm test: Run all unit tests (under the directory tests)
  • pnpm e2e: Run all e2e tests (under the directory e2e)
  • pnpm lint: Run the linter
  • pnpm format: Format the code with Prettier
  • pnpm release: Release a new version of the package (that's my job there)

To test the project during your development project feel free to duplicate the e2e/fixture/starter folder and run the following command:

pnpm dev

License

This project is licensed under the MIT License. See the LICENSE file for more information.