Mock Data & Test Code Generator

A tool that generates dummy data (a JSON array), a MockRepository class that works without a database connection, and Vitest/Jest test code, all from a pasted TypeScript interface or Prisma model — right in your browser.

Your input is processed entirely in your browser and is never sent to an external server.
Generation options
Number of records
Test framework

How to use

  1. Paste a TypeScript `interface` or a Prisma `model` definition into the input field. You can also try it out with "Load sample".
  2. Whether it's a Prisma model or a TypeScript interface is detected automatically. If multiple types are found, choose one from "Target type".
  3. Use "Generation options" to choose the number of records to generate (1–20) and the test framework (Vitest or Jest).
  4. Switch between the "① Dummy data", "② MockRepository class", and "③ Test code" tabs to review and copy each piece of code.

About this tool

The Mock Data & Test Code Generator produces dummy data, a mock implementation, and test code — all useful for development and testing — from a TypeScript type definition or a Prisma model definition. It's handy when you want to build out the frontend before the backend API is ready, or quickly write database-independent unit tests.

Dummy values are inferred from field names and types — for example, a string field whose name contains "email" gets a value like `user1@example.com`, and a `Date` field gets an ISO-formatted string with the date advancing by one day per record. When a Prisma model is used as input, fields that reference other models (relations) are automatically excluded.

The generated `MockRepository` class implements `findUnique`, `findMany`, `create`, `update`, and `delete` as async methods that operate on an in-memory array, and the generated test code is structured around calling an Express controller factory function that takes the repository as an argument (a dependency injection pattern).

Frequently asked questions

Does it support both TypeScript and Prisma input?

Yes. If the input contains "interface Name { ... }", it's treated as a TypeScript interface; if it contains "model Name { ... }", it's treated as a Prisma model — the detection is automatic.

Can I fine-tune the generated dummy values?

This tool only auto-generates plausible values based on field names and types — there's no UI for editing individual values. Copy the generated JSON or code and adjust it in your own editor afterward.

Can I run the generated test code as-is?

The test code assumes the existence of an Express router factory function that takes a repository as an argument (`create<Name>Router(repository)`). Adjust the import paths and function names to match your project's actual controller implementation before running it.

Is my input code sent to a server?

No. Parsing the type, generating dummy data, and assembling the code all happen entirely with JavaScript in your browser.