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

prisma-fertilizer

v1.0.0

Published

Generate seed files for Prisma projects using Faker.js

Readme

Prisma Fertilizer

Generate seed files for Prisma projects using Faker.js.

Overview

Prisma Fertilizer is a command-line tool that analyzes your Prisma schema and automatically generates a seed file with realistic fake data using Faker.js. This tool helps you quickly populate your database with test data that matches your schema's structure and relationships.

Features

  • Automatically analyzes your Prisma schema
  • Generates appropriate fake data based on field names and types
  • Respects relationships between models
  • Customizable number of records per model
  • Interactive model selection with checkbox interface
  • Smart default output path in the same directory as your schema file
  • Smart field detection for common field names (email, name, address, etc.)

Installation

Global Installation

npm install -g prisma-fertilizer

Local Installation

npm install --save-dev prisma-fertilizer

Usage

Command Line

# Basic usage with default options
npx prisma-fertilizer

# Specify schema path
npx prisma-fertilizer --schema ./path/to/schema.prisma

# Specify output path
npx prisma-fertilizer --output ./path/to/seed.js

# Generate 20 records per model
npx prisma-fertilizer --count 20

# Force overwrite of existing seed file
npx prisma-fertilizer --force

# Generate seed data for specific models only
npx prisma-fertilizer --models User,Post,Comment

Options

  • -s, --schema <path>: Path to your Prisma schema file (default: ./prisma/schema.prisma)
  • -o, --output <path>: Output path for the generated seed file (if not specified, defaults to the same directory as your schema file)
  • -c, --count <number>: Number of records to generate for each model (default: 10)
  • -f, --force: Overwrite existing seed file if it exists without prompting (default: false)
  • -y, --yes: Skip all confirmation prompts and use defaults (default: false)
  • -v, --version: Display version information
  • -h, --help: Display help information

Default Output Path

Prisma Fertilizer intelligently sets the default output path for your seed file to be in the same directory as your schema file. This means:

  • If your schema is at ./prisma/schema.prisma, the default output will be ./prisma/seed.js
  • If your schema is at ./src/database/schema.prisma, the default output will be ./src/database/seed.js

This behavior makes it easier to keep your seed files organized alongside your schema files, which is the recommended practice for Prisma projects.

Interactive Mode

When you run Prisma Fertilizer without using the -y flag, it will prompt you interactively:

$ prisma-fertilizer
🌱 Prisma Fertilizer - Generating seed file...
Where would you like to place the seed file? [./prisma/seed.js]: ./src/db/seed.js

# Model selection with checkboxes
Select models to generate seed data for (use space to select, enter to confirm):
❯◯ User
 ◯ Profile
 ◯ Post
 ◯ Comment
 ◯ Tag

The interactive mode provides a user-friendly checkbox interface for selecting which models to include in your seed file. Use the space bar to select/deselect models and press Enter to confirm your selection.

If the file already exists, it will ask for confirmation before overwriting:

File already exists at ./src/db/seed.js. Overwrite? (y/N):

Dependency Check

Prisma Fertilizer automatically checks if your project has the required @faker-js/faker dependency installed. If it's not found, it will offer to install it for you:

⚠️  Warning: @faker-js/faker is not installed in your project.
   The generated seed file will require this package to run.
Would you like to install @faker-js/faker as a dev dependency? (Y/n):

Example

For a schema with User and Post models:

model User {
  id        Int      @id @default(autoincrement())
  email     String   @unique
  name      String
  posts     Post[]
  createdAt DateTime @default(now())
}

model Post {
  id        Int      @id @default(autoincrement())
  title     String
  content   String
  published Boolean  @default(false)
  author    User     @relation(fields: [authorId], references: [id])
  authorId  Int
  createdAt DateTime @default(now())
}

The generated seed file will create users with realistic names and emails, and posts with appropriate titles and content, maintaining the relationships between them.

Contributors

See CONTRIBUTORS.md for a list of the project's contributors.

License

This project is licensed under the MIT License - see the LICENSE file for details.