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

@breadstone-infrastructure/prisma-seeds

v0.0.256

Published

Prisma seeds

Readme

@strivio/prisma-seeds

Database seeding framework for Prisma with JSON-based data loading.

Quick Start

# Populate database
yarn nx run api:db:seed

# Reset and re-populate
yarn nx run api:db:reset

Documentation

📖 Full documentation: docs/infrastructure/prisma-seeds.md

Topics covered:

  • JSON-based seeding architecture
  • Validation and schema definitions
  • Multi-language support
  • Asset management
  • Relationship handling

Development

# Build
yarn nx build prisma-seeds

# Test
yarn nx test prisma-seeds

# Lint
yarn nx lint prisma-seeds

Project Structure

libs/backend/features/[feature]/
├── seed.config.mjs         # Configuration
└── .seed/
    ├── data/               # JSON content files
    │   └── items.json
    ├── schemas/            # Validation rules (optional)
    │   └── item.schema.json
    └── assets/             # Images and media
        └── images/

Example: Products

Data File (.seed/data/products.json):

{
  "products": [
    {
      "id": "prod-001",
      "name": {
        "en": "Protein Powder",
        "de": "Protein Pulver"
      },
      "price": 49.99,
      "category": "supplements",
      "image": "@asset:protein-powder"
    }
  ]
}

Result:

  • Product created in database
  • Name available in English and German
  • Image uploaded to cloud storage
  • Linked to supplements category

Documentation

Complete guides available in /docs/seeding/:

Getting Started

Features

Best Practices

Common Use Cases

Initial Setup

Populate database with essential data:

  • User authentication
  • Categories and tags
  • Reference data

Content Updates

Deploy new or updated content:

  • New exercises
  • Updated recipes
  • Fresh tips

Development

Create test data:

  • Sample users
  • Example workouts
  • Test products

Configuration

Each feature defines its own seeding:

Basic Configuration:

  • name - Feature identifier
  • order - When to run (1-100)
  • dependencies - Required features
  • data - JSON file paths
  • assets - Image configuration

Processing Options:

  • validation - Schema checking
  • updates - Create vs update logic
  • relationships - Link to other entities

Entity Resolution

Automatically find and link related data:

Example:

{
  "exercise": {
    "name": "Bench Press",
    "category": "barbell",
    "muscles": ["chest", "triceps"]
  }
}

System will:

  1. Find "barbell" category by name
  2. Find "chest" and "triceps" muscles
  3. Create proper database links

Localization

Support multiple languages:

JSON Format:

{
  "name": {
    "en": "Bench Press",
    "de": "Bankdrücken"
  }
}

Database Storage:

  • Primary language (EN) for search
  • All translations in separate table
  • Fallback to English if missing

Asset Management

Upload images automatically:

JSON Reference:

{
  "image": "@asset:bench-press"
}

Process:

  1. Find image file in .seed/assets/
  2. Optimize (resize, format conversion)
  3. Upload to cloud storage (Vercel Blob)
  4. Store URL in database

Performance

Optimized Processing:

  • Auto-caching prevents duplicate queries
  • Batch processing for efficiency
  • Transaction support for consistency

Example:

  • 540 exercises processed in ~4 minutes
  • Single query loads all categories (cached)
  • No N+1 query problems

CLI Commands

# Seed everything
yarn nx run api:db:seed

# Reset and re-seed
yarn nx run api:db:reset

# Seed specific feature
yarn nx run api:db:seed --feature=fit

Troubleshooting

Validation Errors

Check JSON structure matches schema.

Missing References

Ensure related entities seeded first (check order/dependencies).

Asset Upload Fails

Verify Vercel Blob token and network connection.

Duplicate Entries

Check unique field configuration and existing data.

Development

Adding New Features

  1. Create .seed/ directory in feature
  2. Add JSON data files
  3. Create seed.config.mjs
  4. Test locally
  5. Commit and deploy

Updating Content

  1. Edit JSON files
  2. Run seeding locally
  3. Verify changes
  4. Commit updates
  5. Deploy to production

Testing

# Test with fresh database
yarn nx run api:db:reset
yarn nx run api:db:seed

# Validate JSON
cat .seed/data/items.json | jq .

Architecture

Modular Design:

  • Each feature owns its data
  • Clear dependencies
  • Isolated testing
  • Easy to extend

Type-Safe:

  • TypeScript throughout
  • Prisma type generation
  • Validation schemas

Production-Ready:

  • Error handling
  • Logging
  • Performance optimized
  • Tested at scale

Support

For questions or issues:

  • Check /docs/seeding/ documentation
  • Review example implementations
  • See feature-specific READMEs

Version: 2.0 Updated: January 2025