New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@mockilo/mocktail-cli

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mockilo/mocktail-cli

**Craft your data cocktail — realistic mock data, shaken not stirred.**

Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
7
-41.67%
Maintainers
1
Weekly downloads
 
Created
Source

Mocktail-CLI

Note: .env file was sanitized in this package release. Use .env.example to set DATABASE_URL before running anything that needs a DB.

npm version License Downloads

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.

Table of contents

  • What is Mocktail‑CLI?
  • Key features
  • Why use Mocktail‑CLI?
  • Quickstart
  • CLI reference (examples)
  • Configuration
  • Example workflows
  • Competitor comparison
  • Roadmap
  • Contributing
  • License & Contact

What is Mocktail‑CLI?

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.

Key features

  • 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.

Why use Mocktail‑CLI?

  • 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.

Quickstart

Install

# global install
npm i -g mocktail-cli

# or run on demand
npx mocktail-cli generate --help

Generate mock data from a Prisma schema

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 (depth > 1 enables relations).
  • --relations — enable automatic relation generation (works with any depth).
  • --out — output to a file or stdout.
  • --preset blog — generate domain-specific data.

CLI reference (examples)

Basic usage

# Generate 20 Users (flat records)
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

Understanding --depth and --relations flags

The --depth and --relations flags work independently to control relation generation:

# Flat records (no relations)
mocktail-cli generate --count 5
# or
mocktail-cli generate --depth 1 --count 5

# Nested relations with depth 2
mocktail-cli generate --depth 2 --count 5

# Enable relations with default depth (2)
mocktail-cli generate --relations --count 5

# Both flags work together
mocktail-cli generate --relations --depth 3 --count 5

# Disable relations even with depth > 1
mocktail-cli generate --depth 2 --no-nest --count 5

Key points:

  • --depth 1 = Flat records (no nesting)
  • --depth 2+ = Enables relations with specified nesting level
  • --relations = Enables relations with default depth of 2
  • --no-nest = Disables relations regardless of other flags

Full option list

OptionAliasDescription
-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 - depth > 1 enables relations (default: 1)
--no-nestDisable nested relations (flat structure)
--relationsEnable automatic relation generation (works with any depth)
--dedupeEnable deduplication of records
--prettyPretty-print JSON output (default: true)
--no-prettyDisable pretty-printing JSON output
--no-logSuppress console logs during mock generation
--seedInsert generated data into DB
--seed-value <number>Seed value for reproducible data generation
--preset <type>Relation preset: blog, ecommerce, social
--force-logoForce show the logo animation even if shown before
-h, --helpDisplay help with usage and examples
---

## Configuration

Define a `mocktail-cli.config.js` or `mocktail-cli.config.json` to customize generation.

```js
module.exports = {
  defaults: { locale: 'en', seedConsistency: true },
  models: {
    User: { count: 20, faker: { name: 'fullName', email: 'email' } },
    Post: { count: 50, relations: { author: { connectBy: 'User' } } }
  }
}

Example workflows

Frontend prototyping

  • Generate realistic data with relations: mocktail-cli generate --relations --count 50
  • Feed the output to your mock API server.

Testing with consistent seeds

  • Generate with seed: mocktail-cli generate --relations --seed --seed-value 42
  • Run tests with consistent fixtures.

Deep nested data for complex UIs

  • Generate deeply nested data: mocktail-cli generate --depth 3 --count 20
  • Perfect for testing complex component hierarchies.

Domain-specific seeding

mocktail-cli generate --preset social --relations --count 100 --seed

Competitor Comparison

How Mocktail-CLI compares with other schema-aware mock data tools:

Feature / ToolMocktail-CLIPrisma-SeedPrisma-Generator-FakeMockoon / MirageJSfaker-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⚠️ Limited⚠️ Limited❌ Manual❌ No
Deterministic seeds--seed-value⚠️ Partial⚠️ Partial❌ No✅*
Output formats✅ JSON / SQL / CSV / TS❌ Mostly JSON❌ Mostly JSON✅ JSON / API⚠️ Code-driven only
CLI-first workflow✅ Yes⚠️ Partial⚠️ Plugin-only✅ Yes (server)❌ No
Relation presets (blog / ecommerce / social)✅ Built-in❌ No❌ No❌ No❌ No
DB seeding✅ Yes❌ No❌ No❌ No❌ No
Extensible configmocktail-cli.config.js⚠️ Partial⚠️ Partial⚠️ Partial⚠️ Manual only

* 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

Roadmap

  • 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: Schema-aware meaning all schema(for now we have done Prisma)
  • v1.3+: Integration with Mockilo for API mocking, seeding, and team workflows.

Contributing

We welcome PRs, bug reports, and feature ideas.

  • Fork the repo
  • Create a feature branch
  • Submit PR with tests and docs

License & Contact

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.

Keywords

mock

FAQs

Package last updated on 01 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts