Skip to content

Ghost Mock Server

Ghost turns the responses you’ve recorded in OrbitTest Client into a live local mock API. Use it when the real backend is down, unfinished, rate-limited or expensive to call. Frontend work, demos and automated tests can keep running against realistic data.

There’s nothing to write: Ghost replays what you’ve already sent. It’s free for everyone (it was a Pro feature before v1.3.0).

  1. Record. Send each request you want to mock at least once. Ghost serves the last recorded response for each one.
  2. Start. Flip the Ghost Mock Server toggle on the card at the bottom of the sidebar.
  3. Point your app at it. Ghost listens on http://127.0.0.1:4090. Send your app’s requests there instead of the real host. The path stays the same.
  4. Watch it. Click Open Dashboard for a live page listing every mocked route and how many times it was hit. The dashboard lives at http://127.0.0.1:4090/__orbit__.

Flip the toggle off to stop. Stopping fully releases the port, so the address is the same every time you start Ghost, and you can hard-code 127.0.0.1:4090 in apps, environment files and test scripts. Only if another program is already using port 4090 does Ghost pick a free port instead. The start toast and the dashboard’s Quick-start panel tell you when that happens.

Terminal window
# Recorded in OrbitTest Client: GET https://api.example.com/users/1
curl http://127.0.0.1:4090/users/1

Dynamic routes: one recording serves many ids

Section titled “Dynamic routes: one recording serves many ids”

You don’t have to record every id. When a recorded path contains an id-like segment (an integer, a UUID, or a 24-character hex ObjectId), Ghost turns it into a dynamic route.

  • Record GET /users/1 once, and Ghost also answers /users/2, /users/42 and so on. The dashboard shows these routes with a :id chip, as in /users/:id.
  • Several ids in one path work too: /users/:id/posts/:id2.
  • Routes that differ only by an id segment are collapsed into one :id route.

Id echo. When a dynamic route matches, the requested id is written back into the response body. Calling /users/2 returns a body that reads as user 2 rather than a copy of user 1. Replacement matches whole values only (an id of 1 never corrupts an unrelated 100), and value types are preserved, so a numeric id stays a number.

Terminal window
curl http://127.0.0.1:4090/users/42
# { "id": 42, "name": "Leanne Graham", ... } ← recorded from /users/1, id echoed

Exact recordings still win. A path you recorded literally, like /users/me, is always matched before the :id pattern, so special routes keep working.

The Latency control on the Ghost card sets how fast replies come back:

ModeDelayUse it to
Instant0 msrun fast automated tests
Realistic (default)each request’s recorded response timemake the mock feel like the real server
Slowrecorded time + 2 secondsexercise loading spinners, skeletons and timeout handling

Changing the mode while Ghost is running restarts it automatically so the new timing takes effect. Delays are clamped to 0–60 seconds.

  • Unblock frontend work. Record the endpoints once from a staging server, then develop offline against Ghost.
  • Deterministic UI tests. Point an end-to-end test suite at 127.0.0.1:4090 with Instant latency, so tests don’t depend on a shared backend’s data or uptime.
  • Reproduce slow-network bugs. Switch to Slow and watch how your app behaves when every call takes 2 seconds longer.
  • Demos that can’t fail. Present against Ghost so a flaky network or an expired token can’t derail you.

Ghost binds to 127.0.0.1, so it’s reachable only from your own machine. It serves exactly the data you recorded, so treat recorded responses that contain personal data or tokens with the same care as the originals. Since v1.3.0 the dashboard is hardened against stored-XSS through recorded content, and malformed requests are handled without crashing.

SymptomFix
404 from GhostThat method and path were never recorded. Send the request once in OrbitTest Client, then try again.
Ghost started on a different portAnother program holds 4090. Check the start toast or the dashboard for the actual port, or free 4090 and restart Ghost.
Response shows the wrong idOnly id-like segments (integers, UUIDs, 24-character hex) are dynamic. Other segments must be recorded exactly.

Related: User Guide · Beacon traffic capture · What’s new in 1.3.0