# dever-labs/mockly architecture

> Architecture diagram of the GitHub repository dever-labs/mockly, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dever-labs/mockly
- Repository: https://github.com/dever-labs/mockly

## Overview

Mockly is a configurable, multi-protocol mock server. Users or test clients configure mocks through the management API, UI, CLI, or SDKs; application traffic then reaches the matching protocol server and receives configured responses. The graph captures documented capabilities, but several subsystem links rely on the README because their source was not sampled.

Main entry points: [`internal/api/server.go`](https://github.com/dever-labs/mockly/blob/main/internal/api/server.go) (REST API), [`cmd/mockly/main.go`](https://github.com/dever-labs/mockly/blob/main/cmd/mockly/main.go) (Mockly CLI), [`internal/protocols/httpserver/server.go`](https://github.com/dever-labs/mockly/blob/main/internal/protocols/httpserver/server.go) (HTTP Server), [`internal/protocols`](https://github.com/dever-labs/mockly/tree/main/internal/protocols) (Messaging Protocols)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry Points"]
  node_cli["Mockly CLI<br/>[main.go]"]
  node_config["Configuration<br/>[config.go]"]
  node_presets["Preset Configs<br/>[presets.go]"]
end

subgraph group_management["Management"]
  node_ui["Web UI"]
  node_api["REST API<br/>[server.go]"]
end

subgraph group_runtime["Mock Runtime"]
  node_http["HTTP Server<br/>[server.go]"]
  node_wsgrpc["WS, gRPC, GraphQL"]
  node_messaging["Messaging Protocols"]
  node_otherproto["Other Protocols"]
end

subgraph group_shared["Shared Services"]
  node_engine["Matching &amp; Templates"]
  node_scenarios["Scenarios &amp; Faults"]
  node_state[("Runtime State<br/>[store.go]")]
  node_logs[("Request Logs<br/>[logger.go]")]
end

subgraph group_clients["Client Libraries"]
  node_sdk["Language Drivers"]
  node_containers["Testcontainers Integrations"]
end

node_operator(("Operator"))
node_app(("Test Application"))

node_operator -->|"runs commands"| node_cli
node_operator -->|"configures mocks"| node_ui
node_cli -->|"manages mocks"| node_api
node_cli -->|"loads config"| node_config
node_cli -->|"uses presets"| node_presets
node_cli -->|"starts listeners"| node_http
node_cli -->|"starts listeners"| node_wsgrpc
node_cli -->|"starts listeners"| node_messaging
node_cli -->|"starts listeners"| node_otherproto
node_config -->|"configures"| node_http
node_config -->|"configures"| node_wsgrpc
node_config -->|"configures"| node_messaging
node_config -->|"configures"| node_otherproto
node_ui -->|"calls endpoints"| node_api
node_api -->|"manages mocks"| node_http
node_api -->|"manages mocks"| node_wsgrpc
node_api -->|"manages mocks"| node_messaging
node_api -->|"manages mocks"| node_otherproto
node_api -->|"manages scenarios"| node_scenarios
node_api -->|"manages state"| node_state
node_api -->|"reads logs"| node_logs
node_app -->|"sends requests"| node_http
node_app -->|"sends traffic"| node_wsgrpc
node_app -->|"sends traffic"| node_messaging
node_app -->|"sends traffic"| node_otherproto
node_http -->|"matches and renders"| node_engine
node_wsgrpc -.->|"matches and renders"| node_engine
node_messaging -.->|"matches and renders"| node_engine
node_otherproto -.->|"matches and renders"| node_engine
node_http -->|"applies patches and faults"| node_scenarios
node_messaging -.->|"reads protocol faults"| node_scenarios
node_http -->|"checks conditions"| node_state
node_messaging -.->|"checks conditions"| node_state
node_http -->|"records calls"| node_logs
node_messaging -.->|"records traffic"| node_logs
node_sdk -->|"manages server"| node_api
node_sdk -.->|"supports tests"| node_app
node_containers -.->|"wraps server"| node_sdk

click node_cli "https://github.com/dever-labs/mockly/blob/main/cmd/mockly/main.go"
click node_config "https://github.com/dever-labs/mockly/blob/main/internal/config/config.go"
click node_presets "https://github.com/dever-labs/mockly/blob/main/internal/presets/presets.go"
click node_ui "https://github.com/dever-labs/mockly/tree/main/ui/src"
click node_api "https://github.com/dever-labs/mockly/blob/main/internal/api/server.go"
click node_http "https://github.com/dever-labs/mockly/blob/main/internal/protocols/httpserver/server.go"
click node_wsgrpc "https://github.com/dever-labs/mockly/tree/main/internal/protocols"
click node_messaging "https://github.com/dever-labs/mockly/tree/main/internal/protocols"
click node_otherproto "https://github.com/dever-labs/mockly/tree/main/internal/protocols"
click node_engine "https://github.com/dever-labs/mockly/tree/main/internal/engine"
click node_scenarios "https://github.com/dever-labs/mockly/tree/main/internal/scenarios"
click node_state "https://github.com/dever-labs/mockly/blob/main/internal/state/store.go"
click node_logs "https://github.com/dever-labs/mockly/blob/main/internal/logger/logger.go"
click node_sdk "https://github.com/dever-labs/mockly/tree/main/clients"
click node_containers "https://github.com/dever-labs/mockly/tree/main/clients"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_config,node_presets toneBlue
class node_ui,node_api toneAmber
class node_http,node_wsgrpc,node_messaging,node_otherproto toneMint
class node_engine,node_scenarios,node_state,node_logs toneRose
class node_sdk,node_containers,node_operator,node_app toneIndigo
```

## Components

### Entry Points

- [Mockly CLI](https://github.com/dever-labs/mockly/blob/main/cmd/mockly/main.go): `cmd/mockly/main.go`
- [Configuration](https://github.com/dever-labs/mockly/blob/main/internal/config/config.go): `internal/config/config.go`
- [Preset Configs](https://github.com/dever-labs/mockly/blob/main/internal/presets/presets.go): `internal/presets/presets.go`

### Management

- [Web UI](https://github.com/dever-labs/mockly/tree/main/ui/src): `ui/src`
- [REST API](https://github.com/dever-labs/mockly/blob/main/internal/api/server.go): `internal/api/server.go`

### Mock Runtime

- [HTTP Server](https://github.com/dever-labs/mockly/blob/main/internal/protocols/httpserver/server.go): `internal/protocols/httpserver/server.go`
- [WS, gRPC, GraphQL](https://github.com/dever-labs/mockly/tree/main/internal/protocols): `internal/protocols`
- [Messaging Protocols](https://github.com/dever-labs/mockly/tree/main/internal/protocols): `internal/protocols`
- [Other Protocols](https://github.com/dever-labs/mockly/tree/main/internal/protocols): `internal/protocols`

### Shared Services

- [Matching & Templates](https://github.com/dever-labs/mockly/tree/main/internal/engine): `internal/engine`
- [Scenarios & Faults](https://github.com/dever-labs/mockly/tree/main/internal/scenarios): `internal/scenarios`
- [Runtime State](https://github.com/dever-labs/mockly/blob/main/internal/state/store.go): `internal/state/store.go`
- [Request Logs](https://github.com/dever-labs/mockly/blob/main/internal/logger/logger.go): `internal/logger/logger.go`

### Client Libraries

- [Language Drivers](https://github.com/dever-labs/mockly/tree/main/clients): `clients`
- [Testcontainers Integrations](https://github.com/dever-labs/mockly/tree/main/clients): `clients`

### Other components

- **Operator**
- **Test Application**

## Connections

- Operator → Mockly CLI: runs commands
- Operator → Web UI: configures mocks
- Mockly CLI → REST API: manages mocks
- Mockly CLI → Configuration: loads config
- Mockly CLI → Preset Configs: uses presets
- Mockly CLI → HTTP Server: starts listeners
- Mockly CLI → WS, gRPC, GraphQL: starts listeners
- Mockly CLI → Messaging Protocols: starts listeners
- Mockly CLI → Other Protocols: starts listeners
- Configuration → HTTP Server: configures
- Configuration → WS, gRPC, GraphQL: configures
- Configuration → Messaging Protocols: configures
- Configuration → Other Protocols: configures
- Web UI → REST API: calls endpoints
- REST API → HTTP Server: manages mocks
- REST API → WS, gRPC, GraphQL: manages mocks
- REST API → Messaging Protocols: manages mocks
- REST API → Other Protocols: manages mocks
- REST API → Scenarios & Faults: manages scenarios
- REST API → Runtime State: manages state
- REST API → Request Logs: reads logs
- Test Application → HTTP Server: sends requests
- Test Application → WS, gRPC, GraphQL: sends traffic
- Test Application → Messaging Protocols: sends traffic
- Test Application → Other Protocols: sends traffic
- HTTP Server → Matching & Templates: matches and renders
- WS, gRPC, GraphQL → Matching & Templates: matches and renders
- Messaging Protocols → Matching & Templates: matches and renders
- Other Protocols → Matching & Templates: matches and renders
- HTTP Server → Scenarios & Faults: applies patches and faults
- Messaging Protocols → Scenarios & Faults: reads protocol faults
- HTTP Server → Runtime State: checks conditions
- Messaging Protocols → Runtime State: checks conditions
- HTTP Server → Request Logs: records calls
- Messaging Protocols → Request Logs: records traffic
- Language Drivers → REST API: manages server
- Language Drivers → Test Application: supports tests
- Testcontainers Integrations → Language Drivers: wraps server
