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¶
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:
Test it:
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¶
- Installation - Download and install mockd
- Quickstart - Run your first mock server
- Core Concepts - Understand how mockd works
- Request Matching - Configure matching rules
- Stateful Mocking - Simulate CRUD APIs