How Mock Servers Work
Understanding the technical architecture behind Mokra’s mock servers.The interception layer
When you configure Mokra, it installs an HTTP interception layer:Service mappings
Mokra knows how to route requests based on hostnames:| Hostname | Service |
|---|---|
api.stripe.com | stripe |
*.myshopify.com | shopify |
api.sendgrid.com | sendgrid |
api.loopreturns.com | loop-returns |
| … | 800+ more |
Request transformation
Original request:Response generation
Mock servers generate responses that match the real API:- Schema validation — Request must match expected format
- ID generation — Creates realistic-looking IDs (
ch_mock_abc123) - Timestamps — Uses current time for
createdfields - State updates — Persists resources for later retrieval
- Related resources — Links to previously created objects
State management
Each MockWorld (or session) maintains isolated state:SDK compatibility
Mokra works with official SDKs because it intercepts at the HTTP layer:Performance
- Latency: ~50-100ms (network round-trip to Mokra servers)
- Rate limits: None
- Concurrent requests: Unlimited
- State storage: Automatic cleanup after session ends
Security
- API key scoping: Keys can be scoped to specific services
- No credential forwarding: Real API keys are never sent to Mokra
- HTTPS only: All traffic encrypted
- Data isolation: Each session’s state is isolated