A blazing-fast, dynamic HTTP Mock Server built with Rust and Axum, featuring zero-downtime hot-reloading and a beautiful built-in dashboard.
WireMocker is an API Mock Server designed for Frontend Developers, Mobile Developers, QA Engineers, and Backend Developers. It allows you to dynamically create HTTP endpoints using a simple YAML configuration file without writing a single line of code.
- Blazing Fast: Built on top of Rust, Tokio, and Axum for maximum performance and low latency.
- Hot Reloading: Automatically detects changes in your
mock.yamlconfiguration and updates endpoints instantly with zero downtime. - Built-in Dashboard: Comes with a beautiful, monochrome-styled UI to monitor your endpoints, view live request logs, and edit your configuration in real-time.
- Dynamic Data: Generate fake data on the fly using Handlebars-like syntax (e.g.,
{{name}},{{uuid}},{{email}}). - Delay Simulation: Easily mock slow network conditions by injecting artificial latency.
- Error Simulation: Randomly drop requests to simulate flaky networks using the
error_rateproperty. - Sequential Responses: Define a sequence of different responses for the same endpoint that will loop sequentially upon multiple requests.
graph TD
subgraph Client
UI[WireMocker Dashboard UI]
API[API Consumer / Frontend]
end
subgraph WireMocker Server
Axum[Axum Router]
DashboardHandler[Dashboard & Log Handlers]
MockHandler[Dynamic Mock Handlers]
State[Shared Application State]
subgraph Hot Reload System
Notify[File Watcher]
ConfigLoader[YAML/JSON Parser]
end
end
API -->|HTTP Requests| Axum
UI -->|API & WebSocket| Axum
Axum --> DashboardHandler
Axum --> MockHandler
DashboardHandler <--> State
MockHandler <--> State
Notify -->|File Changed Event| ConfigLoader
ConfigLoader -->|Updates Endpoints| State
Ensure you have Rust and Cargo installed, then clone the repository:
git clone https://github.com/fa33az/wiremocker.git
cd wiremocker
cargo build --releaseRun the compiled binary and specify the path to your mock configuration file:
./target/release/wiremocker serve configs/mock.yamlIf you are running in a development environment, you can simply use:
cargo run -- serve configs/mock.yamlThe server will start by default on http://localhost:8080.
Open your browser and navigate to the built-in UI:
👉 http://localhost:8080/__wiremocker/ui
WireMocker endpoints are defined entirely via a configuration file (YAML or JSON).
Here is an example of mock.yaml:
server:
port: 8080
routes:
# Basic GET Request
- path: /users
method: GET
response:
status: 200
body:
message: "Hello from WireMocker!"
headers:
Content-Type: application/json
# Path Parameters
- path: /users/{id}
method: GET
response:
status: 200
body:
id: "{id}"
name: "User {id}"
# Dynamic Fake Data & Delay
- path: /faker
method: GET
response:
status: 200
delay: 500
body:
uuid: "{{uuid}}"
username: "{{name}}"
email: "{{email}}"
company: "{{company}}"
# Simulate Flaky Network (20% failure rate)
- path: /flaky
method: GET
response:
status: 200
error_rate: 0.2
body:
status: "success"
# Sequential Responses (Loops through the array)
- path: /sequence
method: GET
response:
strategy: sequential
options:
- status: 200
body: { step: 1 }
- status: 201
body: { step: 2 }
- status: 400
body: { error: "Failed on step 3" }When you save changes to mock.yaml, WireMocker will automatically detect the file change and update the endpoints instantly without requiring a server restart.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Built with by fa33az
