explaingit

nuysoft/mock

Analysis updated 2026-06-21

19,622JavaScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A JavaScript library that generates realistic fake data and intercepts browser API calls with fake responses, so frontend developers can build and test without a live backend.

Mindmap

mindmap
  root((repo))
    What it does
      Generates fake data
      Intercepts Ajax calls
      Simulates API responses
    Inputs
      Data templates
      URL patterns
    Outputs
      Fake JSON responses
      Random realistic values
    Tech
      JavaScript
      npm
      jQuery
    Use cases
      Frontend without backend
      Automated testing
      Predictable test data
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Mock a REST API response so you can build and test a frontend UI before the backend is ready.

USE CASE 2

Generate large sets of realistic test data, names, dates, numbers, for automated frontend tests.

USE CASE 3

Intercept Ajax requests in a browser app and return controlled fake data for predictable unit tests.

What is it built with?

JavaScriptnpmjQuery

How does it compare?

nuysoft/mock11ty/eleventyxifangczy/cat-catch
Stars19,62219,63019,604
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity2/52/51/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Mock.js is a JavaScript library for generating realistic fake data to use during development and testing. The problem it solves is common in web development: the backend API is not yet ready, but the frontend developer still needs to build and test their interface. Rather than waiting or manually typing in test values, Mock.js lets you define a template describing what shape your data should have, and then automatically produces random but believable values, names, dates, numbers, addresses, and so on, that match that shape. It also intercepts Ajax requests (the way browser-based apps fetch data from a server) and responds with fake data, so the frontend code can run as if the real API were live. This is particularly useful when writing automated tests, where you want predictable inputs and don't want to depend on a live server. The library supports templates written in JavaScript or HTML and works alongside jQuery and KISSY (an older Chinese web framework). Mock.js is installable via npm and available under the MIT license.

Copy-paste prompts

Prompt 1
Using Mock.js, create a template that generates an array of 20 fake user profiles with name, email, avatar URL, and registration date.
Prompt 2
How do I use Mock.js to intercept a GET request to /api/users and return fake paginated data in my browser app?
Prompt 3
Write a Mock.js setup that simulates a product listing API with random prices, categories, and in-stock status for testing an e-commerce frontend.

Frequently asked questions

What is mock?

A JavaScript library that generates realistic fake data and intercepts browser API calls with fake responses, so frontend developers can build and test without a live backend.

What language is mock written in?

Mainly JavaScript. The stack also includes JavaScript, npm, jQuery.

What license does mock use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is mock to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is mock for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub nuysoft on gitmyhub

Verify against the repo before relying on details.