# christophergorexyz/mandelbrot-viewer architecture

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

- Interactive diagram: https://gitdiagram.com/christophergorexyz/mandelbrot-viewer
- Repository: https://github.com/christophergorexyz/mandelbrot-viewer

## Overview

mandelbrot-viewer is a browser-facing Mandelbrot set viewer with HTTP endpoints for PNG previews and renders. In the browser workflow, UI interactions update the view and ask the renderer to redraw; the renderer maps pixels to complex coordinates, selects a coloring algorithm, and the algorithm selects colors from a palette. A separate server workflow accepts render parameters, creates a canvas, invokes the renderer, and streams a PNG response. The README describes the set and palette-based coloring; unsampled page wiring is not inferred.

Main entry points: [`src/graphics/renderer.js`](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/graphics/renderer.js) (Canvas renderer), [`src/static/js/index.js`](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/static/js/index.js) (Browser exports), [`src/static/js/ui.js`](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/static/js/ui.js) (View controls), [`src/graphics/coloring-method.js`](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/graphics/coloring-method.js) (Coloring algorithms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Viewer interface"]
  node_ui["View controls<br/>[ui.js]"]
  node_browser_exports["Browser exports<br/>[index.js]"]
end

subgraph group_graphics["Fractal rendering"]
  node_renderer["Canvas renderer<br/>[renderer.js]"]
  node_coloring["Coloring algorithms<br/>[coloring-method.js]"]
  node_palettes["Color palettes<br/>[palette.js]"]
end

subgraph group_http["HTTP rendering"]
  node_http_server["Render routes<br/>[index.js]"]
end

node_user(("Viewer user"))

node_user -->|"controls view"| node_ui
node_ui -->|"renders view"| node_renderer
node_renderer -->|"colors pixels"| node_coloring
node_coloring -->|"selects colors"| node_palettes
node_browser_exports -->|"exports"| node_renderer
node_browser_exports -->|"exports"| node_palettes
node_browser_exports -->|"exports"| node_ui
node_http_server -->|"renders PNG"| node_renderer

click node_ui "https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/static/js/ui.js"
click node_browser_exports "https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/static/js/index.js"
click node_renderer "https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/graphics/renderer.js"
click node_coloring "https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/graphics/coloring-method.js"
click node_palettes "https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/graphics/palette.js"
click node_http_server "https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/index.js"

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_ui,node_browser_exports,node_user toneBlue
class node_renderer,node_coloring,node_palettes toneAmber
class node_http_server toneMint
```

## Components

### Viewer interface

- [View controls](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/static/js/ui.js): `src/static/js/ui.js`
- [Browser exports](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/static/js/index.js): `src/static/js/index.js`

### Fractal rendering

- [Canvas renderer](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/graphics/renderer.js): `src/graphics/renderer.js`
- [Coloring algorithms](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/graphics/coloring-method.js): `src/graphics/coloring-method.js`
- [Color palettes](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/graphics/palette.js): `src/graphics/palette.js`

### HTTP rendering

- [Render routes](https://github.com/christophergorexyz/mandelbrot-viewer/blob/main/src/index.js): `src/index.js`

### Other components

- **Viewer user**

## Connections

- Viewer user → View controls: controls view (evidence: `src/static/js/ui.js`)
- View controls → Canvas renderer: renders view (evidence: `src/static/js/ui.js`)
- Canvas renderer → Coloring algorithms: colors pixels (evidence: `src/graphics/renderer.js`)
- Coloring algorithms → Color palettes: selects colors (evidence: `src/graphics/coloring-method.js`)
- Browser exports → Canvas renderer: exports (evidence: `src/static/js/index.js`)
- Browser exports → Color palettes: exports (evidence: `src/static/js/index.js`)
- Browser exports → View controls: exports (evidence: `src/static/js/index.js`)
- Render routes → Canvas renderer: renders PNG (evidence: `src/index.js`)
