finds.dev

nuysoft/Mock

A simulation data generator

View on GitHubHomepage ↗

★ 19,561JavaScriptNOASSERTIONupdated Mar 2024

// the take

Mock.js is a front-end data-mocking library: you write a JSON-like template with special key syntax ('name|min-max': value) and it generates realistic fake data, plus it can intercept XHR calls so you can fake an entire API before the backend exists. It's aimed at front-end devs who want to build and test UI without waiting on a real backend.

The template syntax is genuinely clever — rules like 'list|1-10' or '@EMAIL' let you describe shape and randomization in the data structure itself instead of writing generator code. It ships a wide library of fake generators out of the box (names, addresses, colors, images, dates, lorem text) so you rarely need a second library. Zero runtime dependencies and small footprint. Hooking into XMLHttpRequest means existing ajax code works against mock data with no code changes, just load the script.

Interception is XHR-only — there's no built-in support for fetch(), so any modern codebase using fetch needs a separate shim or a different tool entirely. The project has had essentially no real development since 2016-2017 despite the 2024 'last push' (that's likely a trivial commit, not active maintenance), so don't expect bug fixes or help with edge cases. It's a pure front-end/browser tool; using it for server-side or Node test mocking is awkward and not what it was built for. No first-party TypeScript types (community @types/mockjs exists but lags behind), which is a real friction point for any TS codebase today.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
19,561
Forks
2,629
Language
JavaScript
License
NOASSERTION
Last commit
15 Mar 2024

// nearby

If Mock isn't quite it.

All repos →