Mock servers

An API mock server in a minute, built from captured traffic

Run a fake API on its own port: endpoints with status, headers, body and delay, HTTP and HTTPS on the same port. Keep working before the backend exists, and keep responses stable for demos and automated tests.

The Microkoi mock servers section: a list of servers with ports, the selected server’s endpoints in folders and a log of recent calls.

From traffic to a mock server

  1. 1

    Capture traffic

    Use your app through the proxy, and the endpoint tree collects every address it talks to.

  2. 2

    Create a server from a branch

    The “Create mock server from branch” button turns each method and path into an endpoint with the last captured response.

  3. 3

    Start it and connect

    The server starts on a free port from 9091 up. Point your app at it instead of the real API.

A real API, all yours

Everything you need so the client never waits for the backend and demos never depend on a test server.

  • Several servers at once

    Each fake service gets its own port and endpoints: the payment gateway on 9091, the profile on 9092.

  • HTTP and HTTPS on one port

    The server detects the protocol itself. Its certificate is issued by the Microkoi root certificate for localhost, network addresses and Android emulators.

  • Endpoints are files in git

    A server is a folder, an endpoint is a file, and the body is real JSON or an image next to it. Large responses give line-by-line diffs.

  • Request log

    Time, method, path, status, matched endpoint and client address. For a request with no endpoint there is a “Create endpoint” button.

  • Reachable from your phone

    The “Local network access” toggle opens the server to a phone, an emulator or another computer.

  • Any file as a response

    Images, PDFs and archives are served as they are, streamed from disk, including as a file download.

How it works

Endpoints with wildcards and priority

An endpoint is a method or “any” plus a path with * and ** wildcards. When several match, the most specific one answers — by the same rules as mocks. A request with no endpoint gets a 404 with a clear JSON body, so you see right away what is missing.

  • Folders are only for order: an endpoint’s address is its path
  • Drag and drop endpoints and folders, and enable or disable a whole folder at once
  • A running server picks up endpoint changes without a restart
  • A server copy gets a free port and its own copies of every body

A server from a traffic branch

The button on a host or path branch of the traffic tree creates a server with an endpoint for each method and path, holding the last captured status, headers and body. Endpoints are laid out in folders by path segment, and bodies become files named by type, so images come along too.

  • Length, compression and connection headers are not copied
  • If a response was stored only partly or is missing, the app warns you

CORS for local development

A web app in development can call the server right away: requests from localhost, *.local and private network addresses get CORS permission automatically. Websites on the internet do not — otherwise any page open in the browser could read the server’s responses.

  • An Access-Control-* header set on an endpoint replaces the automatic one

Ports and startup

The port is picked automatically and checked against other servers in the workspace and the proxy. If a server fails to start — say, another program holds the port — the reason is shown right in the list, next to a Retry button.

  • Running servers come back up the next time you open the workspace
  • A teammate who opens the workspace from the repository never gets servers started or exposed to the network behind their back
  • Switching workspaces stops the previous workspace’s servers

Everything lives in the project folder

A server is stored the same way as request collections: a server folder with server.json, endpoints as files in folders and each endpoint’s body as a file next to it. Changes from git pull or edits to a body in your code editor are picked up immediately.

Questions and answers

How is a mock server different from a mock?

A mock replaces a response in the proxy: your app calls the real address and Microkoi answers. A mock server is a separate API on its own port that your app calls directly, like a backend. Mocks and mock servers never overlap.

Can I call a mock server over HTTPS?

Yes, on the same port as HTTP — the server detects the protocol itself. The device must trust the Microkoi root certificate: on your computer it is installed from the traffic screen, on a phone through device setup.

How do I reach a mock server from a phone or emulator?

Turn on “Local network access” and use your computer’s network address, shown next to the server. The Android emulator reaches your computer at 10.0.2.2.

Is it fine to keep captured data in endpoints?

While a server is running, any program on your computer and any page opened from a local address can read its responses. Replace real tokens and personal data in endpoints before you share or run them.

Try it on your own project

The beta is free and needs no sign-up. Download it, pick your project folder and start the proxy — your first requests will show up within minutes.

Version 0.9.0 · macOS, Windows and Linux · no sign-up