# ibreez/cut-panels-optimizer architecture

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

- Interactive diagram: https://gitdiagram.com/ibreez/cut-panels-optimizer
- Repository: https://github.com/ibreez/cut-panels-optimizer

## Overview

Cut-Panels-Optimizer is a client-side panel-nesting tool. Users enter stock dimensions and panel sizes/quantities, request an optimization, inspect the resulting sheet layouts, and export them as PDF or PNG. The main page owns workflow state and invokes the packing algorithm; separate components handle login, input, canvas rendering, and export. The README describes minimizing waste, while the sampled optimizer uses area sorting and placement heuristics. Authentication is local to the app; no backend or persistent storage is evidenced in the sampled files.

Main entry points: [`app/page.tsx`](https://github.com/ibreez/cut-panels-optimizer/blob/main/app/page.tsx) (Optimizer page), [`components/login-page.tsx`](https://github.com/ibreez/cut-panels-optimizer/blob/main/components/login-page.tsx) (Login form), [`components/panel-form.tsx`](https://github.com/ibreez/cut-panels-optimizer/blob/main/components/panel-form.tsx) (Panel input), [`utils/optimizer.ts`](https://github.com/ibreez/cut-panels-optimizer/blob/main/utils/optimizer.ts) (Packing optimizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access"]
  node_login["Login form<br/>[login-page.tsx]"]
  node_workflow["Optimizer page<br/>[page.tsx]"]
end

subgraph group_cutting["Cut planning"]
  node_panel_form["Panel input<br/>[panel-form.tsx]"]
  node_algorithm["Packing optimizer<br/>[optimizer.ts]"]
end

subgraph group_results["Results"]
  node_viewer["Layout viewer<br/>[layout-viewer.tsx]"]
  node_export["Image and PDF export<br/>[export-buttons.tsx]"]
end

subgraph group_model["Domain model"]
  node_types["Layout data types<br/>[types.ts]"]
end

node_user(("User"))
node_download["Browser downloads"]

node_user -->|"enters credentials"| node_login
node_login -->|"reports login"| node_workflow
node_user -->|"enters dimensions"| node_panel_form
node_panel_form -->|"submits panels"| node_workflow
node_workflow -->|"optimizes panels"| node_algorithm
node_algorithm -->|"returns layouts"| node_workflow
node_workflow -->|"passes selected sheet"| node_viewer
node_workflow -->|"passes layouts"| node_export
node_export -->|"saves files"| node_download

click node_login "https://github.com/ibreez/cut-panels-optimizer/blob/main/components/login-page.tsx"
click node_workflow "https://github.com/ibreez/cut-panels-optimizer/blob/main/app/page.tsx"
click node_panel_form "https://github.com/ibreez/cut-panels-optimizer/blob/main/components/panel-form.tsx"
click node_algorithm "https://github.com/ibreez/cut-panels-optimizer/blob/main/utils/optimizer.ts"
click node_types "https://github.com/ibreez/cut-panels-optimizer/blob/main/types.ts"
click node_viewer "https://github.com/ibreez/cut-panels-optimizer/blob/main/components/layout-viewer.tsx"
click node_export "https://github.com/ibreez/cut-panels-optimizer/blob/main/components/export-buttons.tsx"

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_login,node_workflow,node_user,node_download toneBlue
class node_panel_form,node_algorithm toneAmber
class node_viewer,node_export toneMint
class node_types toneRose
```

## Components

### Access

- [Login form](https://github.com/ibreez/cut-panels-optimizer/blob/main/components/login-page.tsx): `components/login-page.tsx`
- [Optimizer page](https://github.com/ibreez/cut-panels-optimizer/blob/main/app/page.tsx): `app/page.tsx`

### Cut planning

- [Panel input](https://github.com/ibreez/cut-panels-optimizer/blob/main/components/panel-form.tsx): `components/panel-form.tsx`
- [Packing optimizer](https://github.com/ibreez/cut-panels-optimizer/blob/main/utils/optimizer.ts): `utils/optimizer.ts`

### Results

- [Layout viewer](https://github.com/ibreez/cut-panels-optimizer/blob/main/components/layout-viewer.tsx): `components/layout-viewer.tsx`
- [Image and PDF export](https://github.com/ibreez/cut-panels-optimizer/blob/main/components/export-buttons.tsx): `components/export-buttons.tsx`

### Domain model

- [Layout data types](https://github.com/ibreez/cut-panels-optimizer/blob/main/types.ts): `types.ts`

### Other components

- **User**
- **Browser downloads**

## Connections

- User → Login form: enters credentials (evidence: `components/login-page.tsx`)
- Login form → Optimizer page: reports login (evidence: `app/page.tsx`)
- User → Panel input: enters dimensions (evidence: `components/panel-form.tsx`)
- Panel input → Optimizer page: submits panels (evidence: `app/page.tsx`)
- Optimizer page → Packing optimizer: optimizes panels (evidence: `app/page.tsx`)
- Packing optimizer → Optimizer page: returns layouts (evidence: `app/page.tsx`)
- Optimizer page → Layout viewer: passes selected sheet (evidence: `app/page.tsx`)
- Optimizer page → Image and PDF export: passes layouts (evidence: `app/page.tsx`)
- Image and PDF export → Browser downloads: saves files (evidence: `components/export-buttons.tsx`)
