# osakichi/markmiru architecture

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

- Interactive diagram: https://gitdiagram.com/osakichi/markmiru
- Repository: https://github.com/osakichi/markmiru

## Overview

Markmiru is a Go/Wails desktop Markdown viewer and lightweight editor. Users open, drop, or restore documents, then view rendered Markdown or make edits and save; tabs, reload, search, printing, and style customization support that workflow. Go owns application state and server-rendered UI, while htmx and small WebView glue handle interactions. The graph preserves documented capabilities whose individual handlers were not sampled; those links cite the README rather than implying their source was inspected. Some platform-specific and UI wiring is therefore summarized at subsystem level.

Main entry points: [`web/web.go`](https://github.com/osakichi/markmiru/blob/main/web/web.go) (HTTP handlers), [`main.go`](https://github.com/osakichi/markmiru/blob/main/main.go) (App startup), [`web/assets/glue.js`](https://github.com/osakichi/markmiru/blob/main/web/assets/glue.js) (WebView interactions), [`web/state.go`](https://github.com/osakichi/markmiru/blob/main/web/state.go) (Tabs and session state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_main["App startup<br/>[main.go]"]
  node_app["App services<br/>[app.go]"]
  node_single["Single instance IPC<br/>[single_instance.go]"]
  node_platform["OS integration<br/>[platform_linux.go]"]
end

subgraph group_documents["Document workflow"]
  node_config["Config persistence<br/>[config.go]"]
  node_state["Tabs and session state<br/>[state.go]"]
  node_textformat["Text format handling<br/>[textformat.go]"]
end

subgraph group_presentation["Rendering and styles"]
  node_render["Markdown rendering<br/>[render.go]"]
  node_style["Style model and CSS<br/>[style.go]"]
  node_print["Print and PDF<br/>[platform_darwin.go]"]
  node_external["External links and images<br/>[render.go]"]
end

subgraph group_interface["Server-rendered interface"]
  node_handler["HTTP handlers<br/>[web.go]"]
  node_templates["HTML templates"]
  node_glue["WebView interactions<br/>[glue.js]"]
  node_search["Page search<br/>[glue.js]"]
end

node_user(("User"))
node_files[("Markdown files")]
node_mermaid["Mermaid diagrams"]

node_user -->|"launches"| node_main
node_main -->|"creates"| node_app
node_main -->|"checks instance"| node_single
node_single -->|"delivers paths"| node_app
node_app -->|"raises window"| node_platform
node_main -->|"installs handler"| node_handler
node_main -->|"restores tabs"| node_state
node_main -->|"loads and saves"| node_config
node_user -->|"opens and edits"| node_handler
node_handler -->|"updates state"| node_state
node_handler -.->|"renders HTML"| node_templates
node_handler -->|"highlights code"| node_render
node_handler -->|"serves assets"| node_glue
node_glue -->|"sends requests"| node_handler
node_state -->|"normalizes text"| node_textformat
node_handler -->|"reads and writes"| node_files
node_state -->|"persists session"| node_config
node_render -->|"marks diagrams"| node_mermaid
node_handler -.->|"manages styles"| node_style
node_style -.->|"provides CSS values"| node_handler
node_glue -->|"implements search"| node_search
node_user -->|"prints document"| node_print
node_render -->|"sanitizes content"| node_external
node_glue -->|"confirms navigation"| node_external

click node_main "https://github.com/osakichi/markmiru/blob/main/main.go"
click node_app "https://github.com/osakichi/markmiru/blob/main/app.go"
click node_single "https://github.com/osakichi/markmiru/blob/main/single_instance.go"
click node_platform "https://github.com/osakichi/markmiru/blob/main/platform_linux.go"
click node_config "https://github.com/osakichi/markmiru/blob/main/config.go"
click node_state "https://github.com/osakichi/markmiru/blob/main/web/state.go"
click node_textformat "https://github.com/osakichi/markmiru/blob/main/web/textformat.go"
click node_handler "https://github.com/osakichi/markmiru/blob/main/web/web.go"
click node_templates "https://github.com/osakichi/markmiru/tree/main/web/templates"
click node_glue "https://github.com/osakichi/markmiru/blob/main/web/assets/glue.js"
click node_render "https://github.com/osakichi/markmiru/blob/main/render/render.go"
click node_style "https://github.com/osakichi/markmiru/blob/main/style/style.go"
click node_search "https://github.com/osakichi/markmiru/blob/main/web/assets/glue.js"
click node_print "https://github.com/osakichi/markmiru/blob/main/platform_darwin.go"
click node_external "https://github.com/osakichi/markmiru/blob/main/render/render.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_main,node_app,node_single,node_platform,node_user toneBlue
class node_config,node_state,node_textformat,node_files toneAmber
class node_render,node_style,node_print,node_external toneMint
class node_handler,node_templates,node_glue,node_search toneRose
class node_mermaid toneIndigo
```

## Components

### Desktop runtime

- [App startup](https://github.com/osakichi/markmiru/blob/main/main.go): `main.go`
- [App services](https://github.com/osakichi/markmiru/blob/main/app.go): `app.go`
- [Single instance IPC](https://github.com/osakichi/markmiru/blob/main/single_instance.go): `single_instance.go`
- [OS integration](https://github.com/osakichi/markmiru/blob/main/platform_linux.go): `platform_linux.go`

### Document workflow

- [Config persistence](https://github.com/osakichi/markmiru/blob/main/config.go): `config.go`
- [Tabs and session state](https://github.com/osakichi/markmiru/blob/main/web/state.go): `web/state.go`
- [Text format handling](https://github.com/osakichi/markmiru/blob/main/web/textformat.go): `web/textformat.go`

### Rendering and styles

- [Markdown rendering](https://github.com/osakichi/markmiru/blob/main/render/render.go): `render/render.go`
- [Style model and CSS](https://github.com/osakichi/markmiru/blob/main/style/style.go): `style/style.go`
- [Print and PDF](https://github.com/osakichi/markmiru/blob/main/platform_darwin.go): `platform_darwin.go`
- [External links and images](https://github.com/osakichi/markmiru/blob/main/render/render.go): `render/render.go`

### Server-rendered interface

- [HTTP handlers](https://github.com/osakichi/markmiru/blob/main/web/web.go): `web/web.go`
- [HTML templates](https://github.com/osakichi/markmiru/tree/main/web/templates): `web/templates`
- [WebView interactions](https://github.com/osakichi/markmiru/blob/main/web/assets/glue.js): `web/assets/glue.js`
- [Page search](https://github.com/osakichi/markmiru/blob/main/web/assets/glue.js): `web/assets/glue.js`

### Other components

- **User**
- **Markdown files**
- **Mermaid diagrams**

## Connections

- User → App startup: launches (evidence: `README.md`)
- App startup → App services: creates (evidence: `main.go`)
- App startup → Single instance IPC: checks instance (evidence: `main.go`)
- Single instance IPC → App services: delivers paths (evidence: `single_instance.go`)
- App services → OS integration: raises window (evidence: `app.go`)
- App startup → HTTP handlers: installs handler (evidence: `main.go`)
- App startup → Tabs and session state: restores tabs (evidence: `main.go`)
- App startup → Config persistence: loads and saves (evidence: `main.go`)
- User → HTTP handlers: opens and edits (evidence: `README.md`)
- HTTP handlers → Tabs and session state: updates state (evidence: `web/web.go`)
- HTTP handlers → HTML templates: renders HTML
- HTTP handlers → Markdown rendering: highlights code (evidence: `web/web.go`)
- HTTP handlers → WebView interactions: serves assets (evidence: `web/web.go`)
- WebView interactions → HTTP handlers: sends requests (evidence: `README.md`)
- Tabs and session state → Text format handling: normalizes text (evidence: `web/state.go`)
- HTTP handlers → Markdown files: reads and writes (evidence: `README.md`)
- Tabs and session state → Config persistence: persists session (evidence: `README.md`)
- Markdown rendering → Mermaid diagrams: marks diagrams (evidence: `README.md`)
- HTTP handlers → Style model and CSS: manages styles
- Style model and CSS → HTTP handlers: provides CSS values
- WebView interactions → Page search: implements search (evidence: `README.md`)
- User → Print and PDF: prints document (evidence: `README.md`)
- Markdown rendering → External links and images: sanitizes content (evidence: `README.md`)
- WebView interactions → External links and images: confirms navigation (evidence: `README.md`)
