Mockmate — TypeScript-first mock data generator

Published: (January 6, 2026 at 01:35 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Introduction

Mockmate is a lightweight, TypeScript‑first library for generating mock data with a clean and flexible API. It’s designed for developers who want fast mock generation, strong typing, and zero boilerplate — whether you’re prototyping, testing, or building demos.

When working on frontend or backend applications, you often need mock data that is:

  • Predictable
  • Typed
  • Easy to extend
  • Quick to generate

Mockmate focuses on exactly that.

Installation

npm install @mockmate/mockmate
# or
yarn add @mockmate/mockmate
# or
pnpm add @mockmate/mockmate

Basic Usage

import { mockmate } from '@mockmate/mockmate';

const users = await mockmate({
  category: 'users',
  quantity: 2,
});

console.log(users);

Selecting Specific Fields

const users = await mockmate({
  category: 'users',
  quantity: 3,
  pick: ['id', 'name', 'email'],
});

Extending with Custom Fields

const users = await mockmate({
  category: 'users',
  quantity: 2,
  extend: {
    isActive: () => true,
    createdAt: () => new Date().toISOString(),
  },
});

Error Handling

Mockmate uses custom error classes for predictable error handling:

try {
  await mockmate({ category: 'unknown' });
} catch (error) {
  console.error(error);
}

TypeScript Support

Mockmate is built with TypeScript from the ground up, providing full type safety out of the box.

Planned Features

  • Additional categories and data generators
  • Advanced customization options
  • Integration helpers for popular testing frameworks

License

Mockmate is open‑source and MIT licensed.

  • GitHub:
  • npm:

Final Thoughts

If you’re tired of overcomplicated mock generators and want something simple, typed, and modern — give Mockmate a try.

Happy coding 👋

Back to Blog

Related posts

Read more »

Building a CLI Adapter for Hono

Overview hono-cli-adapter lets you call Hono apps directly from the CLI. Your business logic stays in Hono, so you can debug with Postman or Insomnia, ship the...