# selfish6310/brutalism-building-maker architecture

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

- Interactive diagram: https://gitdiagram.com/selfish6310/brutalism-building-maker
- Repository: https://github.com/selfish6310/brutalism-building-maker

## Overview

BRUTAL-GEN is a browser-based seeded 3D brutalist-building generator. The main workflow is: a user edits a seed or design controls, the app parses and updates generator state, composition and typology code produce building masses and facade parts, and the renderer displays the result. The UI also supports shareable URL state and locally saved cast history. The graph follows the sampled entry point and generation modules; some rendering and typology internals are unsampled, so their finer relationships are omitted.

Main entry points: [`src/main.ts`](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/main.ts) (App coordinator), [`src/gen/combine.ts`](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/combine.ts) (Site composition), [`src/gen/index.ts`](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/index.ts) (Generation entry), [`src/ui/panel.ts`](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/ui/panel.ts) (Control panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App workflow"]
  node_app["App coordinator<br/>[main.ts]"]
  node_panel["Control panel<br/>[panel.ts]"]
end

subgraph group_generation["Building generation"]
  node_rng["Seeded randomness<br/>[rng.ts]"]
  node_generator["Generation entry<br/>[index.ts]"]
  node_composition["Site composition<br/>[combine.ts]"]
  node_housing["Housing typology<br/>[housing.ts]"]
  node_civic["Civic typology<br/>[civic.ts]"]
  node_tower["Tower typology<br/>[tower.ts]"]
  node_mega["Mega typology<br/>[mega.ts]"]
  node_facade["Facade casting<br/>[facade.ts]"]
  node_geometry["Geometry helpers<br/>[util.ts]"]
  node_building["Building model<br/>[types.ts]"]
end

subgraph group_geometry["Geometry and rendering"]
  node_object["3D object builder<br/>[build.ts]"]
  node_scene["3D stage<br/>[scene.ts]"]
end

subgraph group_state["State and history"]
  node_params["Generator state<br/>[params.ts]"]
  node_history["Cast history<br/>[history.ts]"]
  node_browser[("Browser storage")]
end

node_user(("Viewer"))
node_screen["Rendered building"]

node_user -->|"edits controls"| node_panel
node_panel -->|"sends actions"| node_app
node_app -->|"updates state"| node_params
node_app -->|"loads and saves"| node_history
node_history -->|"reads and writes"| node_browser
node_app -->|"generates building"| node_generator
node_generator -->|"composes buildings"| node_composition
node_composition -->|"dispatches typology"| node_housing
node_composition -->|"dispatches typology"| node_civic
node_composition -->|"dispatches typology"| node_tower
node_composition -->|"dispatches typology"| node_mega
node_generator -->|"casts facades"| node_facade
node_housing -->|"builds geometry"| node_geometry
node_civic -->|"builds geometry"| node_geometry
node_composition -->|"builds links"| node_geometry
node_generator -->|"creates streams"| node_rng
node_generator -->|"returns building"| node_building
node_app -->|"builds render object"| node_object
node_app -->|"shows object"| node_scene
node_object -->|"reads building data"| node_building
node_scene -->|"renders stage"| node_screen
node_panel -->|"recalls entries"| node_history

click node_app "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/main.ts"
click node_panel "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/ui/panel.ts"
click node_params "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/params.ts"
click node_history "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/ui/history.ts"
click node_rng "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/rng.ts"
click node_generator "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/index.ts"
click node_composition "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/combine.ts"
click node_housing "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/housing.ts"
click node_civic "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/civic.ts"
click node_tower "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/tower.ts"
click node_mega "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/mega.ts"
click node_facade "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/facade.ts"
click node_geometry "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/util.ts"
click node_building "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/types.ts"
click node_object "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/render/build.ts"
click node_scene "https://github.com/selfish6310/brutalism-building-maker/blob/main/src/render/scene.ts"

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_panel,node_user toneBlue
class node_rng,node_generator,node_composition,node_housing,node_civic,node_tower,node_mega,node_facade,node_geometry,node_building toneAmber
class node_object,node_scene toneMint
class node_params,node_history,node_browser toneRose
class node_screen toneIndigo
```

## Components

### App workflow

- [App coordinator](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/main.ts): `src/main.ts`
- [Control panel](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/ui/panel.ts): `src/ui/panel.ts`

### Building generation

- [Seeded randomness](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/rng.ts): `src/rng.ts`
- [Generation entry](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/index.ts): `src/gen/index.ts`
- [Site composition](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/combine.ts): `src/gen/combine.ts`
- [Housing typology](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/housing.ts): `src/gen/housing.ts`
- [Civic typology](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/civic.ts): `src/gen/civic.ts`
- [Tower typology](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/tower.ts): `src/gen/tower.ts`
- [Mega typology](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/mega.ts): `src/gen/mega.ts`
- [Facade casting](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/facade.ts): `src/gen/facade.ts`
- [Geometry helpers](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/util.ts): `src/gen/util.ts`
- [Building model](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/gen/types.ts): `src/gen/types.ts`

### Geometry and rendering

- [3D object builder](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/render/build.ts): `src/render/build.ts`
- [3D stage](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/render/scene.ts): `src/render/scene.ts`

### State and history

- [Generator state](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/params.ts): `src/params.ts`
- [Cast history](https://github.com/selfish6310/brutalism-building-maker/blob/main/src/ui/history.ts): `src/ui/history.ts`
- **Browser storage**

### Other components

- **Viewer**
- **Rendered building**

## Connections

- Viewer → Control panel: edits controls (evidence: `src/ui/panel.ts`)
- Control panel → App coordinator: sends actions (evidence: `src/main.ts`)
- App coordinator → Generator state: updates state (evidence: `src/main.ts`)
- App coordinator → Cast history: loads and saves (evidence: `src/main.ts`)
- Cast history → Browser storage: reads and writes (evidence: `src/ui/history.ts`)
- App coordinator → Generation entry: generates building (evidence: `src/main.ts`)
- Generation entry → Site composition: composes buildings (evidence: `src/gen/index.ts`)
- Site composition → Housing typology: dispatches typology (evidence: `src/gen/combine.ts`)
- Site composition → Civic typology: dispatches typology (evidence: `src/gen/combine.ts`)
- Site composition → Tower typology: dispatches typology (evidence: `src/gen/combine.ts`)
- Site composition → Mega typology: dispatches typology (evidence: `src/gen/combine.ts`)
- Generation entry → Facade casting: casts facades (evidence: `src/gen/index.ts`)
- Housing typology → Geometry helpers: builds geometry (evidence: `src/gen/housing.ts`)
- Civic typology → Geometry helpers: builds geometry (evidence: `src/gen/civic.ts`)
- Site composition → Geometry helpers: builds links (evidence: `src/gen/combine.ts`)
- Generation entry → Seeded randomness: creates streams (evidence: `src/gen/index.ts`)
- Generation entry → Building model: returns building (evidence: `src/gen/index.ts`)
- App coordinator → 3D object builder: builds render object (evidence: `src/main.ts`)
- App coordinator → 3D stage: shows object (evidence: `src/main.ts`)
- 3D object builder → Building model: reads building data (evidence: `src/render/build.ts`)
- 3D stage → Rendered building: renders stage
- Control panel → Cast history: recalls entries (evidence: `src/ui/panel.ts`)
