MockForge

Crates.io Documentation CI License

MockForge is a comprehensive mocking framework for APIs, gRPC services, and WebSockets. It provides a unified interface for creating, managing, and deploying mock servers across different protocols.

Features

  • Multi-Protocol Support: HTTP REST APIs, gRPC services, and WebSocket connections
  • Dynamic Response Generation: Create realistic mock responses with configurable latency and failure rates
  • Scenario Management: Define complex interaction scenarios with state management
  • CLI Tool: Easy-to-use command-line interface for local development
  • Admin UI: Web-based interface for managing mock servers
  • Extensible Architecture: Plugin system for custom response generators

Quick Start

Installation

cargo install mockforge-cli

Basic Usage

# Start a mock server with an OpenAPI spec
cargo run -p mockforge-cli -- serve --spec examples/openapi-demo.json --http-port 3000

# Add WebSocket support with replay file
MOCKFORGE_WS_REPLAY_FILE=examples/ws-demo.jsonl cargo run -p mockforge-cli -- serve --ws-port 3001

# Full configuration with Admin UI
MOCKFORGE_WS_REPLAY_FILE=examples/ws-demo.jsonl \
MOCKFORGE_RESPONSE_TEMPLATE_EXPAND=true \
cargo run -p mockforge-cli -- serve --spec examples/openapi-demo.json --admin --admin-port 8080

# Use configuration file
cargo run -p mockforge-cli -- serve --config demo-config.yaml

Docker

docker run -p 3000:3000 -p 3001:3001 -p 50051:50051 SaaSy-Solutions/mockforge

Documentation Structure

Examples

Check out the examples/ directory for sample configurations and use cases.

Community

License

Licensed under either of:

at your option.