# 07-athi/logmind architecture

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

- Interactive diagram: https://gitdiagram.com/07-athi/logmind
- Repository: https://github.com/07-athi/logmind

## Overview

logmind is a Go HTTP service for submitting application logs and retrieving their analysis. The synchronous workflow validates a submitted log, analyzes it with Gemini, stores the result, and returns it; the optional Kafka path stores a pending entry, queues it, and lets a consumer analyze and update it. The README also mentions OpenAI, but the sampled implementation configures Gemini. Kafka and in-memory storage are confirmed in source; deployment details are omitted from this runtime map.

Main entry points: [`handler/logs.go`](https://github.com/07-athi/logmind/blob/main/handler/logs.go) (Log Handler), [`service/analyzer.go`](https://github.com/07-athi/logmind/blob/main/service/analyzer.go) (Kafka Consumer), [`middleware/logging.go`](https://github.com/07-athi/logmind/blob/main/middleware/logging.go) (HTTP Middleware), [`service/llm.go`](https://github.com/07-athi/logmind/blob/main/service/llm.go) (Analyzer Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_server["HTTP Server<br/>[main.go]"]
  node_middleware["HTTP Middleware<br/>[logging.go]"]
  node_handler["Log Handler<br/>[logs.go]"]
  node_entry["Log Entry<br/>[log.go]"]
  node_store[("In-memory Store<br/>[store.go]")]
end

subgraph group_analysis["Log Analysis"]
  node_analyzer["Analyzer Interface<br/>[llm.go]"]
  node_llm["Gemini Analyzer<br/>[llm.go]"]
end

subgraph group_async["Async Ingestion"]
  node_publisher["Kafka Producer<br/>[analyzer.go]"]
  node_consumer["Kafka Consumer<br/>[analyzer.go]"]
end

node_client(("API Client"))
node_gemini["Gemini API"]
node_kafka["Kafka Broker"]

node_client -->|"HTTP request"| node_middleware
node_server -->|"serves through"| node_middleware
node_middleware -->|"dispatches"| node_handler
node_handler -->|"decodes"| node_entry
node_handler -->|"saves / reads"| node_store
node_handler -.->|"analyzes inline"| node_analyzer
node_analyzer -->|"implemented by"| node_llm
node_llm -->|"generates analysis"| node_gemini
node_handler -.->|"publishes when enabled"| node_publisher
node_publisher -->|"writes log"| node_kafka
node_kafka -->|"delivers log"| node_consumer
node_consumer -->|"analyzes"| node_analyzer
node_consumer -->|"saves result"| node_store
node_handler -->|"returns response"| node_client

click node_server "https://github.com/07-athi/logmind/blob/main/main.go"
click node_middleware "https://github.com/07-athi/logmind/blob/main/middleware/logging.go"
click node_handler "https://github.com/07-athi/logmind/blob/main/handler/logs.go"
click node_entry "https://github.com/07-athi/logmind/blob/main/model/log.go"
click node_store "https://github.com/07-athi/logmind/blob/main/store/store.go"
click node_analyzer "https://github.com/07-athi/logmind/blob/main/service/llm.go"
click node_llm "https://github.com/07-athi/logmind/blob/main/service/llm.go"
click node_publisher "https://github.com/07-athi/logmind/blob/main/service/analyzer.go"
click node_consumer "https://github.com/07-athi/logmind/blob/main/service/analyzer.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_server,node_middleware,node_handler,node_entry,node_store,node_client toneBlue
class node_analyzer,node_llm toneAmber
class node_publisher,node_consumer,node_gemini toneMint
class node_kafka toneIndigo
```

## Components

### HTTP API

- [HTTP Server](https://github.com/07-athi/logmind/blob/main/main.go): `main.go`
- [HTTP Middleware](https://github.com/07-athi/logmind/blob/main/middleware/logging.go): `middleware/logging.go`
- [Log Handler](https://github.com/07-athi/logmind/blob/main/handler/logs.go): `handler/logs.go`
- [Log Entry](https://github.com/07-athi/logmind/blob/main/model/log.go): `model/log.go`
- [In-memory Store](https://github.com/07-athi/logmind/blob/main/store/store.go): `store/store.go`

### Log Analysis

- [Analyzer Interface](https://github.com/07-athi/logmind/blob/main/service/llm.go): `service/llm.go`
- [Gemini Analyzer](https://github.com/07-athi/logmind/blob/main/service/llm.go): `service/llm.go`

### Async Ingestion

- [Kafka Producer](https://github.com/07-athi/logmind/blob/main/service/analyzer.go): `service/analyzer.go`
- [Kafka Consumer](https://github.com/07-athi/logmind/blob/main/service/analyzer.go): `service/analyzer.go`

### Other components

- **API Client**
- **Gemini API**
- **Kafka Broker**

## Connections

- API Client → HTTP Middleware: HTTP request
- HTTP Server → HTTP Middleware: serves through
- HTTP Middleware → Log Handler: dispatches
- Log Handler → Log Entry: decodes
- Log Handler → In-memory Store: saves / reads
- Log Handler → Analyzer Interface: analyzes inline
- Analyzer Interface → Gemini Analyzer: implemented by
- Gemini Analyzer → Gemini API: generates analysis
- Log Handler → Kafka Producer: publishes when enabled
- Kafka Producer → Kafka Broker: writes log
- Kafka Broker → Kafka Consumer: delivers log
- Kafka Consumer → Analyzer Interface: analyzes
- Kafka Consumer → In-memory Store: saves result
- Log Handler → API Client: returns response
