Skip to content

mockd

Fast, lightweight API mocking for development and testing

Create realistic mock APIs in seconds. No external dependencies. Works offline.


Why mockd?

Zero Dependencies

Single binary written in Go. No runtime dependencies, no configuration servers, no Docker required for basic usage.

Instant Setup

Define mocks in JSON and start serving immediately. Your first mock API runs in under 5 minutes.

Stateful Mocking

Simulate real CRUD APIs with persistent state. Create, update, delete resources and see changes reflected across requests.

Proxy Recording

Record real API traffic through the MITM proxy and replay responses as mocks. Perfect for capturing production behavior.

Flexible Matching

Match requests by path, method, headers, query params, and body content. Use exact matches or regex patterns.

Developer First

Works offline, runs locally, integrates with any HTTP client. Use for development, testing, or CI/CD pipelines.


Quick Install

curl -sSL https://github.com/getmockd/mockd/releases/latest/download/mockd-$(uname -s)-$(uname -m) -o mockd
chmod +x mockd
./mockd --version
go install github.com/getmockd/mockd/cmd/mockd@latest
docker run -p 4280:4280 -v $(pwd)/mocks:/mocks ghcr.io/getmockd/mockd

Your First Mock

Create a file called mocks.json:

{
  "mocks": [
    {
      "request": {
        "method": "GET",
        "path": "/api/users"
      },
      "response": {
        "status": 200,
        "headers": {
          "Content-Type": "application/json"
        },
        "body": {
          "users": [
            {"id": 1, "name": "Alice"},
            {"id": 2, "name": "Bob"}
          ]
        }
      }
    }
  ]
}

Start the server:

mockd start --config mocks.json

Test it:

curl http://localhost:4280/api/users

Use Cases

Development

Mock external APIs during frontend development. No need to wait for backend teams or deal with rate limits.

Testing

Create predictable test fixtures for integration and end-to-end tests. Control every response.

CI/CD

Run fast, isolated tests in CI pipelines without external dependencies.

Prototyping

Quickly prototype API designs before implementing the real backend.


Learn More