Skip to main content

Mock Server Engine

Rumour UI includes a built-in Mock Server Engine (<Server size={16} />) capable of simulating backend services locally across HTTP, GraphQL, WebSockets, gRPC, and MQTT. It allows developers to build against pending backend APIs, test negative error paths (401 Unauthorized, 500 Server Error), simulate network jitter, intercept wire traffic via reverse proxy, and generate dynamic synthetic data without touching production services.

Mock Server Engine

1. UI Layout & Functional Architecture​

The Mock Server Engine operates across three primary UI zones:

UI ZoneComponentPurpose
Supervisor HeaderMockHeaderCardPersistent top card displaying operational status (LIVE / STOPPED), listening port, server switcher, sync indicator, and process toggles.
Sub-Tabs Navigation BarMockSubTabsBarNavigates between the 5 dedicated sub-views: Servers, Endpoints, Traffic, Settings, and Docs.
Active Sub-View PanelMockEndpointsTab, MockTrafficTab, etc.Tab-specific workspace for managing route scenarios, inspecting wire traffic, or browsing dynamic Faker variables.

2. Workspace Initialization Modes​

When opening the Mock Server tab in a workspace that does not yet possess a compiled mock.manifest.json, Rumour renders the Uninitialized Onboarding Wizard:

Uninitialized Mock Server Wizard

Three Initialization Pathways​

  1. Option 1: Discover & Select Workspace Servers: Scans the workspace to identify all declared services, target ports, and protocols. Allows developers to selectively compile individual server instances or group multiple servers into a unified manifest.
  2. Option 2: Direct Compile All Workspace Requests: Performs an automated scan across all *.toml request files and packages all discovered endpoints into a single unified mock.manifest.json.
  3. Alternative: Intercept Live API: Launches a reverse-proxy listener in front of a live staging or production backend. Intercepted HTTP transactions are automatically recorded and converted into reusable mock route definitions.

3. Server Supervisor Header​

Once initialized, the persistent header card provides real-time status and operational controls:

  • Status Indicator: Displays a glowing green LIVE badge when running, or Mock Server Stopped when inactive.
  • Server Selector Dropdown: Switch between managing the unified supervisor across all configured ports or isolating an individual server instance.
  • Sync Button (Sync (N)): Appears automatically when underlying .toml request files have been modified on disk, allowing one-click synchronization without restarting processes.
  • Restart Button: Refreshes socket bindings and reloads the manifest in memory.
  • Start / Stop Toggle: Primary power button to activate or terminate local mock server daemons.

4. The Five Mock Server Sub-Tabs​

1. Servers (Protocol Directory)​

Displays all running protocol instances:

  • Protocol Badges: Identifies active protocols (HTTP, WebSocket, gRPC, MQTT).
  • Port Bindings: Port assignments (e.g. 4000, 4001, 50051, 1883).
  • Individual Controls: Start or stop specific server instances independently.

2. Endpoints (Route & Scenario Catalog)​

The primary routing workspace for exploring and testing simulated API endpoints:

  • Search & Method Filters: Real-time search bar alongside method pills (ALL, GET, POST, PUT, DELETE) with count badges.
  • Route Cards: Displays the HTTP method verb, path pattern (e.g. /api/v2/users, /api/v2/users/:id), and backing source file.
  • Scenario Dropdown: Switch response behaviors on the fly:
    • 200 OK (Standard Success): Standard payload and clean headers.
    • 401 Unauthorized: Simulates expired tokens or missing credentials.
    • 500 Internal Error: Simulates backend crashes and unhandled exceptions.
    • Custom Scenario: Add new custom scenarios with tailored response bodies and status codes ().
  • Latency Delay (ms): Numeric delay input to inject artificial network latency and verify client timeout resilience.
  • Direct Route Testing: Click the Test Route button () to dispatch an automated probe request and inspect the mock response immediately.
  • Clipboard Shortcuts: Copy Route URL () or serialize to compliant cURL syntax ().

3. Traffic (Live Network Stream)​

Real-time wire inspection capturing all requests and responses flowing through the mock server:

  • Stream Controls: Auto-refresh toggle, manual refresh, and Clear Traffic trigger.
  • Filter Bar: Filter recorded traffic by method, HTTP status code (2xx, 4xx, 5xx), or search keywords.
  • Transaction Inspection Drawer: Click any traffic entry to inspect full request headers, query parameters, submitted request body, and returned response payloads.

4. Settings (Proxy & Recording Configuration)​

Global server configuration parameters:

  • Reverse Proxy Target: Forward unhandled routes to a fallback upstream URL (e.g. https://staging.api.example.com).
  • CORS Headers: Enable CORS origin reflection (*) to allow browser frontend SPAs to call the mock server without cross-origin blocks.
  • Auto-Record to TOML: Checkbox to serialize newly intercepted endpoints directly into local .toml request files within your workspace directory.

5. Docs (Faker Synthetic Data Library)​

Built-in searchable reference library documenting dynamic Faker template variables:

  • Categories: Internet ({{$faker.internet.email}}), Person ({{$faker.name}}), Address, Finance, Commerce.
  • One-Click Copy: Click Copy on any variable card to copy the template tag to your clipboard with instant toast confirmation.