# itzganesh03/kafka-desktop-manager architecture

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

- Interactive diagram: https://gitdiagram.com/itzganesh03/kafka-desktop-manager
- Repository: https://github.com/itzganesh03/kafka-desktop-manager

## Overview

#### Purpose and Entry Point
Kafka Desktop Manager is a Windows-native Go/Fyne GUI for operating a local, ZooKeeper-based Apache Kafka installation through its bundled Windows `.bat` command tools. `main.go` initializes the application; `internal/ui/app.go` builds the window shell, navigation, page lifecycle, and shortcuts.

#### Configuration and First-Run Boundary
Configuration persists the Kafka install path, bootstrap address, ports, startup preferences, defaults, and theme in local JSON. The first-run UI validates that the selected Kafka installation contains required scripts/configuration before allowing normal operation.
- `internal/config/config.go`
- `internal/ui/wizard.go`
- `internal/ui/settings.go`

#### UI Application Shell
The Fyne UI is organized as navigable operational pages rather than a web/server architecture. The shell coordinates theme selection, splash/startup behavior, refresh actions, notifications, dialogs, exports, and page switching.
- `internal/ui/app.go`
- `internal/ui/theme.go`
- `internal/ui/splash.go`

#### Kafka Command Execution Backbone
The backend deliberately shells out to Kafka’s standard `bin\windows` scripts instead of using a Kafka client library. A runner executes commands, captures output/errors, and records invocations; command history can be viewed and re-run from the UI. This is the principal boundary between Go application code and the installed Kafka distribution.
- `internal/kafka/runner.go`
- `internal/kafka/history.go`
- `internal/kafka/cache.go`

#### Local Service Lifecycle and Logs
ZooKeeper and Kafka broker management starts, stops, and restarts local processes launched by batch files. Service control must account for the Java child process created by the batch launcher, using Windows-specific process-tree handling. Output is streamed into service log views.
- `internal/kafka/service.go`
- `internal/kafka/proc_windows.go`
- `internal/ui/services.go`

#### Kafka Administration Operations
Topic metadata and consumer-group administration are command-wrapper domains: list/create/describe/delete topics, inspect metadata, and retrieve group state, offsets, log-end offsets, and lag. Topic utilities compose operations, notably purge as delete plus recreate while retaining topology.
- `internal/kafka/topics.go`
- `internal/kafka/metadata.go`
- `internal/kafka/groups.go`
- `internal/kafka/utilities.go`

#### Message Production and Consumption Flows
The producer sends single or line-delimited messages through Kafka console tooling and retains send history. The consumer runs as a controllable streaming process; its output feeds a live UI stream with pause/resume, filtering, auto-scroll, copy, and export. These paths are process/output-stream oriented, not broker-client API based.
- `internal/kafka/producer.go`
- `internal/kafka/consumer.go`
- `internal/ui/producer.go`
- `internal/ui/consumer.go`

#### Runtime and Platform Dependencies
Runtime targets Windows 10/11 with a local classic ZooKeeper-based Kafka installation and Java processes launched by Kafka scripts. The GUI uses Fyne and therefore CGO with a C compiler; its desktop rendering stack includes GLFW/OpenGL. Icon generation is a separate Go utility.
- `go.mod`
- `internal/ui/assets.go`
- `tools/genicon/main.go`

Main entry points: [`internal/ui/app.go`](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/app.go) (Application shell), [`internal/kafka/runner.go`](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/runner.go) (Command runner), [`internal/kafka/service.go`](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/service.go) (Local service manager), [`internal/ui/services.go`](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/services.go) (Service controls and logs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Fyne Desktop UI"]
  node_app["Application shell<br/>Fyne navigation<br/>[app.go]"]
  node_theme["Theme and assets<br/>UI resources<br/>[theme.go]"]
  node_splash["Startup splash<br/>UI startup<br/>[splash.go]"]
  node_services_ui["Service controls and logs<br/>operational page<br/>[services.go]"]
  node_producer_ui["Producer page<br/>operational page<br/>[producer.go]"]
  node_consumer_ui["Consumer stream page<br/>operational page<br/>[consumer.go]"]
end

subgraph group_config["Configuration"]
  node_wizard["First-run wizard<br/>setup UI<br/>[wizard.go]"]
  node_settings["Settings page<br/>settings UI<br/>[settings.go]"]
  node_config_store[("Local JSON config<br/>configuration store<br/>[config.go]")]
end

subgraph group_kafka["Kafka Command Backend"]
  node_runner{{"Command runner<br/>Kafka script executor<br/>[runner.go]"}}
  node_history[("Command history<br/>invocation history<br/>[history.go]")]
  node_admin["Topic and group admin<br/>command wrappers<br/>[topics.go]"]
  node_producer["Message producer<br/>console producer wrapper<br/>[producer.go]"]
  node_consumer["Streaming consumer<br/>console consumer wrapper<br/>[consumer.go]"]
  node_service_manager["Local service manager<br/>Windows process control<br/>[service.go]"]
end

subgraph group_runtime["Local Runtime"]
  node_kafka_install["Kafka Windows distribution<br/>external local installation"]
  node_local_services{{"ZooKeeper and Kafka broker<br/>local Java processes"}}
end

node_main(("Application entry<br/>Go entry point<br/>[main.go]"))

node_main -->|"starts"| node_app
node_app -->|"applies"| node_theme
node_app -->|"shows at startup"| node_splash
node_app -->|"opens on first run"| node_wizard
node_app -->|"navigates to"| node_settings
node_wizard -->|"validates and saves"| node_config_store
node_settings -->|"updates"| node_config_store
node_app -->|"hosts page"| node_services_ui
node_app -->|"hosts page"| node_producer_ui
node_app -->|"hosts page"| node_consumer_ui
node_services_ui -->|"controls"| node_service_manager
node_producer_ui -->|"sends through"| node_producer
node_consumer_ui -->|"streams from"| node_consumer
node_runner -->|"records invocations"| node_history
node_admin -->|"executes commands"| node_runner
node_producer -->|"executes console producer"| node_runner
node_consumer -->|"executes console consumer"| node_runner
node_service_manager -->|"launches batch scripts"| node_kafka_install
node_runner -->|"runs bin&#92;windows tools"| node_kafka_install
node_kafka_install -->|"launches"| node_local_services
node_service_manager -->|"stops and monitors"| node_local_services

click node_main "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/main.go"
click node_app "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/app.go"
click node_theme "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/theme.go"
click node_splash "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/splash.go"
click node_wizard "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/wizard.go"
click node_settings "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/settings.go"
click node_config_store "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/config/config.go"
click node_services_ui "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/services.go"
click node_producer_ui "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/producer.go"
click node_consumer_ui "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/consumer.go"
click node_runner "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/runner.go"
click node_history "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/history.go"
click node_admin "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/topics.go"
click node_producer "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/producer.go"
click node_consumer "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/consumer.go"
click node_service_manager "https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/service.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_app,node_theme,node_splash,node_services_ui,node_producer_ui,node_consumer_ui toneBlue
class node_wizard,node_settings,node_config_store toneAmber
class node_runner,node_history,node_admin,node_producer,node_consumer,node_service_manager toneMint
class node_kafka_install,node_local_services toneRose
class node_main toneNeutral
```

## Components

### Fyne Desktop UI

- [Application shell](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/app.go): Fyne navigation · Owns window lifecycle, pages, shortcuts, and notifications. · `internal/ui/app.go`
- [Theme and assets](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/theme.go): UI resources · `internal/ui/theme.go`
- [Startup splash](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/splash.go): UI startup · `internal/ui/splash.go`
- [Service controls and logs](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/services.go): operational page · `internal/ui/services.go`
- [Producer page](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/producer.go): operational page · `internal/ui/producer.go`
- [Consumer stream page](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/consumer.go): operational page · Displays controllable live output with filtering and export. · `internal/ui/consumer.go`

### Configuration

- [First-run wizard](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/wizard.go): setup UI · Validates the local Kafka installation before use. · `internal/ui/wizard.go`
- [Settings page](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/ui/settings.go): settings UI · `internal/ui/settings.go`
- [Local JSON config](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/config/config.go): configuration store · Persists install path, addresses, ports, defaults, and preferences. · `internal/config/config.go`

### Kafka Command Backend

- [Command runner](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/runner.go): Kafka script executor · Executes bundled Windows batch tools and captures output. · `internal/kafka/runner.go`
- [Command history](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/history.go): invocation history · Records commands for viewing and rerunning. · `internal/kafka/history.go`
- [Topic and group admin](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/topics.go): command wrappers · Provides topic metadata, consumer-group state, offsets, lag, and utilities. · `internal/kafka/topics.go`
- [Message producer](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/producer.go): console producer wrapper · Sends single or line-delimited messages and retains send history. · `internal/kafka/producer.go`
- [Streaming consumer](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/consumer.go): console consumer wrapper · Runs a controllable process and streams its output. · `internal/kafka/consumer.go`
- [Local service manager](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/internal/kafka/service.go): Windows process control · Manages Kafka and ZooKeeper process trees and streams logs. · `internal/kafka/service.go`

### Local Runtime

- **Kafka Windows distribution**: external local installation · Bundled bin\windows scripts launch ZooKeeper and Kafka through Java.
- **ZooKeeper and Kafka broker**: local Java processes

### Other components

- [Application entry](https://github.com/itzganesh03/kafka-desktop-manager/blob/master/main.go): Go entry point · Initializes the desktop application. · `main.go`

## Connections

- Application entry → Application shell: starts
- Application shell → Theme and assets: applies
- Application shell → Startup splash: shows at startup
- Application shell → First-run wizard: opens on first run
- Application shell → Settings page: navigates to
- First-run wizard → Local JSON config: validates and saves
- Settings page → Local JSON config: updates
- Application shell → Service controls and logs: hosts page
- Application shell → Producer page: hosts page
- Application shell → Consumer stream page: hosts page
- Service controls and logs → Local service manager: controls
- Producer page → Message producer: sends through
- Consumer stream page → Streaming consumer: streams from
- Command runner → Command history: records invocations
- Topic and group admin → Command runner: executes commands
- Message producer → Command runner: executes console producer
- Streaming consumer → Command runner: executes console consumer
- Local service manager → Kafka Windows distribution: launches batch scripts
- Command runner → Kafka Windows distribution: runs bin\windows tools
- Kafka Windows distribution → ZooKeeper and Kafka broker: launches
- Local service manager → ZooKeeper and Kafka broker: stops and monitors
