RustMock
Lightning-fast API mock server built in Rust with beautiful React dashboard
~35MB Docker image | Blazing fast | Full OpenAPI support | Smart proxy mode
Quick Start
Docker:
CLI (Cargo):
Open http://localhost:8090 - done!
Features
- Blazing Fast - Built on Rust + Actix Web, ~35MB Docker image
- CLI & Docker -
mokkucommand or Docker one-liner - OpenAPI Support - Import/export specs, auto-generate endpoints
- React Dashboard - Beautiful UI for managing mocks and viewing logs
- Smart Proxy - Mix mocked endpoints with real API calls
- Request Logging - Monitor and inspect all incoming requests
CLI Reference
Installation
Commands
| Command | Description |
|---|---|
mokku |
Interactive mode - guided setup |
mokku server |
Start server directly |
mokku import <file> |
Import OpenAPI spec |
mokku mock <method> <path> [status] [body] |
Quick mock creation |
Examples
# Start with custom port
# Start with proxy to production API
# Import OpenAPI and start server
# Quick mock endpoint
Global Flags
| Flag | Description |
|---|---|
-p, --port <PORT> |
Server port (default: 8090) |
--host <HOST> |
Bind address (default: 0.0.0.0) |
--proxy <URL> |
Default proxy URL |
-o, --open |
Auto-open browser |
Docker
Basic Usage
With OpenAPI Import
Docker Compose
version: '3'
services:
rustmock:
image: ghcr.io/arthurkowalsky/rust-mock:latest
ports:
- "8090:8090"
volumes:
- ./openapi.json:/app/openapi.json
environment:
- OPENAPI_FILE=/app/openapi.json
- DEFAULT_PROXY_URL=https://api.production.com # optional
API Reference
| Endpoint | Method | Description |
|---|---|---|
/__mock/endpoints |
POST | Add endpoint |
/__mock/endpoints |
PUT | Update endpoint |
/__mock/endpoints |
DELETE | Remove endpoint |
/__mock/config |
GET | Get all endpoints |
/__mock/logs |
GET | Get request logs |
/__mock/logs |
DELETE | Clear logs |
/__mock/import |
POST | Import OpenAPI spec |
/__mock/export |
GET | Export as OpenAPI |
/__mock/proxy |
GET/POST/DELETE | Manage proxy |
Add Endpoint
Import OpenAPI
Proxy Mode
Route unmocked requests to a real API:
# Via CLI
# Via Docker
# Via API
Mock specific endpoints while proxying the rest to production.
Configuration
CLI Arguments
| Argument | Default | Description |
|---|---|---|
--host |
0.0.0.0 |
Server host |
--port |
8090 |
Server port |
--default-proxy-url |
- | Proxy URL for unmocked requests |
Environment Variables
| Variable | Description |
|---|---|
OPENAPI_FILE |
Path to OpenAPI spec for auto-import |
DEFAULT_PROXY_URL |
Default proxy URL |
CLI arguments take precedence over environment variables.
Architecture
RustMock consists of:
- Backend: Rust + Actix Web for exceptional performance
- Frontend: React dashboard for intuitive management
- Features: Dynamic endpoints, OpenAPI validation, comprehensive logging
Why RustMock?
- Performance - Built on Rust's blazing-fast foundation
- Lightweight - ~35MB Docker image, minimal memory footprint
- Developer UX - Beautiful dashboard, intuitive CLI
- Zero config - Works out of the box
Contributing
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing) - Open Pull Request
License
MIT License - see LICENSE