How mockctl-hq/mockctl works
Mock:ctl is an API simulation engine with a terminal-based Studio and an HTTP runtime. The main workflow is to load an OpenAPI specification, compile route and response templates (including generated schema data and workspace overrides), then serve mock endpoints to API clients; the Studio supports project editing, API testing, and runtime inspection. The graph includes documented/runtime subsystems visible in the tree, but source excerpts are incomplete, so uncertain connections—especially among individual admin and Studio tools—are left out.
Main entry points: tui/app.go Studio app · app/app.go Application core · project_manager.go Project manager · server.go HTTP server
Components 23
Project authoring
- Application core
internal/app/app.go - Project manager
internal/app/project_manager.go - OpenAPI parser
internal/spec/parser.go - Mock generator
internal/generator/generator.go - Payload builder
internal/data/builder.go
Mock API runtime
- HTTP server
internal/runtime/server.go - Project gateway
internal/runtime/gateway.go - Runtime engine
internal/runtime/engine.go - Request handlers
internal/runtime/handlers.go - Admin routes
internal/runtime/admin_routes.go
State and telemetry
- Event broker
internal/runtime/broker.go - Mock state
internal/storage/memory_state.go - System database
internal/storage/bbolt_system.go - Telemetry persister
internal/storage/telemetry_persister.go
Terminal Studio
- Studio app
internal/tui/app.go - Workspace editor
internal/tui/components/workspace/workspace.go - HTTP tester
internal/tui/components/workspace/tester/protocols/http/client.go - Project explorer
internal/tui/components/sidebars/left/inner/body/explorer.go - Runtime controls
internal/tui/components/sidebars/right/inner/body/chaos.go - Request history
internal/tui/components/overlays/header_tools/history/history.go - Studio tools
internal/tui/components/overlays/header_tools/settings/settings.go
Other components
- Developer
- API client
Connections 24
- Developer → Studio app: uses
- API client → HTTP server: sends requests
- Studio app → Workspace editor: initializes
internal/tui/app.go - Studio app → Project explorer: initializes
internal/tui/app.go - Studio app → Request history: initializes
internal/tui/app.go - Studio app → Studio tools: initializes
internal/tui/app.go - Workspace editor → HTTP tester: contains
- Project manager → OpenAPI parser: parses spec
internal/app/project_manager.go - Project manager → Mock generator: compiles engine
internal/app/project_manager.go - Mock generator → Payload builder: builds payloads
internal/generator/generator.go - Application core → Project manager: coordinates
- Application core → System database: persists settings
internal/app/app.go - Application core → HTTP server: starts
internal/app/app.go - HTTP server → Admin routes: mounts
internal/runtime/server.go - HTTP server → Runtime engine: mounts catch-all
internal/runtime/server.go - Runtime engine → Request handlers: dispatches methods
internal/runtime/engine.go - Request handlers → Mock state: reads and writes
internal/runtime/handlers.go - Application core → Event broker: publishes runtime events
- Application core → Telemetry persister: starts
internal/app/app.go - Telemetry persister → System database: persists telemetry
- Studio app → Event broker: subscribes telemetry
internal/tui/app.go - Request history → Runtime engine: queries runtime
- Runtime controls → Runtime engine: configures behavior
- Project manager → System database: loads and saves projects