Skip to main content
Drizzle Seed is a TypeScript library for generating realistic, deterministic fake data to populate your database. Using a seedable pseudorandom number generator (pRNG), it produces consistent, reproducible data across runs - perfect for testing, development, and debugging.
Requires drizzle-orm@0.36.4 or higher for full compatibility with identity columns and type safety.

Installation

You must have drizzle-orm installed:

Quick Start

Generate 10 users with random data:

How It Works

Deterministic Data Generation

Drizzle Seed uses a pseudorandom number generator (pRNG) initialized with a seed value. The same seed always produces the same sequence of data:
Benefits:
  • Consistency - Tests run on identical data every time
  • Debugging - Reproduce bugs with the same data set
  • Collaboration - Team members share seed values for consistent data

Automatic Type Inference

Drizzle Seed analyzes your schema and generates appropriate data for each column type:

Basic Usage

Specify Count

Generate a specific number of records:

Set Seed Value

Use different seeds for different data sets:

Advanced Usage with Refinements

Customize data generation with the refine method:

Generator Functions

Drizzle Seed provides extensive generator functions:

String Generators

Number Generators

Date and Time Generators

Special Generators

Custom Values

Unique Generators

Generate unique values:
Generate data for tables with relationships:

Weighted Relationships

Create varied relationship counts:

Reset Database

Clear and reseed your database:
This deletes all data in the specified tables. Use with caution!

Common Patterns

E-commerce Example

Blog Platform Example

Testing Patterns

Test Setup

Multiple Scenarios

Performance Tips

1

Use appropriate counts

Start with small counts during development:
2

Batch operations

Drizzle Seed automatically batches inserts for better performance.
3

Disable constraints for large seeds

For very large datasets, consider temporarily disabling foreign key constraints:

Best Practices

Consistent Seeds

Use the same seed value for tests to ensure reproducible results

Realistic Data

Use appropriate generators to create data that resembles production

Relationship Balance

Use weighted relationships to simulate realistic data distribution

Clean State

Reset database between test runs for isolation

Next Steps

Schema Validation

Validate seeded data with Zod, Valibot, or TypeBox

Testing Guide

Learn testing patterns with Drizzle ORM