---
title: "Enhancing the Mock Server: A User Interface Approach"
description: "Zalando's team built a UI on top of mirage.js so product managers and designers can switch which mocked response each API endpoint returns on a staging build, without code changes or redeploys."
url: "https://swe.quest/articles/enhancing-the-mock-server-a-user-interface-approach-ff47adf3053feadf"
canonical: "https://engineering.zalando.com/posts/2024/04/enhancing-the-mock-server-a-ui-approach.html"
source: "Zalando Engineering"
published: "2024-04-24"
difficulty: "medium"
kind: "Case study"
reading_minutes: 7
tags: ["frontend","react","testing","developer-productivity"]
---

# Enhancing the Mock Server: A User Interface Approach

A post on [Zalando Engineering](https://swe.quest/sources/zalando.md), published 2024-04-24, 7 min read, Case study. Original: [https://engineering.zalando.com/posts/2024/04/enhancing-the-mock-server-a-ui-approach.html](https://engineering.zalando.com/posts/2024/04/enhancing-the-mock-server-a-ui-approach.html)

## Summary

Zalando's team built a UI on top of mirage.js so product managers and designers can switch which mocked response each API endpoint returns on a staging build, without code changes or redeploys. A React Context provider re-instantiates the mock server on demand, and the selected scenario is kept in session storage under an app-unique key so it survives the page reload that loading a new data set requires. The approach covers edge cases like stale or missing data, but it complements rather than replaces unit and contract tests, and the frontend-defined mocks must be kept in sync with the backend schema. A generalized version now ships as an internal NPM module.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)
- [Developer productivity](https://swe.quest/tags/developer-productivity.md) (Engineering practices)

## Prerequisites

- React Context API ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- API mocking libraries

## Keywords

mirage.js, MSW, React Context API, sessionStorage, Apollo

## Related posts

- [Remixing Shopify's Admin: How We Made It 30% Faster and AI-Ready](https://swe.quest/articles/remixing-shopify-s-admin-how-we-made-it-30-faster-and-ai-ready-996b243df73e0345.md): Shopify Engineering · 2025-06-30 · Medium · 7 min read · Web performance, React, Frontend, Refactoring & migrations, AI agents
  Shopify migrated its Admin (67 million daily page views, 101 teams, ~350 PRs merged daily, 3M+ lines of TypeScript) to Remix in SPA mode with Vite.
- [Leveraging Testcontainers for Complex Integration Testing in Mattermost Plugins](https://swe.quest/articles/leveraging-testcontainers-for-complex-integration-testing-in-mattermost-plugins-3edaea4757026529.md): Docker · 2024-10-08 · Medium · 6 min read · Testing, Containers, Go, JavaScript
  Mattermost replaced brittle mock-based plugin tests with Testcontainers-driven integration tests that spin up a Mattermost server, PostgreSQL on an internal Docker network, and optional API mock containers.
- [How We Built The Deals Tab in Swift UI](https://swe.quest/articles/how-we-built-the-deals-tab-in-swift-ui-81d29cc7e9699bbd.md): Etsy Code as Craft · 2024-03-05 · Medium · 13 min read · Swift, Mobile, Refactoring & migrations, Build systems, Developer productivity
  Etsy rebuilt its mobile Updates tab as a new Deals tab in SwiftUI inside a modular Tuist module, which made preview builds nearly instant and let the team build modules from mock preview data about two weeks before the APIs were ready.
- [Building with the OpenAI Apps SDK: A Field Guide](https://swe.quest/articles/building-with-the-openai-apps-sdk-a-field-guide-4d32891d09b8bb2e.md): Render · 2025-10-29 · Medium · 8 min read · AI agents, LLMs, Developer tools, TypeScript, Debugging
  OpenAI's Apps SDK extends the Model Context Protocol with a widget layer: tools that return structuredContent with \`\_meta.openai/outputTemplate\` metadata get rendered as inline React components in ChatGPT.
- [How we built it: incident.io Status Pages](https://swe.quest/articles/how-we-built-it-incident-io-status-pages-37acc4f93c86c23d.md): incident.io · 2023-04-19 · Medium · 8 min read · Caching, React, Frontend, Serverless, CDN & edge
  incident.io built its Status Pages product in three months on Vercel and Next.js, using Incremental Static Regeneration with per-fetch revalidate times (e.g. 30s) so the backend serves only a couple of requests per minute regardless of traffic spikes.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
