Project detail · Developer Tools

Mimic

A fast, lightweight HTTP mock server that turns simple JSON files into realistic API behavior.

Status
Completed
Started
Nov 2025
Role
Creator and maintainer — Rust server, matching engine, Docker distribution, tests, and documentation.
Stack
Rust · Axum · Docker · HTTP

Develop and test against predictable APIs without waiting for a real backend or maintaining a heavyweight mock stack.

What it is

Mimic is a Rust and Axum HTTP mock server for local development, automated tests, and API prototyping. Mount a folder of JSON definitions and it serves them immediately, then hot-reloads changes without a restart. Beyond method-and-path matching, it can inspect path parameters, query strings, headers, and request bodies.

Why I built it

Frontend and integration work often depends on APIs that are unfinished, unstable, slow, or difficult to reproduce in CI. Heavy mocking suites add their own setup and maintenance burden.

How it addresses the problem

Mimic keeps the setup file-based and Docker-first. Each endpoint is a readable JSON definition, while the matching engine supports realistic request conditions, templated data, custom headers, delays, and response sequences.

What the project actually does

01

JSON-based mocks

One readable file can define an endpoint’s method, path, status, body, headers, and request-consumption behavior.

02

Advanced matching

Matches path parameters, query parameters, headers, and JSON, text, or form bodies—not only an exact URL.

03

Dynamic responses

Templates can echo path, query, header, and body values; delays and sequences simulate more realistic API states.

04

Hot reload

Changes to mock definitions are picked up immediately, keeping the edit–test loop short.

05

Small runtime

The documented idle footprint is about 1.66 MiB with sub-second startup, making it practical for laptops and CI runners.

06

Docker-first delivery

Prebuilt amd64 and arm64 images turn setup into mounting a mocks directory and exposing a port.

How the pieces connect

  1. 01 HTTP request
  2. 02 Exact / pattern router
  3. 03 Request matchers
  4. 04 JSON mock store
  5. 05 Template renderer
  6. 06 Mocked response

From zero to a useful result

  1. 01

    Create a mock

    Add a JSON file to a local mocks directory with the request method, path, status, and response body.

    { "method": "GET", "path": "/users", "status": 200, "response": [] }
  2. 02

    Start Mimic

    Mount that directory into the prebuilt container and expose port 8080.

    docker run --rm -p 8080:8080 -v ./mocks:/app/mocks:ro ragilhadi/mimic
  3. 03

    Call the endpoint

    Use the mock from your app or test suite. Edit the JSON whenever you need a new response—Mimic reloads it.

    curl http://localhost:8080/users

Start from the terminal

docker run --rm -p 8080:8080 -v ./mocks:/app/mocks:ro ragilhadi/mimic:latest