Note: .env
file was sanitized in this package release. Use .env.example
to set DATABASE_URL
before running anything that needs a DB.
Mocktail‑CLI — The schema‑aware mock data generator for developers. Generate realistic, relation‑aware mock data from your Prisma schema directly from the command line.
- What is Mocktail‑CLI?
- Key features
- Why use Mocktail‑CLI?
- Quickstart
- CLI reference (examples)
- Configuration
- Example workflows
- Competitor comparison
- Roadmap
- Contributing
- License & Contact
Mocktail-CLI is a Prisma-aware CLI tool for generating realistic mock data based on your database schema. It supports nested relations, circular relation handling, deterministic seeds, schema auto-detection, and multiple output formats. Perfect for building, testing, and prototyping without waiting on backend data.
- Schema auto-detection — automatically finds and validates schema.prisma.
- Advanced relation presets — generate realistic domain graphs (blog, ecommerce, social).
- Schema-aware generation — matches Prisma model types and relations.
-
Relation handling — supports deep and circular relations with controlled
--depth
. -
Deterministic seeds — reproducible datasets with
--seed
and--seed-value
. - Multiple output formats — JSON, SQL, CSV, TypeScript.
-
Custom generators — define per-model faker rules in
mocktail-cli.config.js
. - CLI-first — quick commands for generate, seed, and export.
- Save development time — no more hand‑crafting mock data.
- Build realistic prototypes — frontend and backend can develop in parallel.
- Reliable testing — deterministic seeds make tests repeatable.
- Flexible outputs — works with files, databases, or API mocks.
# global install
npm i -g mocktail-cli
# or run on demand
npx mocktail-cli generate --help
npx mocktail-cli generate \
--schema ./prisma/schema.prisma \
--models User,Post \
--count 50 \
--out ./mocks/data.json \
--format json \
--seed
-
--depth 2
— set how deep nested relations go. -
--out
— output to a file or stdout. -
--preset blog
— generate domain-specific data.
# Generate 20 Users
mocktail-cli generate --models User --count 20
# Generate Users and Posts with specific counts
mocktail-cli generate --models User,Post --count 10,30 --out ./mocks
# Generate SQL inserts instead of JSON
mocktail-cli generate --format sql --out ./seeds
# Use a preset for ecommerce data
mocktail-cli generate --preset ecommerce --count 100
#Full option list
Option Alias Description
-c, --count <number> Number of records per model (default: 5)
-o, --out <directory> Output directory
-f, --format <type> Output format: json, sql, ts, csv (default: json)
-s, --schema <path> Prisma schema path (default: ./prisma/schema.prisma, auto-detect enabled)
-m, --models <models> Comma-separated list of models (optional)
--mock-config <path> Path to mocktail-cli.config.js
-d, --depth <number> Nested relation depth (default: 1)
--seed Insert generated data into DB
--seed-value <number> Seed value for reproducible data generation
--preset <type> Relation preset: blog, ecommerce, social
--force-logo Force show the logo animation even if shown before
-h, --help Display help with usage and examples
Define a mocktail-cli.config.js
or mocktail-cli.config.json
to customize generation.
module.exports = {
defaults: { locale: 'en', seedConsistency: true },
models: {
User: { count: 20, faker: { name: 'fullName', email: 'email' } },
Post: { count: 50, relations: { author: { connectBy: 'User' } } }
}
}
- Generate realistic data:
mocktail-cli generate --count 50
- Feed the output to your mock API server.
- Generate with seed:
mocktail-cli generate --seed --seed-value 42
- Run tests with consistent fixtures.
mocktail-cli generate --preset social --count 100 --seed
How Mocktail-CLI compares with other schema-aware mock data tools:
Feature / Tool | Mocktail-CLI | Prisma-Seed | Prisma-Generator-Fake | Mockoon / MirageJS | faker-js |
---|---|---|---|---|---|
Prisma schema aware (reads schema) | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | ❌ No |
Auto-detect Prisma schema | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |
Handles relations (deep / circular-safe) | ✅ Deep + safe | ❌ Manual | ❌ No | ||
Deterministic seeds | ✅ --seed-value
|
❌ No | ✅* | ||
Output formats | ✅ JSON / SQL / CSV / TS | ❌ Mostly JSON | ❌ Mostly JSON | ✅ JSON / API | |
CLI-first workflow | ✅ Yes | ✅ Yes (server) | ❌ No | ||
Relation presets (blog / ecommerce / social) | ✅ Built-in | ❌ No | ❌ No | ❌ No | ❌ No |
DB seeding | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |
Extensible config | ✅ mocktail-cli.config.js
|
* faker-js
supports faker.seed(...)
for deterministic values, but it is not schema-aware and doesn’t handle relations automatically.
❤️ Mocktail-CLI uses @faker-js/faker
internally for realistic field data — every record feels lifelike.
Takeaway:
- Mocktail-CLI is the only Prisma-native, CLI-first tool that:
- Auto-detects your schema
- Generates deep relation-safe mock data
- Supports reproducible seeds
- Offers multiple output formats & realistic presets
- v1.0: CLI complete with flags for depth, output formats, custom config.
- v1.1: ✅ Schema auto-detection, advanced relation presets (blog, ecommerce, social).
- v1.2+: Integration with Mockilo for API mocking, seeding, and team workflows.
We welcome PRs, bug reports, and feature ideas.
- Fork the repo
- Create a feature branch
- Submit PR with tests and docs
License Update: From v1.1.1-beta.0, Mocktail-CLI is licensed under BSL-1.1. Older versions (<=1.1.0-beta.3) remain MIT.
- ☕🍹 Welcome to Mocktail CLI 🍹☕
Order up! Your personal code barista is here. Serving fresh, Prisma-aware mock data, shaken not stirred.