Skip to content

CheckTheHeaders/openapi-mock-server

 
 

Repository files navigation

Mockzilla open-source API mock server built with Go

Mockzilla

CI codecov GoReportCard 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/server@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.

Related

License

Copyright © 2023-present

Licensed under the MIT License

About

OpenAPI mock server for local development, testing, and CI, with portable and codegen modes, realistic responses, proxy fallback, latency simulation, and request validation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 90.9%
  • JavaScript 4.5%
  • Go Template 1.4%
  • HTML 1.3%
  • CSS 1.2%
  • Makefile 0.5%
  • Other 0.2%