# jlevy/squares architecture

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

- Interactive diagram: https://gitdiagram.com/jlevy/squares
- Repository: https://github.com/jlevy/squares

## Overview

The repository’s main product is The Squares Project: a research record and generated public archive of square-packing results, supported by search, verification, and visualization tools. Its README describes the record-to-website and reported-result review workflows; sampled source also exposes a browser workbench for configuring, simulating, assessing, and rendering packings. The graph keeps these product areas distinct. Some research subsystems are represented at directory level because their implementation was not sampled.

Main entry points: [`packing`](https://github.com/jlevy/squares/tree/main/packing) (Project record), [`packages/workbench/src/app/pack-panel.ts`](https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/pack-panel.ts) (Pack controls), [`packages/workbench/src/app/pack-controller.ts`](https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/pack-controller.ts) (Pack controller), [`packages/workbench/src/app/animation-panel.ts`](https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/animation-panel.ts) (Animation editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_records["Research records"]
  node_record["Project record"]
  node_frontier["Case frontier"]
  node_atlas["Packing atlas"]
  node_website["Project website"]
end

subgraph group_research["Research workflows"]
  node_result_report["Result report"]
  node_validation["Result validation"]
  node_search["Packing search<br/>[search.rs]"]
  node_exact_verify["Exact verification<br/>[lib.rs]"]
end

subgraph group_workbench["Browser workbench"]
  node_pack_panel["Pack controls<br/>[pack-panel.ts]"]
  node_animation_panel["Animation editor<br/>[animation-panel.ts]"]
  node_page_entry["Workbench page<br/>[application.js]"]
end

subgraph group_runtime["Workbench runtime"]
  node_pack_controller["Pack controller<br/>[pack-controller.ts]"]
  node_pack_api["Pack API<br/>[pack-api.ts]"]
  node_pack_simulation["Pack simulation<br/>[pack.ts]"]
  node_resolver["Packing resolver<br/>[resolve.ts]"]
  node_geometry["Geometry contracts<br/>[geometry.ts]"]
  node_contracts["Validity contracts"]
  node_stage["Stage renderer<br/>[stage-renderer.ts]"]
  node_pack_scene["Packing scene<br/>[pack-scene.ts]"]
  node_animation_scene["Animation scene<br/>[animation-scene.ts]"]
end

node_researcher(("Researchers"))
node_browser_user(("Workbench user"))

node_researcher -->|"registers results"| node_record
node_record -->|"generates archive"| node_website
node_record -->|"tracks case bounds"| node_frontier
node_record -->|"records packings"| node_atlas
node_researcher -->|"reports findings"| node_result_report
node_result_report -->|"is checked by"| node_validation
node_validation -.->|"validates and cites"| node_record
node_search -.->|"hands off candidates"| node_exact_verify
node_browser_user -->|"configures packing"| node_pack_panel
node_page_entry -->|"loads panel"| node_pack_panel
node_page_entry -->|"loads panel"| node_animation_panel
node_pack_panel -->|"controls session"| node_pack_controller
node_pack_panel -->|"paints snapshot"| node_pack_scene
node_pack_panel -->|"renders targets"| node_stage
node_pack_controller -->|"parses snapshots"| node_pack_api
node_pack_controller -->|"creates and steps"| node_pack_simulation
node_pack_controller -->|"resolves packing"| node_resolver
node_pack_simulation -->|"measures geometry"| node_geometry
node_pack_simulation -->|"assesses snapshot"| node_contracts
node_animation_panel -->|"paints sample"| node_animation_scene
node_animation_panel -->|"renders targets"| node_stage

click node_record "https://github.com/jlevy/squares/tree/main/packing"
click node_frontier "https://github.com/jlevy/squares/tree/main/packing/frontier"
click node_atlas "https://github.com/jlevy/squares/tree/main/packing/atlas"
click node_validation "https://github.com/jlevy/squares/tree/main/packing/src/sqpack"
click node_search "https://github.com/jlevy/squares/blob/main/packing/sqsearch/src/search.rs"
click node_exact_verify "https://github.com/jlevy/squares/blob/main/packing/sqverify_exact/src/lib.rs"
click node_pack_panel "https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/pack-panel.ts"
click node_animation_panel "https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/animation-panel.ts"
click node_page_entry "https://github.com/jlevy/squares/blob/main/packages/workbench/src/application.js"
click node_pack_controller "https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/pack-controller.ts"
click node_pack_api "https://github.com/jlevy/squares/blob/main/packages/workbench/src/api/pack-api.ts"
click node_pack_simulation "https://github.com/jlevy/squares/blob/main/packages/workbench/src/simulation/pack.ts"
click node_resolver "https://github.com/jlevy/squares/blob/main/packages/workbench/src/simulation/resolve.ts"
click node_geometry "https://github.com/jlevy/squares/blob/main/packages/workbench/src/core/geometry.ts"
click node_contracts "https://github.com/jlevy/squares/blob/main/packages/workbench/src/core/runtime-contracts.ts"
click node_stage "https://github.com/jlevy/squares/blob/main/packages/workbench/src/view/stage-renderer.ts"
click node_pack_scene "https://github.com/jlevy/squares/blob/main/packages/workbench/src/view/pack-scene.ts"
click node_animation_scene "https://github.com/jlevy/squares/blob/main/packages/workbench/src/view/animation-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_record,node_frontier,node_atlas,node_website,node_browser_user toneBlue
class node_result_report,node_validation,node_search,node_exact_verify toneAmber
class node_pack_panel,node_animation_panel,node_page_entry toneMint
class node_pack_controller,node_pack_api,node_pack_simulation,node_resolver,node_geometry,node_contracts,node_stage,node_pack_scene,node_animation_scene toneRose
class node_researcher toneIndigo
```

## Components

### Research records

- [Project record](https://github.com/jlevy/squares/tree/main/packing): `packing`
- [Case frontier](https://github.com/jlevy/squares/tree/main/packing/frontier): `packing/frontier`
- [Packing atlas](https://github.com/jlevy/squares/tree/main/packing/atlas): `packing/atlas`
- **Project website**

### Research workflows

- **Result report**
- [Result validation](https://github.com/jlevy/squares/tree/main/packing/src/sqpack): `packing/src/sqpack`
- [Packing search](https://github.com/jlevy/squares/blob/main/packing/sqsearch/src/search.rs): `packing/sqsearch/src/search.rs`
- [Exact verification](https://github.com/jlevy/squares/blob/main/packing/sqverify_exact/src/lib.rs): `packing/sqverify_exact/src/lib.rs`

### Browser workbench

- [Pack controls](https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/pack-panel.ts): `packages/workbench/src/app/pack-panel.ts`
- [Animation editor](https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/animation-panel.ts): `packages/workbench/src/app/animation-panel.ts`
- [Workbench page](https://github.com/jlevy/squares/blob/main/packages/workbench/src/application.js): `packages/workbench/src/application.js`

### Workbench runtime

- [Pack controller](https://github.com/jlevy/squares/blob/main/packages/workbench/src/app/pack-controller.ts): `packages/workbench/src/app/pack-controller.ts`
- [Pack API](https://github.com/jlevy/squares/blob/main/packages/workbench/src/api/pack-api.ts): `packages/workbench/src/api/pack-api.ts`
- [Pack simulation](https://github.com/jlevy/squares/blob/main/packages/workbench/src/simulation/pack.ts): `packages/workbench/src/simulation/pack.ts`
- [Packing resolver](https://github.com/jlevy/squares/blob/main/packages/workbench/src/simulation/resolve.ts): `packages/workbench/src/simulation/resolve.ts`
- [Geometry contracts](https://github.com/jlevy/squares/blob/main/packages/workbench/src/core/geometry.ts): `packages/workbench/src/core/geometry.ts`
- [Validity contracts](https://github.com/jlevy/squares/blob/main/packages/workbench/src/core/runtime-contracts.ts): `packages/workbench/src/core/runtime-contracts.ts`
- [Stage renderer](https://github.com/jlevy/squares/blob/main/packages/workbench/src/view/stage-renderer.ts): `packages/workbench/src/view/stage-renderer.ts`
- [Packing scene](https://github.com/jlevy/squares/blob/main/packages/workbench/src/view/pack-scene.ts): `packages/workbench/src/view/pack-scene.ts`
- [Animation scene](https://github.com/jlevy/squares/blob/main/packages/workbench/src/view/animation-scene.ts): `packages/workbench/src/view/animation-scene.ts`

### Other components

- **Researchers**
- **Workbench user**

## Connections

- Researchers → Project record: registers results (evidence: `README.md`)
- Project record → Project website: generates archive (evidence: `README.md`)
- Project record → Case frontier: tracks case bounds (evidence: `README.md`)
- Project record → Packing atlas: records packings (evidence: `README.md`)
- Researchers → Result report: reports findings (evidence: `README.md`)
- Result report → Result validation: is checked by (evidence: `README.md`)
- Result validation → Project record: validates and cites (evidence: `packing/src/sqpack/fractional/threshold_coverage_encoding.py`)
- Packing search → Exact verification: hands off candidates
- Workbench user → Pack controls: configures packing (evidence: `packages/workbench/src/app/pack-panel.ts`)
- Workbench page → Pack controls: loads panel (evidence: `packages/workbench/src/application.js`)
- Workbench page → Animation editor: loads panel (evidence: `packages/workbench/src/application.js`)
- Pack controls → Pack controller: controls session (evidence: `packages/workbench/src/app/pack-panel.ts`)
- Pack controls → Packing scene: paints snapshot (evidence: `packages/workbench/src/app/pack-panel.ts`)
- Pack controls → Stage renderer: renders targets (evidence: `packages/workbench/src/app/pack-panel.ts`)
- Pack controller → Pack API: parses snapshots (evidence: `packages/workbench/src/app/pack-controller.ts`)
- Pack controller → Pack simulation: creates and steps (evidence: `packages/workbench/src/app/pack-controller.ts`)
- Pack controller → Packing resolver: resolves packing (evidence: `packages/workbench/src/app/pack-controller.ts`)
- Pack simulation → Geometry contracts: measures geometry (evidence: `packages/workbench/src/simulation/pack.ts`)
- Pack simulation → Validity contracts: assesses snapshot (evidence: `packages/workbench/src/simulation/pack.ts`)
- Animation editor → Animation scene: paints sample (evidence: `packages/workbench/src/app/animation-panel.ts`)
- Animation editor → Stage renderer: renders targets (evidence: `packages/workbench/src/app/animation-panel.ts`)
