# kauri-off/mine_search architecture

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

- Interactive diagram: https://gitdiagram.com/kauri-off/mine_search
- Repository: https://github.com/kauri-off/mine_search

## Overview

MineSearch scans Minecraft servers, indexes server and player observations, and exposes search, analysis, and worker controls through a web app. The principal path is operator-configured workers probing servers, streaming results to the backend for persistence, and users exploring indexed data and statistics. Major branches include player search, re-probes, worker management, and bulk IP import. Relationships are limited to README statements and shown source references/calls; unsampled API and page internals constrain finer-grained links.

Main entry points: [`backend/src/services/worker.rs`](https://github.com/kauri-off/mine_search/blob/master/backend/src/services/worker.rs) (Worker control), [`frontend/src/App.tsx`](https://github.com/kauri-off/mine_search/blob/master/frontend/src/App.tsx) (Web routes), [`frontend/src/api/client.ts`](https://github.com/kauri-off/mine_search/blob/master/frontend/src/api/client.ts) (RPC client), [`backend/src/persistence.rs`](https://github.com/kauri-off/mine_search/blob/master/backend/src/persistence.rs) (Persistence operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web routes<br/>[App.tsx]"]
  node_dashboard["Server discovery<br/>[Dashboard.tsx]"]
  node_detail["Server analysis<br/>[ServerDetail.tsx]"]
  node_stats["Statistics<br/>[Stats.tsx]"]
  node_players["Player search<br/>[Players.tsx]"]
  node_workerui["Worker controls<br/>[Workers.tsx]"]
  node_client["RPC client<br/>[client.ts]"]
end

subgraph group_backend["Backend services"]
  node_api["Backend API<br/>[api.rs]"]
  node_workercontrol["Worker control<br/>[worker.rs]"]
  node_auth["Authentication<br/>[auth.rs]"]
  node_registry["Worker registry<br/>[registry.rs]"]
  node_persistence["Persistence operations<br/>[persistence.rs]"]
  node_filters["Server filters<br/>[server_filters.rs]"]
  node_backendstate["Backend state<br/>[state.rs]"]
  node_masscan["Masscan importer<br/>[main.rs]"]
  node_chat["Chat analysis<br/>[chat.rs]"]
  node_html["Server HTML<br/>[html.rs]"]
end

subgraph group_worker["Scanning worker"]
  node_engine["Scan engine<br/>[engine.rs]"]
  node_probe["Minecraft probing<br/>[packets.rs]"]
  node_actions["Probe actions"]
  node_transport["Worker gRPC session<br/>[grpc_backend.rs]"]
  node_outbox["Result outbox<br/>[outbox.rs]"]
end

subgraph group_data["Indexed data"]
  node_postgres[("PostgreSQL index<br/>[schema.rs]")]
  node_servermodels["Server records<br/>[servers.rs]"]
  node_playermodels["Player records<br/>[players.rs]"]
  node_snapshots["Player snapshots"]
end

node_operator(("Operator"))
node_user(("Web user"))

node_user -->|"opens"| node_webapp
node_webapp -->|"routes"| node_dashboard
node_webapp -->|"routes"| node_detail
node_webapp -->|"routes"| node_stats
node_webapp -->|"routes"| node_players
node_webapp -->|"routes"| node_workerui
node_dashboard -.->|"requests data"| node_client
node_detail -.->|"requests data"| node_client
node_stats -.->|"requests data"| node_client
node_players -.->|"requests data"| node_client
node_workerui -->|"controls workers"| node_client
node_client -.->|"calls RPC"| node_api
node_api -.->|"validates sessions"| node_auth
node_api -.->|"reads and writes"| node_persistence
node_operator -->|"retunes workers"| node_workerui
node_workerui -.->|"sends settings"| node_workercontrol
node_transport -->|"opens session"| node_workercontrol
node_workercontrol -.->|"checks worker token"| node_auth
node_workercontrol -->|"registers workers"| node_registry
node_workercontrol -->|"stores results"| node_persistence
node_workercontrol -->|"streams targets"| node_persistence
node_workercontrol -->|"applies filters"| node_filters
node_workercontrol -->|"uses state"| node_backendstate
node_engine -.->|"probes servers"| node_probe
node_engine -->|"streams discoveries"| node_transport
node_transport -->|"drives scan"| node_engine
node_engine -.->|"dispatches probes"| node_actions
node_transport -.->|"buffers results"| node_outbox
node_masscan -->|"imports IPs"| node_api
node_persistence -->|"queries"| node_postgres
node_servermodels -->|"maps schema"| node_postgres
node_playermodels -->|"maps schema"| node_postgres
node_snapshots -.->|"maps schema"| node_postgres
node_persistence -->|"uses predicates"| node_filters
node_html -->|"uses analysis"| node_chat

click node_webapp "https://github.com/kauri-off/mine_search/blob/master/frontend/src/App.tsx"
click node_dashboard "https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/Dashboard.tsx"
click node_detail "https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/ServerDetail.tsx"
click node_stats "https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/Stats.tsx"
click node_players "https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/Players.tsx"
click node_workerui "https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/Workers.tsx"
click node_client "https://github.com/kauri-off/mine_search/blob/master/frontend/src/api/client.ts"
click node_api "https://github.com/kauri-off/mine_search/blob/master/backend/src/services/api.rs"
click node_workercontrol "https://github.com/kauri-off/mine_search/blob/master/backend/src/services/worker.rs"
click node_auth "https://github.com/kauri-off/mine_search/blob/master/backend/src/auth.rs"
click node_registry "https://github.com/kauri-off/mine_search/blob/master/backend/src/registry.rs"
click node_persistence "https://github.com/kauri-off/mine_search/blob/master/backend/src/persistence.rs"
click node_filters "https://github.com/kauri-off/mine_search/blob/master/backend/src/server_filters.rs"
click node_backendstate "https://github.com/kauri-off/mine_search/blob/master/backend/src/state.rs"
click node_engine "https://github.com/kauri-off/mine_search/blob/master/worker/src/engine.rs"
click node_probe "https://github.com/kauri-off/mine_search/blob/master/worker/src/packets.rs"
click node_actions "https://github.com/kauri-off/mine_search/blob/master/worker/src/server_actions/without_connection.rs"
click node_transport "https://github.com/kauri-off/mine_search/blob/master/worker/src/grpc_backend.rs"
click node_outbox "https://github.com/kauri-off/mine_search/blob/master/worker/src/outbox.rs"
click node_masscan "https://github.com/kauri-off/mine_search/blob/master/masscan_wrapper/src/main.rs"
click node_postgres "https://github.com/kauri-off/mine_search/blob/master/backend/src/schema.rs"
click node_servermodels "https://github.com/kauri-off/mine_search/blob/master/backend/src/models/servers.rs"
click node_playermodels "https://github.com/kauri-off/mine_search/blob/master/backend/src/models/players.rs"
click node_snapshots "https://github.com/kauri-off/mine_search/blob/master/backend/src/models/player_count_snapshots.rs"
click node_chat "https://github.com/kauri-off/mine_search/blob/master/backend/src/chat.rs"
click node_html "https://github.com/kauri-off/mine_search/blob/master/backend/src/html.rs"

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_webapp,node_dashboard,node_detail,node_stats,node_players,node_workerui,node_client,node_user toneBlue
class node_api,node_workercontrol,node_auth,node_registry,node_persistence,node_filters,node_backendstate,node_masscan,node_chat,node_html toneAmber
class node_engine,node_probe,node_actions,node_transport,node_outbox toneMint
class node_postgres,node_servermodels,node_playermodels,node_snapshots toneRose
class node_operator toneIndigo
```

## Components

### Web application

- [Web routes](https://github.com/kauri-off/mine_search/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Server discovery](https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Server analysis](https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/ServerDetail.tsx): `frontend/src/pages/ServerDetail.tsx`
- [Statistics](https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/Stats.tsx): `frontend/src/pages/Stats.tsx`
- [Player search](https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/Players.tsx): `frontend/src/pages/Players.tsx`
- [Worker controls](https://github.com/kauri-off/mine_search/blob/master/frontend/src/pages/Workers.tsx): `frontend/src/pages/Workers.tsx`
- [RPC client](https://github.com/kauri-off/mine_search/blob/master/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### Backend services

- [Backend API](https://github.com/kauri-off/mine_search/blob/master/backend/src/services/api.rs): `backend/src/services/api.rs`
- [Worker control](https://github.com/kauri-off/mine_search/blob/master/backend/src/services/worker.rs): `backend/src/services/worker.rs`
- [Authentication](https://github.com/kauri-off/mine_search/blob/master/backend/src/auth.rs): `backend/src/auth.rs`
- [Worker registry](https://github.com/kauri-off/mine_search/blob/master/backend/src/registry.rs): `backend/src/registry.rs`
- [Persistence operations](https://github.com/kauri-off/mine_search/blob/master/backend/src/persistence.rs): `backend/src/persistence.rs`
- [Server filters](https://github.com/kauri-off/mine_search/blob/master/backend/src/server_filters.rs): `backend/src/server_filters.rs`
- [Backend state](https://github.com/kauri-off/mine_search/blob/master/backend/src/state.rs): `backend/src/state.rs`
- [Masscan importer](https://github.com/kauri-off/mine_search/blob/master/masscan_wrapper/src/main.rs): `masscan_wrapper/src/main.rs`
- [Chat analysis](https://github.com/kauri-off/mine_search/blob/master/backend/src/chat.rs): `backend/src/chat.rs`
- [Server HTML](https://github.com/kauri-off/mine_search/blob/master/backend/src/html.rs): `backend/src/html.rs`

### Scanning worker

- [Scan engine](https://github.com/kauri-off/mine_search/blob/master/worker/src/engine.rs): `worker/src/engine.rs`
- [Minecraft probing](https://github.com/kauri-off/mine_search/blob/master/worker/src/packets.rs): `worker/src/packets.rs`
- [Probe actions](https://github.com/kauri-off/mine_search/blob/master/worker/src/server_actions/without_connection.rs): `worker/src/server_actions/without_connection.rs`
- [Worker gRPC session](https://github.com/kauri-off/mine_search/blob/master/worker/src/grpc_backend.rs): `worker/src/grpc_backend.rs`
- [Result outbox](https://github.com/kauri-off/mine_search/blob/master/worker/src/outbox.rs): `worker/src/outbox.rs`

### Indexed data

- [PostgreSQL index](https://github.com/kauri-off/mine_search/blob/master/backend/src/schema.rs): `backend/src/schema.rs`
- [Server records](https://github.com/kauri-off/mine_search/blob/master/backend/src/models/servers.rs): `backend/src/models/servers.rs`
- [Player records](https://github.com/kauri-off/mine_search/blob/master/backend/src/models/players.rs): `backend/src/models/players.rs`
- [Player snapshots](https://github.com/kauri-off/mine_search/blob/master/backend/src/models/player_count_snapshots.rs): `backend/src/models/player_count_snapshots.rs`

### Other components

- **Operator**
- **Web user**

## Connections

- Web user → Web routes: opens (evidence: `frontend/src/App.tsx`)
- Web routes → Server discovery: routes (evidence: `frontend/src/App.tsx`)
- Web routes → Server analysis: routes (evidence: `frontend/src/App.tsx`)
- Web routes → Statistics: routes (evidence: `frontend/src/App.tsx`)
- Web routes → Player search: routes (evidence: `frontend/src/App.tsx`)
- Web routes → Worker controls: routes (evidence: `frontend/src/App.tsx`)
- Server discovery → RPC client: requests data
- Server analysis → RPC client: requests data
- Statistics → RPC client: requests data
- Player search → RPC client: requests data
- Worker controls → RPC client: controls workers (evidence: `frontend/src/pages/Workers.tsx`)
- RPC client → Backend API: calls RPC
- Backend API → Authentication: validates sessions
- Backend API → Persistence operations: reads and writes
- Operator → Worker controls: retunes workers (evidence: `README.md`)
- Worker controls → Worker control: sends settings
- Worker gRPC session → Worker control: opens session (evidence: `backend/src/services/worker.rs`)
- Worker control → Authentication: checks worker token (evidence: `backend/src/services/worker.rs`)
- Worker control → Worker registry: registers workers (evidence: `backend/src/services/worker.rs`)
- Worker control → Persistence operations: stores results (evidence: `backend/src/services/worker.rs`)
- Worker control → Persistence operations: streams targets (evidence: `backend/src/services/worker.rs`)
- Worker control → Server filters: applies filters (evidence: `backend/src/services/worker.rs`)
- Worker control → Backend state: uses state (evidence: `backend/src/services/worker.rs`)
- Scan engine → Minecraft probing: probes servers
- Scan engine → Worker gRPC session: streams discoveries (evidence: `worker/src/engine.rs`)
- Worker gRPC session → Scan engine: drives scan (evidence: `worker/src/engine.rs`)
- Scan engine → Probe actions: dispatches probes
- Worker gRPC session → Result outbox: buffers results
- Masscan importer → Backend API: imports IPs (evidence: `README.md`)
- Persistence operations → PostgreSQL index: queries (evidence: `backend/src/persistence.rs`)
- Server records → PostgreSQL index: maps schema (evidence: `backend/src/models/servers.rs`)
- Player records → PostgreSQL index: maps schema (evidence: `backend/src/models/players.rs`)
- Player snapshots → PostgreSQL index: maps schema
- Persistence operations → Server filters: uses predicates (evidence: `backend/src/persistence.rs`)
- Server HTML → Chat analysis: uses analysis (evidence: `backend/src/html.rs`)
