# dreamhead/moco

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/dreamhead-moco).**

4,446 stars · 1,084 forks · Java · MIT

## Links

- GitHub: https://github.com/dreamhead/moco
- awesome-repositories: https://awesome-repositories.com/repository/dreamhead-moco.md

## Description

moco is a multi-protocol mock server and programmable API stub used to simulate HTTP, REST, WebSocket, and Server-Sent Events endpoints. It enables the creation of fake backend services to facilitate development and integration testing without requiring a live server.

The project distinguishes itself through its ability to act as a network traffic replay tool, capturing real request-response pairs via a proxy and playing them back locally. It also supports bidirectional communication simulations, including WebSocket server simulation and SSE stream simulation with configurable delivery delays.

The tool provides a broad set of capabilities for request matching and response management, including attribute-based filtering, structured data validation via JSONPath and XPath, and hierarchical resource modeling. It supports dynamic content generation through templates and sequential response state machines, and can simulate network conditions using artificial latency.

The server can be executed as a standalone service and is primarily configured using structured JSON files.

## Tags

### Testing & Quality Assurance

- [API Simulation and Mocking](https://awesome-repositories.com/f/testing-quality-assurance/api-simulation-and-mocking.md) — Provides a comprehensive tool for simulating API responses across multiple protocols to replace external backend dependencies. ([source](https://github.com/dreamhead/moco/blob/master/moco-publishing.gradle))
- [API Integration Testing](https://awesome-repositories.com/f/testing-quality-assurance/api-integration-testing.md) — Facilitates automated verification of how systems handle various API responses and sequential workflows.
- [HTTP Mock Servers](https://awesome-repositories.com/f/testing-quality-assurance/http-mock-servers.md) — Executes a standalone HTTP or HTTPS server that serves predefined mock responses from configuration files. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/cmd.md))
- [Mock Behavior Configuration](https://awesome-repositories.com/f/testing-quality-assurance/mock-behavior-configuration.md) — Defines server behavior and response payloads using structured JSON files instead of hard-coded logic.
- [Programmatic Response Generation](https://awesome-repositories.com/f/testing-quality-assurance/programmatic-response-generation.md) — Generates responses programmatically based on incoming request details instead of using static payloads. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/extending.md))
- [Network Latency Simulators](https://awesome-repositories.com/f/testing-quality-assurance/api-network-testing/network-latency-simulators.md) — Introduces configurable artificial delays before sending responses to simulate slow network conditions. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md))
- [WebSocket Mocking Tools](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-utilities-assertions/network-api-mocking/websocket-mocking-tools.md) — Provides a simulator for bidirectional WebSocket communication, including connection messages and event-driven responses.

### Development Tools & Productivity

- [Programmable Response Logic](https://awesome-repositories.com/f/development-tools-productivity/development-environment-management/cloud-service-emulation-interception/api-interception-proxies/api-mocking-stubs/programmable-response-logic.md) — Implements programmable request matching and response logic via JSON configurations or custom code.
- [JSON-Driven Configurations](https://awesome-repositories.com/f/development-tools-productivity/json-driven-configurations.md) — Uses JSON files to define server behavior, request matching, and response payloads. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/usage.md))
- [REST API Mock Servers](https://awesome-repositories.com/f/development-tools-productivity/rest-api-mock-servers.md) — Simulates RESTful endpoints by mapping resource paths and HTTP methods to predefined responses. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/rest-apis.md))
- [Proxy Traffic Captures](https://awesome-repositories.com/f/development-tools-productivity/firefox-configuration/proxy-traffic-captures.md) — Acts as a proxy to capture remote server traffic and record it for future local simulation.
- [API Request Filters](https://awesome-repositories.com/f/development-tools-productivity/package-publishing-pipelines/publishing-policies/artifact-filtering/api-request-filters.md) — Filters incoming requests based on URI, method, parameters, headers, cookies, or body content to match specific stubs. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md))
- [Request Proxying](https://awesome-repositories.com/f/development-tools-productivity/rest-apis/rest-api-data-sources/external-api-clients/request-proxying.md) — Forwards requests to a remote server and records responses for local offline playback. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md))

### Networking & Communication

- [WebSocket Clients and Servers](https://awesome-repositories.com/f/networking-communication/distributed-systems-p2p/distributed-computing/communication-protocols/websocket-implementations/websocket-clients-and-servers.md) — Simulates a WebSocket server that provides bidirectional communication and responses based on request content. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/websocket-apis.md))
- [Request Matching Engines](https://awesome-repositories.com/f/networking-communication/http-request-customization/custom-http-response-serving/http-response-stubbing/request-matching-engines.md) — Matches incoming requests against defined patterns based on headers, bodies, and parameters to select responses. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/extending.md))
- [Server-Sent Events](https://awesome-repositories.com/f/networking-communication/server-sent-events.md) — Implements a Server-Sent Events simulator that streams multiple events to clients with configurable delivery delays. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/sse-apis.md))
- [Sequential Response Queues](https://awesome-repositories.com/f/networking-communication/network-traffic-processors/api-response-simulators/sequential-response-queues.md) — Returns a predefined sequence of different responses for the same request to simulate server state transitions. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md))
- [Network Traffic Replay Tools](https://awesome-repositories.com/f/networking-communication/network-traffic-replay-tools.md) — Captures real request-response pairs via a proxy and replays them locally for offline debugging.
- [SSE Stream Simulators](https://awesome-repositories.com/f/networking-communication/sse-stream-simulators.md) — Simulates SSE endpoints that stream multiple events to clients with configurable delivery delays.

### Web Development

- [Multi-Protocol Dispatchers](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-request-handling/request-dispatchers/multi-protocol-dispatchers.md) — Routes incoming traffic across HTTP, WebSocket, and Server-Sent Events using a unified handling mechanism.
- [Frontend-Driven Development](https://awesome-repositories.com/f/web-development/frontend-driven-development.md) — Enables an iterative frontend development workflow by providing simulated backend responses and network latency.
- [Multi-Protocol Servers](https://awesome-repositories.com/f/web-development/multi-protocol-servers.md) — Handles requests and responses across multiple diverse protocols including HTTP, REST, WebSocket, and Server-Sent Events. ([source](https://github.com/dreamhead/moco#readme))
- [Resource Hierarchy Models](https://awesome-repositories.com/f/web-development/resource-hierarchy-models.md) — Maps nested URI segments to specific resource entities and their associated response sets.
- [Traffic Recorders](https://awesome-repositories.com/f/web-development/api-mocking-servers/traffic-recorders.md) — Captures live HTTP request-response pairs to generate local mock definitions and replay traffic. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md))
- [Response Templating](https://awesome-repositories.com/f/web-development/request-body-handling/dynamic-body-templating/response-templating.md) — Uses templates with variables, random numbers, and timestamps to inject dynamic content into mock responses. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md))

### Data & Databases

- [Structural Data Validators](https://awesome-repositories.com/f/data-databases/structural-data-validators.md) — Validates request bodies against XML or JSON structures using XPath and JSONPath to ensure correct request matching. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md))

### Software Engineering & Architecture

- [Hierarchical Resource Routes](https://awesome-repositories.com/f/software-engineering-architecture/modular-program-composition/nested-api-definitions/hierarchical-resource-routes.md) — Creates sub-resources using nested URI paths to represent complex entity relationships in a mock API. ([source](https://github.com/dreamhead/moco/blob/master/moco-doc/rest-apis.md))

### Part of an Awesome List

- [Testing Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/testing-frameworks.md) — Concise web services for stubs and mocks.
