Mimic is a fast, lightweight HTTP mock server. Perfect for testing, development, and API prototyping
3.9K
Mimic is a fast, lightweight HTTP mock server built with Rust and Axum. Perfect for testing, development, and API prototyping. Define your mock responses in simple JSON files and let Mimic handle the rest.
Mimic is incredibly efficient and lightweight:
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
b056ebec5099 mimic 0.02% 1.66MiB / 6.238GiB 0.03% 17.1kB / 34.6kB 0B / 0B 17
Key Metrics:
Perfect for resource-constrained environments, CI/CD pipelines, and local development.
Pull the latest image from Docker Hub:
docker pull ragilhadi/mimic:latest
Run with your mock files:
docker run -d \
--name mimic \
-p 8080:8080 \
-v $(pwd)/mocks:/app/mocks:ro \
ragilhadi/mimic:latest
Test it:
curl http://localhost:8080/health
docker-compose.yml:services:
mimic:
image: ragilhadi/mimic:latest
container_name: mimic
ports:
- "8080:8080"
volumes:
- ./mocks:/app/mocks:ro
environment:
- PORT=8080
- RUST_LOG=info
restart: unless-stopped
docker compose up -d
Create a .env file to customize your setup:
# Port configuration (default: 8080)
PORT=8080
# Logging level: trace, debug, info, warn, error (default: info)
RUST_LOG=info
Log Levels:
trace - Very detailed debuggingdebug - Detailed debugginginfo - General information (recommended)warn - Warnings onlyerror - Errors onlyMimic reads mock definitions from JSON files in the /app/mocks directory (or ./mocks locally).
Mock File Structure:
{
"method": "GET",
"path": "/users",
"status": 200,
"response": {
"users": [
{
"id": 1,
"name": "Alice Johnson",
"email": "[email protected]"
}
]
}
}
Fields:
method - HTTP method (GET, POST, PUT, DELETE, PATCH, etc.)path - URL path (e.g., /users, /api/v1/products)status - HTTP status code (200, 201, 404, 500, etc.)response - JSON response body (can be object, array, or null)File: mocks/get_users.json
{
"method": "GET",
"path": "/users",
"status": 200,
"response": {
"users": [
{
"id": 1,
"name": "Alice Johnson",
"email": "[email protected]",
"role": "admin"
},
{
"id": 2,
"name": "Bob Smith",
"email": "[email protected]",
"role": "user"
}
],
"total": 2
}
}
Usage:
curl http://localhost:8080/users
File: mocks/post_login.json
{
"method": "POST",
"path": "/login",
"status": 200,
"response": {
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"username": "admin",
"email": "[email protected]"
},
"expiresIn": 3600
}
}
Usage:
curl -X POST http://localhost:8080/login
File: mocks/get_error.json
{
"method": "GET",
"path": "/error",
"status": 500,
"response": {
"error": "Internal Server Error",
"message": "Something went wrong",
"code": "ERR_500"
}
}
Usage:
curl http://localhost:8080/error
File: mocks/delete_user.json
{
"method": "DELETE",
"path": "/users/123",
"status": 204,
"response": null
}
Usage:
curl -X DELETE http://localhost:8080/users/123
Content type
Image
Digest
sha256:db1252039…
Size
34 MB
Last updated
27 days ago
docker pull ragilhadi/mimic