# girorme/cerebro-ergo-example architecture

> Architecture diagram of the GitHub repository girorme/cerebro-ergo-example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/girorme/cerebro-ergo-example
- Repository: https://github.com/girorme/cerebro-ergo-example

## Overview

The repository contains two cooperating actor-based Go services: Cerebro provides coordination and network-facing processes, while nmapit provides a supervised worker pool. The visible nmapit path is application startup → supervisor → pool → workers; Cerebro startup also registers a pipe intended to communicate with nmapit. Cerebro’s API, pipe, supervisor, and results watcher are represented as distinct components, but their internal connections are unclear in the available excerpts. The README supplied no usable capability details, so uncertain cross-service behavior is marked unverified or omitted.

Main entry points: [`cerebro/cmd/main.go`](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/cmd/main.go) (Cerebro startup), [`cerebro/apps/app/pipe.go`](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/pipe.go) (Service pipe), [`nmapit/cmd/main.go`](https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/cmd/main.go) (Nmapit startup), [`nmapit/apps/app/pool.go`](https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/pool.go) (Worker pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cerebro["Cerebro service"]
  node_cerebro_main["Cerebro startup<br/>[main.go]"]
  node_cerebro_app["Cerebro app<br/>[app.go]"]
  node_cerebro_sup["Cerebro supervisor<br/>[sup.go]"]
  node_api["HTTP worker<br/>[api_worker.go]"]
  node_api_routes["API handlers<br/>[api.go]"]
  node_tcp["TCP receiver<br/>[tcpreceiver.go]"]
  node_pipe["Service pipe<br/>[pipe.go]"]
  node_watcher["Results watcher<br/>[resultswatcher.go]"]
  node_scan_request["Scan request type<br/>[types.go]"]
end

subgraph group_nmapit["Nmapit service"]
  node_nmapit_main["Nmapit startup<br/>[main.go]"]
  node_nmapit_app["Nmapit app<br/>[app.go]"]
  node_nmapit_sup["Nmapit supervisor<br/>[sup.go]"]
  node_maestro["Maestro<br/>[maestro.go]"]
  node_pool["Worker pool<br/>[pool.go]"]
  node_worker["Scan worker<br/>[pool_worker.go]"]
end

subgraph group_runtime["Shared runtime roles"]
end

node_operator(("Operator"))
node_tcp_client(("TCP client"))

node_cerebro_main -->|"starts app"| node_cerebro_app
node_cerebro_main -->|"registers pipe"| node_pipe
node_operator -.->|"sends HTTP"| node_api
node_tcp_client -->|"opens connection"| node_tcp
node_nmapit_main -->|"starts app"| node_nmapit_app
node_nmapit_sup -->|"supervises"| node_pool
node_pool -->|"spawns workers"| node_worker
node_pipe -.->|"communicates with"| node_nmapit_main

click node_cerebro_main "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/cmd/main.go"
click node_cerebro_app "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/app.go"
click node_cerebro_sup "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/sup.go"
click node_api "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/api_worker.go"
click node_api_routes "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/api.go"
click node_tcp "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/tcpreceiver.go"
click node_pipe "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/pipe.go"
click node_watcher "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/resultswatcher.go"
click node_scan_request "https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/types/types.go"
click node_nmapit_main "https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/cmd/main.go"
click node_nmapit_app "https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/app.go"
click node_nmapit_sup "https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/sup.go"
click node_maestro "https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/maestro.go"
click node_pool "https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/pool.go"
click node_worker "https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/pool_worker.go"

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_cerebro_main,node_cerebro_app,node_cerebro_sup,node_api,node_api_routes,node_tcp,node_pipe,node_watcher,node_scan_request,node_tcp_client toneBlue
class node_nmapit_main,node_nmapit_app,node_nmapit_sup,node_maestro,node_pool,node_worker toneAmber
class node_operator toneIndigo
```

## Components

### Cerebro service

- [Cerebro startup](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/cmd/main.go): `cerebro/cmd/main.go`
- [Cerebro app](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/app.go): `cerebro/apps/app/app.go`
- [Cerebro supervisor](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/sup.go): `cerebro/apps/app/sup.go`
- [HTTP worker](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/api_worker.go): `cerebro/apps/app/api_worker.go`
- [API handlers](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/api.go): `cerebro/apps/app/api.go`
- [TCP receiver](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/tcpreceiver.go): `cerebro/apps/app/tcpreceiver.go`
- [Service pipe](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/pipe.go): `cerebro/apps/app/pipe.go`
- [Results watcher](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/apps/app/resultswatcher.go): `cerebro/apps/app/resultswatcher.go`
- [Scan request type](https://github.com/girorme/cerebro-ergo-example/blob/main/cerebro/types/types.go): `cerebro/types/types.go`

### Nmapit service

- [Nmapit startup](https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/cmd/main.go): `nmapit/cmd/main.go`
- [Nmapit app](https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/app.go): `nmapit/apps/app/app.go`
- [Nmapit supervisor](https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/sup.go): `nmapit/apps/app/sup.go`
- [Maestro](https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/maestro.go): `nmapit/apps/app/maestro.go`
- [Worker pool](https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/pool.go): `nmapit/apps/app/pool.go`
- [Scan worker](https://github.com/girorme/cerebro-ergo-example/blob/main/nmapit/apps/app/pool_worker.go): `nmapit/apps/app/pool_worker.go`

### Other components

- **Operator**
- **TCP client**

## Connections

- Cerebro startup → Cerebro app: starts app (evidence: `cerebro/cmd/main.go`)
- Cerebro startup → Service pipe: registers pipe (evidence: `cerebro/cmd/main.go`)
- Operator → HTTP worker: sends HTTP
- TCP client → TCP receiver: opens connection (evidence: `cerebro/apps/app/tcpreceiver.go`)
- Nmapit startup → Nmapit app: starts app (evidence: `nmapit/cmd/main.go`)
- Nmapit supervisor → Worker pool: supervises (evidence: `nmapit/apps/app/sup.go`)
- Worker pool → Scan worker: spawns workers (evidence: `nmapit/apps/app/pool.go`)
- Service pipe → Nmapit startup: communicates with
