Get Started in 60 Seconds
Install Mockd, start the server, and mock your first API. No config files needed. Single binary, no dependencies, works offline.
Choose Your Installation Method
Pick the method that works best for your workflow. All options get you the same full-featured binary.
Recommended
macOS, Linux & WSL — auto-detects OS and architecture
Pin a version: VERSION=v0.4.6 curl -sSL https://get.mockd.io | sh
Homebrew
macOS & Linux
Go Install
Requires Go 1.25+
Docker
Container ready
Binary
Pre-built
Your First Mock in 3 Steps
No config files. No setup. Start the server, add a mock, and call it. That's it.
Start the server
Run mockd start to launch the mock server.
No config file needed — just a single command.
- Zero config — starts instantly
- Mock server on
:4280, admin API on:4290 - <10ms startup, <30MB memory
$ mockd start
INFO Mock server running on http://localhost:4280
INFO Admin API running on http://localhost:4290
INFO Press Ctrl+C to stopAdd a mock endpoint
In a second terminal, use mockd add to create a mock on the fly.
The CLI talks to the admin API — auth is handled automatically.
- Add mocks without restarting
- Set path, method, status, headers, body
- Works for HTTP, GraphQL, gRPC, WebSocket, and more
$ mockd add http \
--path /api/users \
--body '{"users": [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]}'
Created mock: http_a454ff75
Type: http Method: GET Path: /api/users Status: 200Call your mock
Use curl, Postman, your frontend, or any HTTP client. The mock server returns your configured response with sub-2ms latency.
- Works with any HTTP client
- Sub-2ms response latency
- Full CORS support built in
$ curl http://localhost:4280/api/users
{"users": [
{"id": 1, "name": "Alice"},
{"id": 2, "name": "Bob"}
]}Going Deeper: Config Files
For teams, CI/CD, and complex setups, define your mocks in a mockd.yaml file
and run mockd up — like Docker Compose for mock APIs.
# mockd.yaml — declarative config for teams & CI
version: "1.0"
admins:
- name: local
port: 4290
engines:
- name: default
httpPort: 4280
admin: local
workspaces:
- name: default
engines:
- default
mocks:
- id: list-users
workspace: default
type: http
http:
matcher:
method: GET
path: /api/users
response:
statusCode: 200
headers:
Content-Type: application/json
body: |
{"users": [
{"id": 1, "name": "Alice"},
{"id": 2, "name": "Bob"}
]}
- id: get-user
workspace: default
type: http
http:
matcher:
method: GET
path: /api/users/{id}
response:
statusCode: 200
body: |
{"id": "{{request.pathParam.id}}",
"name": "User {{request.pathParam.id}}",
"email": "user{{request.pathParam.id}}@example.com"}When to use config files
- Reproducible environments — commit
mockd.yamlto Git so every team member gets the same mocks - CI/CD pipelines —
mockd upin your test step loads everything from config - Complex scenarios — template variables, path params, conditional responses, multi-protocol setups
- Hot reload — edit the YAML and the server reloads automatically, no restart needed
$ mockd up
INFO Loading config from mockd.yaml
INFO Registered 2 mocks
INFO HTTP server listening on http://localhost:4280
INFO Admin API listening on http://localhost:4290
INFO Press Ctrl+C to stopQuick Examples by Protocol
Mockd supports 7 protocols. Here are quick examples to get you started with each one.
HTTP / REST
APIs, webhooks, microservices
# HTTP REST Mocks
mocks:
- id: list-products
type: http
http:
matcher:
method: GET
path: /api/products
response:
statusCode: 200
headers:
Content-Type: application/json
body: |
{"products": [
{"id": "{{uuid}}", "name": "Widget", "price": 29.99}
]}
- id: create-product
type: http
http:
matcher:
method: POST
path: /api/products
response:
statusCode: 201
body: |
{"id": "{{uuid}}",
"name": "{{request.body.name}}",
"created": "{{now}}"} WebSocket
Real-time, bidirectional
# WebSocket Mock
mocks:
- id: ws-chat
type: websocket
websocket:
path: /ws/chat
echoMode: true
heartbeat:
enabled: true
interval: "30s"
matchers:
- match:
type: exact
value: "ping"
response:
type: text
value: "pong"
- match:
type: json
path: "$.type"
value: "subscribe"
response:
type: json
value:
type: "subscribed"
timestamp: "{{now}}"
defaultResponse:
type: json
value:
type: "echo"
received: "{{message}}" GraphQL
Queries, mutations, subscriptions
# GraphQL Mock
mocks:
- id: graphql-api
type: graphql
graphql:
path: /graphql
introspection: true
schema: |
type Query {
user(id: ID!): User
users: [User!]!
}
type User {
id: ID!
name: String!
email: String!
}
resolvers:
Query.user:
response:
id: "1"
name: "Alice"
email: "alice@example.com"
Query.users:
response:
- id: "1"
name: "Alice"
email: "alice@example.com"
- id: "2"
name: "Bob"
email: "bob@example.com" Share Your Mocks
Need to share your local mocks with teammates, test webhooks, or demo an API? Use the built-in cloud tunnel to get a public HTTPS URL in seconds.
# Expose your mocks to the internet
$ mockd tunnel --port 4280
INFO Tunnel connected
INFO Public URL: https://abc123.tunnel.mockd.io
INFO All 7 protocols tunneled on port 443One command, public URL
The cloud tunnel exposes your local Mockd server to the internet through a single encrypted connection. No signup, no config — just run the command and share the URL.
- All 7 protocols through a single connection
- Works behind firewalls (port 443 only)
- No signup required
Next Steps
Now that you have Mockd running, explore these resources to get the most out of it.
Explore Features
Smart matching, templating, recording, stateful mocks, and more.
Protocol Guides
Deep dives into HTTP, GraphQL, gRPC, WebSocket, MQTT, and more.
Full Documentation
Guides, examples, API reference, and configuration options.
Join the Community
Ask questions, share configs, and connect with other developers.
Ready to Mock Everything?
The CLI is free and open source. Dive into the docs to learn about all 7 protocols, recording, templating, and more.