Skip to content

Mockly

Cross-platform, multi-protocol mock server — HTTP, WebSocket, gRPC, GraphQL, TCP, Redis, SMTP, MQTT, NATS, SNMP, DNS, AMQP, Kafka, LDAP, IMAP, FTP, Memcached, STOMP, CoAP, and SIP in a single binary, with a built-in web UI, REST management API, scenario system, and fault injection.

CI Latest release License: MIT

View on GitHub Quickstart

Why Mockly?

Testing against real third-party services (payment gateways, auth providers, message brokers) is slow, flaky, and often impossible to drive into failure scenarios on demand. Mockly runs as a single, dependency-free binary that speaks 20+ protocols natively — not just HTTP — so you can mock the entire integration surface of a modern service, not just its REST API.

  • One binary, every protocol — HTTP, gRPC, GraphQL, WebSocket, and 16 more, all driven by the same YAML config and management API.
  • Drop-in presets — Keycloak, Stripe, OpenAI, GitHub, Nets/Nexi payments, and a dozen others, ready to run with one command.
  • Programmable from your test suite — official client libraries for Go, Node.js, Java, .NET, Python, and Rust, plus Testcontainers modules for Docker-based setups.
  • Built for failure testing — scenarios and per-protocol fault injection let you simulate timeouts, errors, and edge cases without touching your hand-written mocks.

Quick taste

# Install (see Quickstart for all options)
git clone https://github.com/dever-labs/mockly && cd mockly && make build

# Run a preset instantly
mockly preset use keycloak

# ...or start from your own config
mockly start --config mockly.yaml
# mockly.yaml
mockly:
  http:
    port: 8080
    mocks:
      - id: get-user
        request:
          method: GET
          path: /users/{id}
        response:
          status: 200
          body: '{"id":"{{.request.params.id}}","name":"Alice"}'

→ Full quickstart · → Configuration guide · → All protocols

Features at a glance

Feature Details
Protocols HTTP, WebSocket, gRPC, GraphQL, TCP, Redis, SMTP, MQTT, NATS, SNMP, DNS, AMQP, Kafka, LDAP, IMAP, FTP, Memcached, STOMP, CoAP, SIP
Request matching Method + path (exact / wildcard / named params / regex), headers (with re: pattern support), query params (exact / wildcard / regex / absence / repeated-value), JSON/form/multipart/XML body fields, authentication
Response sequences Return a different response on each successive call — loop, hold last, or 404 when exhausted
Template responses Go template syntax in response bodies and headers ({{now}}, {{.request.params.id}}, {{.request.body.foo}}, {{uuid}}, {{fake "email"}}, etc.)
Scenarios Named sets of mock patches — activate/deactivate atomically via API or CLI
Fault injection Per-protocol native fault fields (DNS rcode, gRPC status code, Kafka error code, etc.) and per-mock faults (delay, error rate, rate limiting)
Call verification Track how many times each mock was hit; block until an expected count is reached
Record mode (HTTP) Proxy unmatched requests to a real upstream and capture the response as a new mock — bootstrap a mock set without hand-authoring every response
Outbound webhooks Any HTTP mock can fire a templated outbound callback when matched, with delay, retries, and a searchable attempt history
Spec-driven generation mockly generate <spec> turns an OpenAPI, AsyncAPI, or Protobuf spec into a ready-to-run config
Web UI + Management API Served from the binary itself — 60+ REST endpoints covering every protocol, scenario, fault, state, log, and webhook
Preset configs Drop-in YAML for Keycloak, Authelia, OAuth2, GitHub, Stripe, OpenAI, Slack, Twilio, SendGrid, Anthropic, Resend, PagerDuty, AWS S3, NTLM, Nets/Nexi
CI-friendly Zero dependencies, single binary, YAML config, Docker image

See the full feature reference for details on every matcher and response option.

Where to go next