MockForge
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 with advanced data generation capabilities.
π Why MockForge?
Feature | MockForge | WireMock | MockServer | Mockoon |
---|---|---|---|---|
Language | Rust | Java | Java/JavaScript | JavaScript |
Performance | β‘ High (native Rust) | Medium | Medium | Medium |
HTTP/REST | β Full | β Full | β Full | β Full |
gRPC Native | β Full + HTTP Bridge | β No | β No | β οΈ Limited |
WebSocket | β Scripted Replay + JSONPath | β No | β οΈ Basic | β No |
GraphQL | β Yes | β οΈ Via HTTP | β οΈ Via HTTP | β Yes |
Admin UI | β Modern React UI | β οΈ Basic | β Yes | β Desktop App |
Data Generation | β Advanced (Faker + RAG) | β οΈ Basic | β οΈ Basic | β οΈ Templates |
AI-Driven Mocking | β LLM-powered generation | β No | β No | β No |
Data Drift | β Evolving mock data | β No | β No | β No |
AI Event Streams | β Narrative-driven WebSocket | β No | β No | β No |
Plugin System | β WASM-based | β οΈ Java extensions | β οΈ JavaScript | β No |
E2E Encryption | β Built-in (AES-256/ChaCha20) | β No | β οΈ TLS only | β οΈ TLS only |
Workspace Sync | β Git integration + file watching | β No | β No | β οΈ Cloud sync (Pro) |
Cross-Endpoint Validation | β Referential integrity checks | β No | β No | β No |
OpenAPI Support | β Full + Auto-generation | β Yes | β Yes | β Yes |
Template Expansion | β Advanced (faker, time, UUIDs) | β οΈ Basic | β οΈ Basic | β Handlebars |
Deployment | Binary, Docker, Cargo | JAR, Docker, Maven | JAR/NPM, Docker | Desktop, NPM, Docker |
Stateful Mocking | β Yes | β Yes | β Yes | β Yes |
Request Matching | β JSONPath, Regex, Schema | β Yes | β Yes | β Yes |
Latency Simulation | β Configurable profiles | β Yes | β Yes | β Yes |
Fault Injection | β Yes | β Yes | β Yes | β Yes |
CLI Tool | β Full-featured | β Yes | β Yes | β Yes |
License | MIT/Apache-2.0 | Apache-2.0 | Apache-2.0 | MIT |
v1.0 Feature Status
All major features listed in this README are implemented and functional in v1.0, with the following clarification:
- β Fully Implemented: HTTP/REST, gRPC (with HTTP Bridge), WebSocket, GraphQL, AI-powered mocking (with data drift & event streams), Plugin system (WASM + remote loading), E2E encryption, Workspace sync, Data generation (RAG-powered), Admin UI (with SSE live logs, metrics, drag-and-drop fixtures)
- β οΈ Planned for v1.1: Admin UI role-based authentication (frontend UI components are built, backend JWT/OAuth integration pending)
All commands, options, and features documented in each protocol section (HTTP, gRPC, WebSocket, GraphQL, Plugins, Data Generation) have been verified to work as described.
Key Differentiators
- π True Multi-Protocol: Only MockForge provides first-class support for HTTP, gRPC, WebSocket, and GraphQL in a single binary
- π§ AI-Driven Mocking: Industry-first LLM-powered mock generation from natural language prompts
- π Data Drift Simulation: Unique realistic data evolution across requests (order status progression, stock depletion, price changes)
- π AI Event Streams: Generate narrative-driven WebSocket events for real-time testing scenarios
- 𧬠Advanced Data Generation: RAG-powered synthetic data with relationship awareness and smart field inference
- π Modern Plugin System: Extend functionality with sandboxed WASM plugins for custom generators, auth, and data sources
- π Enterprise Security: Built-in end-to-end encryption for sensitive configuration data
- π gRPC HTTP Bridge: Automatically expose gRPC services as REST APIs with OpenAPI docs
- π Production-Ready: Comprehensive testing (unit, integration, mutation), security audits, and automated releases
β¨ Features
- Multi-Protocol Support: HTTP REST APIs, gRPC services, GraphQL APIs, WebSocket connections, and SMTP email testing
- π§ AI-Powered Mocking (Industry First): Revolutionary artificial intelligence features:
- Intelligent Mock Generation: Generate realistic responses from natural language prompts
- Natural language β realistic JSON data
- Schema-aware generation with validation
- Multi-provider support: OpenAI, Anthropic, Ollama (free local), or OpenAI-compatible APIs
- Built-in caching for performance optimization
- Data Drift Simulation: Evolving mock data across requests
- Order statuses progress naturally (pending β processing β shipped β delivered)
- Stock quantities deplete with purchases
- Prices fluctuate realistically over time
- State machine transitions with custom probabilities
- AI Event Streams: LLM-powered WebSocket event generation
- Generate realistic event streams from narrative descriptions
- Progressive scenario evolution for contextual continuity
- Time-based, count-based, or conditional event strategies
- Perfect for testing real-time features
- Free Local Development: Use Ollama for $0 cost during development
- Cost-Effective Production: ~$0.01 per 1,000 requests with OpenAI GPT-3.5
- Intelligent Mock Generation: Generate realistic responses from natural language prompts
- Advanced Data Synthesis: Intelligent mock data generation with:
- Smart Field Inference: Automatic data type detection from field names
- Deterministic Seeding: Reproducible test fixtures for stable testing
- RAG-Driven Generation: Context-aware data using domain knowledge
- Relationship Awareness: Foreign key detection and cross-reference validation
- Schema Graph Extraction: Automatic relationship discovery from protobuf schemas
- Plugin System: WebAssembly-based extensible architecture with:
- Custom Response Generators: Build plugins for specialized mock data
- Authentication Providers: JWT, OAuth2, and custom auth plugins
- Data Source Connectors: CSV, database, and external API integrations
- Template Extensions: Custom template functions and filters
- Security Sandbox: Isolated plugin execution with resource limits
- π Remote Loading: Install plugins from URLs, Git repos, or local files with version pinning
mockforge plugin install https://github.com/user/plugin#v1.0.0
- Support for ZIP, tar.gz archives, and direct WASM files
- Checksum verification and automatic caching
- End-to-End Encryption: Enterprise-grade security features:
- Multi-Algorithm Support: AES-256-GCM and ChaCha20-Poly1305 encryption
- Key Management: Hierarchical key system with secure storage
- Auto-Encryption: Automatic encryption of sensitive configuration data
- Template Functions: Built-in encryption/decryption in templates
- Workspace Synchronization: Bidirectional sync with version control:
- File System Watching: Real-time sync between workspaces and directories
- Git Integration: Version control your mock configurations
- Team Collaboration: Shared workspaces with conflict resolution
- Dynamic Response Generation: Create realistic mock responses with configurable latency and failure rates
- Cross-Endpoint Validation: Ensure referential integrity across different endpoints
- Admin UI v2: Modern React-based interface with:
- Role-Based Authentication: (Planned for v1.1) Admin and viewer access control (frontend UI components ready, backend authentication to be implemented)
- Real-time Monitoring: Live logs via Server-Sent Events (SSE), metrics, and performance tracking
- Visual Configuration: Drag-and-drop fixture management with tree view
- Advanced Search: Full-text search across services and logs
- Configuration Management: Flexible configuration via YAML/JSON files with environment variable overrides
- Built-in Data Templates: Pre-configured schemas for common data types (users, products, orders)
- Production Ready: Comprehensive testing, security audits, and automated releases
π Documentation
For comprehensive documentation, tutorials, and guides:
The documentation covers:
- Your First Mock API in 5 Minutes - Fastest path to productivity
- Getting started guide and installation
- Detailed configuration options
- API reference for all protocols (HTTP, gRPC, WebSocket)
- Advanced features and examples
- Contributing guidelines
π Quick Start
New to MockForge? Follow our 5-Minute Tutorial to create your first mock API.
Need help? Check the FAQ or Troubleshooting Guide.
Installation
# Install from crates.io
# Or build from source
Try the Examples
MockForge comes with comprehensive examples to get you started quickly:
# Run with the included examples
# Or use the configuration file
# Or run manually with environment variables
MOCKFORGE_WS_REPLAY_FILE=examples/ws-demo.jsonl \
MOCKFORGE_RESPONSE_TEMPLATE_EXPAND=true \
See examples/README.md
for detailed documentation on the example files.
Docker (Alternative Installation)
MockForge can also be run using Docker for easy deployment:
Quick Docker Start
# Using Docker Compose (recommended)
# Or using Docker directly
&&
Manual Docker Commands
# Build the image
# Run with examples
See DOCKER.md for comprehensive Docker documentation and deployment options.
Basic Usage
# Build the project
# Start all mock servers with Admin UI (separate port)
# Start with custom configuration
# Generate test data
# Start Admin UI only (standalone server)
# Start workspace synchronization daemon
# Access Admin Interface
)
# Quick development setup with environment variables
MOCKFORGE_ADMIN_ENABLED=true MOCKFORGE_HTTP_PORT=3000
π§ AI Features Quick Start
MockForge supports AI-powered mock generation for intelligent, evolving data. Perfect for realistic testing!
Using Free Local AI (Ollama)
# Install Ollama (one-time setup)
|
# Start MockForge with AI enabled
Using OpenAI (Paid)
# Start with OpenAI
Test AI Features
# Test intelligent mock generation
# Test data drift simulation
# Test AI event stream generation
Configuration Example
responses:
- name: "AI Customer Response"
status_code: 200
intelligent:
mode: intelligent
prompt: "Generate realistic customer data for a retail SaaS API"
schema:
type: object
properties:
id:
name:
email:
drift:
enabled: true
request_based: true
rules:
- field: tier
strategy: state_machine
states:
π Learn More: See docs/AI_DRIVEN_MOCKING.md
for complete AI features documentation.
HTTP
curl http://localhost:3000/ping
SMTP Email Testing
MockForge includes a fully functional SMTP server for testing email workflows:
# Start SMTP server
# Send test email with Python
# Or use command-line tools
SMTP Features
- β RFC 5321 compliant (HELLO, EHLO, MAIL, RCPT, DATA, QUIT, RSET, NOOP, HELP)
- β Fixture-based email matching (regex patterns for recipients, senders, subjects)
- β In-memory mailbox with size limits
- β Auto-reply configuration with templates
- β Template expansion support (faker functions, UUIDs, timestamps)
- β Storage options (in-memory, file export)
- β Configurable behavior (delays, failure rates)
SMTP Configuration Example
smtp:
enabled: true
port: 1025
hostname: "mockforge-smtp"
fixtures_dir: "./fixtures/smtp"
enable_mailbox: true
max_mailbox_messages: 1000
See SMTP documentation for complete guide.
WebSocket (Scripted Replay)
MockForge supports scripted WebSocket interactions with template expansion and conditional responses.
Quick Start
# Set the replay file environment variable
# Start the WebSocket server
Connect and Test
Using Node.js:
const WebSocket = require;
const ws = ;
ws.;
ws.;
ws.;
Using websocat:
# Then type: CLIENT_READY
# The server will respond with scripted messages
Using wscat:
# Then type: CLIENT_READY
Browser Console:
const ws = ;
ws ws.;
ws console.log;
Advanced Message Matching with JSONPath
MockForge supports JSONPath queries for sophisticated WebSocket message matching:
JSONPath Examples:
$.type
- Wait for any message with atype
property$.user.id
- Wait for messages with user ID$.order.status
- Wait for order status updates$.items[0].name
- Wait for first item name
JSON Message Testing:
const ws = ;
// Send JSON messages that match JSONPath patterns
ws ;
ws console.log;
See examples/README-websocket-jsonpath.md
for complete documentation.
Replay File Format
WebSocket replay files use JSON Lines format with the following structure:
"}"}
}\\"}","waitFor":"^ACK$"}
}\\
ts
: Timestamp in milliseconds for message timingdir
: Direction ("in" for received, "out" for sent)text
: Message content (supports template expansion)waitFor
: Optional regex pattern to wait for before sending
Template Expansion
WebSocket messages support the same template expansion as HTTP responses:
{{uuid}}
β Random UUID{{now}}
β Current timestamp{{now+1h}}
β Future timestamp{{randInt 1 100}}
β Random integer
gRPC
grpcurl -plaintext -proto crates/mockforge-grpc/proto/gretter.proto -d '{"name":"Ray"}' localhost:50051 mockforge.greeter.Greeter/SayHello
π HTTP Bridge for gRPC Services
MockForge now includes an advanced HTTP Bridge that automatically converts gRPC services to REST APIs, eliminating the need for separate gRPC and HTTP implementations.
Features
- Automatic Discovery: Scans
.proto
files and creates REST endpoints for all gRPC services - JSON β Protobuf Conversion: Full bidirectional conversion between JSON and protobuf messages
- OpenAPI Documentation: Auto-generated OpenAPI/Swagger specs for all bridged services
- Streaming Support: Server-Sent Events (SSE) for server streaming and bidirectional communication
- Statistics & Monitoring: Built-in request metrics and health checks
Quick Start
# Start gRPC server with HTTP bridge
The bridge will automatically:
- Discover services from proto files
- Create REST endpoints at
/api/{service}/{method}
- Generate OpenAPI docs at
/api/docs
- Provide health monitoring at
/api/health
Example Usage
gRPC Service:
service UserService {
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
rpc GetUser(GetUserRequest) returns (GetUserResponse);
}
HTTP Bridge Endpoints:
# Create user (POST)
# Get user (POST - gRPC semantics)
Response:
Configuration
Enable the HTTP bridge by modifying your config:
grpc:
dynamic:
enabled: true
proto_dir: "proto" # Directory containing .proto files
enable_reflection: true # Enable gRPC reflection
http_bridge:
enabled: true # Enable HTTP bridge
base_path: "/api" # Base path for REST endpoints
enable_cors: true # Enable CORS
timeout_seconds: 30 # Request timeout
Or via environment variables:
Bridge Endpoints
GET /api/health
- Health checkGET /api/stats
- Request statistics and metricsGET /api/services
- List available gRPC servicesGET /api/docs
- OpenAPI 3.0 documentation/api/{service}/{method}
- Automatically generated REST endpoints
Streaming Support
For gRPC streaming methods, the bridge provides:
# Server streaming endpoint
Returns server-sent events:
data:
event: message
data:
event: message
OpenAPI Integration
The bridge auto-generates comprehensive OpenAPI documentation:
# Access interactive API docs
# Get OpenAPI JSON spec
Features:
- Automatic schema generation from protobuf definitions
- Example requests and responses
- Streaming method documentation
- Method tags and descriptions
Advanced Features
- Bidirectional Streaming: Full support for client β server streaming via WebSockets-in-disguise
- Metadata Preservation: Passes gRPC metadata as HTTP headers
- Error Handling: Comprehensive error responses with detailed messages
- Metrics: Request counting, latency tracking, and failure rates
- Security: Configurable CORS and request validation
Use Cases
- Frontend Development: Test gRPC APIs with familiar HTTP tools
- API Gateways: Expose gRPC services as REST APIs
- Mixed Environments: Support for both gRPC and HTTP clients
- Development Tools: Use Postman, curl, or any HTTP client
- Documentation: Auto-generated API docs for gRPC services
π― Data Generation
MockForge includes powerful synthetic data generation capabilities:
# Generate user data using built-in templates
# Generate product data
# Generate data from JSON schema
# Enable RAG mode for enhanced data generation
Built-in Templates
- User: Complete user profiles with emails, names, addresses
- Product: Product catalog with pricing, categories, descriptions
- Order: Customer orders with relationships to users and products
Advanced Features
- RAG Integration: Use LLM-powered generation for more realistic data
- Multiple Formats: JSON, JSON Lines, CSV output
- Custom Schemas: Generate data from your own JSON schemas
- Relationship Support: Maintain referential integrity between entities
echo -e '{"name":"one"}\n{"name":"two"}' | grpcurl -plaintext -proto crates/mockforge-grpc/proto/gretter.proto -d @ localhost:50051 mockforge.greeter.Greeter/SayHelloClientStream
echo -e '{"name":"first"}\n{"name":"second"}' | grpcurl -plaintext -proto crates/mockforge-grpc/proto/gretter.proto -d @ localhost:50051 mockforge.greeter.Greeter/Chat
ποΈ Admin Interface
Dashboard
MockForge ships a built-in Admin UI that can run as either:
- A standalone server (default when
--admin
is used):http://localhost:9080/
. - Embedded under the HTTP server at a mount path, e.g.
http://localhost:3000/admin/
whenadmin.mount_path: "/admin"
is configured.
The Admin UI provides:
- π Modern dashboard with real-time server status and live logs (via SSE)
- βοΈ Configuration management for latency, faults, and proxy settings
- π Request logging with filtering and real-time monitoring
- π Metrics visualization with performance insights
- π― Fixture management with drag-and-drop tree view for organizing fixtures
- π¨ Professional UI with tabbed interface and responsive design
Note: Role-based authentication (Admin/Viewer access control) is planned for v1.1. The frontend UI components are ready, but backend JWT/OAuth authentication is not yet implemented in v1.0. The Admin UI is currently accessible without authentication.
Embedded Admin Mode
You can embed the Admin UI under the HTTP server instead of running it on a separate port. This is handy when you want a single endpoint to expose mocks and admin controls.
- Configure via file (config.yaml):
admin:
enabled: true
mount_path: "/admin"
- Or via environment:
- Start servers:
- Access URLs:
- UI: http://localhost:3000/admin/
- Health: http://localhost:3000/admin/__mockforge/health
- Dashboard: http://localhost:3000/admin/__mockforge/dashboard
Notes:
- Static assets are served relative to the mount path (e.g.,
/admin/admin.css
). - Switching back to standalone mode: remove
mount_path
(or unset env) and run with--admin --admin-port 9080
.
Admin Mode Flags (CLI)
You can control how the Admin UI runs via flags on serve
:
# Force embedded mode (default mount at /admin)
# Embedded with explicit mount
# Force standalone mode on port 9080 (overrides embed)
# Disable Admin APIs (UI loads but __mockforge/* endpoints are absent)
# Equivalent env-based control
API Endpoints
Admin API endpoints are namespaced under __mockforge
:
- Standalone Admin (default):
GET /__mockforge/dashboard
GET /__mockforge/health
GET /__mockforge/logs
GET /__mockforge/metrics
GET /__mockforge/fixtures
POST /__mockforge/config/*
- Embedded under a mount path (e.g.,
/admin
):GET /admin/__mockforge/dashboard
GET /admin/__mockforge/health
- ... (same suffixes under the mount prefix)
βοΈ Configuration
MockForge supports flexible configuration through YAML or JSON files:
# Initialize a new configuration
# Validate your configuration
# Use a configuration file
π Complete Configuration Template - Fully documented template with all available options
Environment Variables
Override any configuration setting with environment variables:
# Server ports
# Enable features
# Logging
Configuration Options
- HTTP Server: Port, host, OpenAPI spec, CORS settings
- WebSocket Server: Port, host, replay files, timeouts
- gRPC Server: Port, host, proto files, TLS configuration
- Admin UI: Enable/disable, authentication, custom port
- Core Features: Latency profiles, failure injection, proxy settings
- Data Generation: Default settings, RAG configuration, custom templates
π οΈ Development
Prerequisites
- Rust 1.70 or later
- Make
- Python 3 (for some tooling)
Setup
# Clone the repository
# Set up development environment (installs all tools and hooks)
# Build the project
# Run all tests
# Run all quality checks
Development Workflow
# Start development mode with file watching
# Format code
# Run lints
# Run security audit
# Generate documentation
# Build user docs
Project Structure
mockforge/
βββ crates/ # Workspace crates
β βββ mockforge-cli/ # Command-line interface
β βββ mockforge-core/ # Shared logic (routing, validation, latency, proxy)
β βββ mockforge-http/ # HTTP mocking library
β βββ mockforge-ws/ # WebSocket mocking library
β βββ mockforge-grpc/ # gRPC mocking library
β βββ mockforge-data/ # Synthetic data generation (faker + RAG)
β βββ mockforge-ui/ # Admin UI (Axum routes + static assets)
βββ config.example.yaml # Configuration example
βββ docs/ # Project documentation
βββ book/ # mdBook documentation
βββ examples/ # Example configurations and test files
βββ tools/ # Development tools
βββ scripts/ # Setup and utility scripts
βββ .github/ # GitHub Actions and templates
βββ tools/ # Development utilities
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Release Process
This project uses automated releases with cargo-release:
# Patch release (bug fixes)
# Minor release (new features)
# Major release (breaking changes)
πΌ Case Studies
Case Study 1: Microservices Development at Scale
Challenge: A fintech company needed to develop and test 15+ microservices that communicate via gRPC, REST, and WebSocket protocols. Waiting for all services to be ready blocked parallel development.
Solution: MockForge provided:
- gRPC HTTP Bridge: Frontend teams tested gRPC services using familiar REST tools
- Multi-Protocol Support: Single mock server handled HTTP, gRPC, and WebSocket endpoints
- Workspace Sync: Shared mock configurations via Git across distributed teams
- Advanced Data Generation: RAG-powered realistic financial data with referential integrity
Results:
- 60% reduction in integration testing time
- 3 teams able to develop in parallel without blocking
- 100+ realistic test scenarios with deterministic data
Case Study 2: Third-Party API Integration Testing
Challenge: An e-commerce platform integrated with 8 external payment, shipping, and inventory APIs. Testing was expensive, slow, and unpredictable due to rate limits and sandbox limitations.
Solution: MockForge enabled:
- OpenAPI-Driven Mocks: Auto-generated mocks from vendor OpenAPI specs
- Latency & Fault Injection: Realistic simulation of network issues and API failures
- Stateful Mocking: Transaction flows with proper state management
- Template Expansion: Dynamic responses with timestamps, UUIDs, and context-aware data
Results:
- Zero cost for testing (no sandbox API calls)
- 95% test coverage for error scenarios
- CI/CD pipeline runtime reduced from 45min to 8min
Case Study 3: Mobile App Development
Challenge: A mobile team needed to test iOS and Android apps against a backend API that was constantly evolving. The backend team couldn't provide stable test environments.
Solution: MockForge provided:
- Fixture Management: Record real API responses and replay them
- Admin UI: Product managers created test scenarios without coding
- WebSocket Scripted Replay: Tested real-time chat and notifications
- Cross-Endpoint Validation: Ensured data consistency across related endpoints
Results:
- Mobile developers unblocked from backend dependencies
- QA team created 50+ test scenarios independently
- Bug detection 2 weeks earlier in development cycle
Case Study 4: Legacy System Migration
Challenge: A healthcare company was migrating from a monolithic SOAP API to microservices-based REST APIs. They needed to run both systems in parallel during the 18-month transition.
Solution: MockForge acted as:
- Protocol Adapter: Bridged SOAP requests to REST endpoints for testing
- Data Transformation: Template system converted between legacy and new data formats
- End-to-End Encryption: Secured sensitive patient data in mock configurations
- Gradual Migration: Mocked incomplete services while others went live
Results:
- Zero downtime during migration
- Comprehensive regression testing across old and new systems
- 30% faster migration timeline
Case Study 5: Performance Testing & Load Simulation
Challenge: A SaaS platform needed to performance test their client application under various backend conditions (slow responses, partial failures, high load).
Solution: MockForge delivered:
- Configurable Latency Profiles: Simulated various network conditions
- Failure Injection: Random failures, timeouts, and partial responses
- High Throughput: Rust-native performance handled 10K+ req/sec
- Metrics & Monitoring: Real-time performance dashboards
Results:
- Identified 12 critical performance bottlenecks
- Optimized client retry logic and caching
- Production performance improved by 40%
Common Use Cases
- π Continuous Integration: Fast, reliable mocks in CI/CD pipelines
- π± Mobile/Frontend Development: Work independently of backend teams
- π§ͺ Integration Testing: Test complex multi-service interactions
- π Training & Demos: Consistent demo environments without live systems
- π§ Third-Party API Testing: Test external integrations without costs or rate limits
- β‘ Performance Testing: Simulate various network and load conditions
- π Development Acceleration: Parallel development of dependent services
β‘ Performance Benchmarks
MockForge includes comprehensive performance benchmarks using Criterion.rs to measure and track performance across releases.
Benchmark Categories
Template Rendering
- Simple variable substitution:
{{name}}
- Complex nested templates:
{{user.address.city}}
- Array iteration:
{{#each items}}
JSON Schema Validation
- Simple schema validation (single object)
- Complex nested schema validation
- Large array validation (100+ items)
OpenAPI Spec Parsing
- Small specs (1-5 paths)
- Medium specs (10-50 paths)
- Large specs (100+ paths with complex schemas)
Data Generation
- Single record generation
- Bulk data generation (1000+ records)
- RAG-powered synthetic data
Memory Profiling
- Large OpenAPI spec parsing (100+ paths)
- Deep template rendering (nested structures)
- Bulk data validation
Running Benchmarks
# Run all benchmarks
# Run specific benchmark suite
# Run benchmarks with specific filter
# Generate detailed HTML reports
Benchmark Results
Typical performance metrics on modern hardware (AMD Ryzen 9 / Intel i9):
Operation | Throughput | Latency |
---|---|---|
Simple template rendering | ~500K ops/sec | ~2 Β΅s |
Complex template rendering | ~100K ops/sec | ~10 Β΅s |
JSON schema validation (simple) | ~1M ops/sec | ~1 Β΅s |
JSON schema validation (complex) | ~200K ops/sec | ~5 Β΅s |
OpenAPI spec parsing (small) | ~10K ops/sec | ~100 Β΅s |
OpenAPI spec parsing (large) | ~500 ops/sec | ~2 ms |
Data generation (single record) | ~50K ops/sec | ~20 Β΅s |
Note: Results vary based on hardware, spec complexity, and system load. Run benchmarks on your target hardware for accurate metrics.
Continuous Performance Monitoring
Benchmarks are run automatically in CI/CD:
- On every pull request to detect performance regressions
- Baseline comparisons against main branch
- Historical performance tracking across releases
View the latest benchmark results in our GitHub Actions.
π Documentation
- User Guide - Complete documentation
- API Reference - Rust API documentation
- Contributing - How to contribute
- Changelog - Release notes
- Benchmarks - Performance benchmarks
π¬ Getting Help & Support
Quick Links
- π FAQ (Frequently Asked Questions) - Quick answers to common questions
- π§ Troubleshooting Guide - Solutions for common issues
- π 5-Minute Tutorial - Fastest way to get started
- π Configuration Reference - Complete config template with all options
Common Issues
Issue | Quick Fix |
---|---|
Server won't start | lsof -i :3000 β mockforge serve --http-port 3001 |
Template variables not working | mockforge serve --response-template-expand |
Validation too strict | mockforge serve --validation warn |
Admin UI not loading | mockforge serve --admin --admin-port 9080 |
Docker port conflicts | docker run -p 3001:3000 mockforge |
Docker permission issues | sudo chown -R 1000:1000 fixtures/ (Linux) |
See the complete troubleshooting guide for detailed solutions.
Community & Support
- GitHub Issues - Report bugs or request features
- GitHub Discussions - Ask questions and share ideas
- Contributing Guide - Contribute to MockForge development
Need Help?
When reporting issues, please include:
- MockForge version (
mockforge --version
) - Operating system
- Configuration file (if applicable)
- Steps to reproduce
- Expected vs actual behavior
- Error logs (
RUST_LOG=debug mockforge serve
)
π License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.
Validation Modes
You can control request/response validation via CLI, environment, or config.
-
Environment:
-
MOCKFORGE_REQUEST_VALIDATION=off|warn|enforce
(default: enforce) -
MOCKFORGE_AGGREGATE_ERRORS=true|false
(default: true) -
MOCKFORGE_RESPONSE_VALIDATION=true|false
(default: false) -
MOCKFORGE_RESPONSE_TEMPLATE_EXPAND=true|false
(default: false)- When true, mock responses (including media-level
example
bodies) expand tokens:{{uuid}}
β random UUID v4{{now}}
β RFC3339 timestamp{{nowΒ±Nd|Nh|Nm|Ns}}
β timestamp offset by days/hours/minutes/seconds, e.g.,{{now+2h}}
,{{now-30m}}
{{rand.int}}
β random integer{{rand.float}}
β random float
- Also supports ranged and faker tokens when enabled:
{{randInt 10 99}}
,{{rand.int -5 5}}
{{faker.uuid}}
,{{faker.email}}
,{{faker.name}}
,{{faker.address}}
,{{faker.phone}}
,{{faker.company}}
,{{faker.url}}
,{{faker.ip}}
,{{faker.color}}
,{{faker.word}}
,{{faker.sentence}}
,{{faker.paragraph}}
- Determinism: set
MOCKFORGE_FAKE_TOKENS=false
to disable faker token expansion (uuid/now/rand tokens still expand).
- When true, mock responses (including media-level
-
MOCKFORGE_VALIDATION_STATUS=400|422
(default: 400)- Status code returned on request validation failure in enforce mode.
-
CLI (serve):
--validation off|warn|enforce
--aggregate-errors
--validate-responses
-
Config (config.yaml):
http:
request_validation: "enforce" # off|warn|enforce
aggregate_validation_errors: true
validate_responses: false
skip_admin_validation: true
validation_overrides:
"POST /users/{id}": "warn"
"GET /internal/health": "off"
When aggregation is enabled, 400 responses include both a flat errors
list and a details
array with structured items: