mockzilla

module
v2.8.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: MIT

README

Mockzilla open-source API mock server built with Go

Mockzilla

CI codecov Go Reference mockzilla License

Mockzilla is an open-source mock server for OpenAPI specifications, validated against 2,200+ real-world OpenAPI specifications across 98,000+ endpoints. Point it at a spec and get a running API mock server in seconds - no code, no configuration, no separate infrastructure. It generates realistic responses from your schema, validates incoming requests against the spec, and can proxy real backends with automatic mock fallback so you can mix real and mocked endpoints in the same server. Use it locally during development, in CI pipelines for integration testing, or embed specs into a portable binary for offline and air-gapped environments.

Goals

  • Generate realistic mock APIs directly from OpenAPI specs, not a custom DSL.
  • Combine multiple third-party APIs into a single local mock server.
  • Catch contract drift early by validating every request against the spec.

Features

  • Multiple APIs on one server - each spec becomes a service with its own URL prefix
  • Upstream proxy - forward to real backends with fallback to mocks
  • Latency & error simulation - test how your app handles delays and failures
  • Custom middleware - modify requests/responses on the fly
  • Response caching - cache GET responses for consistency
  • Request validation - validate against OpenAPI spec
  • Static responses - define custom responses for any path outside your OpenAPI spec
  • Selective overrides - override specific endpoints with static responses or custom handlers while the rest of the OpenAPI spec stays auto‑generated

Real-World Validation

Mockzilla continuously generates and validates data against 2,200+ real-world OpenAPI specifications:

Total: 2215 services, 98464 endpoints
✅ Success: 98464  ❌ Fails: 0

Modes

Mockzilla runs in two modes:

  • Portable - point at OpenAPI specs and run. No code generation, no setup.
  • Codegen - generate typed Go handlers with custom logic and middleware.

Use cases

  • Local development - mock APIs your backend hasn't built yet
  • CI/CD integration testing - zero external dependencies in your pipeline
  • PSP and payment API mocking - Stripe, PayPal, Adyen without sandbox accounts
  • Crypto exchange API mocking - Binance, Bybit without registered accounts
  • Rate limit protection - develop against OpenAI, Twilio without burning quota
  • Multi-service testing - run Stripe + Twilio + SendGrid on one port
  • Offline and air-gapped environments - embed specs into a portable binary, no internet required
  • Selective endpoint overrides - keep hundreds of endpoints auto-generated and hand-craft the few that need custom behavior

Quick Start

Homebrew

brew tap mockzilla/tap
brew install mockzilla
mockzilla https://petstore3.swagger.io/api/v3/openapi.json

Go

go run github.com/mockzilla/mockzilla/v2/cmd/mockzilla@latest \
  https://petstore3.swagger.io/api/v3/openapi.json

Templates

Read full documentation at mockzilla.github.io/mockzilla.

Mockzilla Cloud

If you need per-PR simulation URLs, team-shared stable endpoints, or zero-config GitHub Action setup without running your own server, mockzilla.org is the hosted version built on the same engine.

AI and MCP tooling

Mockzilla ships an MCP server, so AI tools like Claude Code, Cursor, and Gemini CLI can launch mock APIs directly from any OpenAPI definition. Point the agent at a spec and it spins up a Mockzilla server under the hood, letting you iterate on client code or integration tests without leaving the editor.

License

Copyright © 2023-present

Licensed under the MIT License

Directories

Path Synopsis
cmd
api
fake_list command
gen/discover command
gen/fakes command
gen/service command
mockzilla command
internal
inspect
Package inspect implements the `mockzilla info <spec>` subcommand.
Package inspect implements the `mockzilla info <spec>` subcommand.
portableintegration
Package portableintegration orchestrates TestPortableIntegration across the full spec corpus.
Package portableintegration orchestrates TestPortableIntegration across the full spec corpus.
simplify
Package simplify is the pure-logic core of the `mockzilla simplify` command.
Package simplify is the pure-logic core of the `mockzilla simplify` command.
pkg
api
db
Package db provides a shared storage abstraction with support for multiple backends (memory, redis) and per-service isolated views.
Package db provides a shared storage abstraction with support for multiple backends (memory, redis) and per-service isolated views.
lint
Package lint flags OpenAPI specs that contain constructs the libopenapi-validator rejects as unsatisfiable.
Package lint flags OpenAPI specs that contain constructs the libopenapi-validator rejects as unsatisfiable.
middleware
Package middleware provides HTTP middleware for mockzilla services.
Package middleware provides HTTP middleware for mockzilla services.
pack
Package pack creates and reads `.mockz` archives.
Package pack creates and reads `.mockz` archives.
typedef/internal/libopenapi
Package libopenapi parses OpenAPI specs via pb33f/libopenapi and exposes a Registry whose methods match typedef.OperationRegistry.
Package libopenapi parses OpenAPI specs via pb33f/libopenapi and exposes a Registry whose methods match typedef.OperationRegistry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL