# eddyvn98/gridcraft architecture

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

- Interactive diagram: https://gitdiagram.com/eddyvn98/gridcraft
- Repository: https://github.com/eddyvn98/gridcraft

## Overview

GridCraft is a Rust spreadsheet application for desktop and browser, with headless CLI and agent-control interfaces. The principal workflow is to open or create a workbook, edit cells and features through the UI or commands, calculate formulas, and save or export the result. The graph includes documented spreadsheet capabilities and the major runtime interfaces. Source excerpts are incomplete, so edges are limited to relationships stated in the README or shown by the source index; unsampled internals are not assumed to call one another.

Main entry points: [`crates/engine/src/io.rs`](https://github.com/eddyvn98/gridcraft/blob/main/crates/engine/src/io.rs) (Workbook engine), [`crates/engine/src/cmd`](https://github.com/eddyvn98/gridcraft/tree/main/crates/engine/src/cmd) (Workbook commands), [`crates/model/src/workbook.rs`](https://github.com/eddyvn98/gridcraft/blob/main/crates/model/src/workbook.rs) (Workbook model), [`crates/ui-egui/src/grid.rs`](https://github.com/eddyvn98/gridcraft/blob/main/crates/ui-egui/src/grid.rs) (Spreadsheet UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_desktop["Desktop app<br/>[main.rs]"]
  node_web["Browser app<br/>[main.rs]"]
  node_ui["Spreadsheet UI<br/>[grid.rs]"]
  node_cli["Headless CLI<br/>[main.rs]"]
end

subgraph group_workbook["Workbook operations"]
  node_commands["Workbook commands"]
  node_engine["Workbook engine<br/>[io.rs]"]
  node_model["Workbook model<br/>[workbook.rs]"]
end

subgraph group_calculation["Calculation and display"]
  node_formula["Formula parsing<br/>[parser.rs]"]
  node_calc["Recalculation<br/>[recalc.rs]"]
  node_evaluation["Formula evaluation<br/>[eval.rs]"]
  node_functions["Worksheet functions<br/>[lookup.rs]"]
  node_numberformats["Number formatting<br/>[render.rs]"]
  node_charts["Chart rendering<br/>[render.rs]"]
end

subgraph group_formats["File formats"]
  node_xlsxread["Workbook import<br/>[read.rs]"]
  node_xlsimport["Legacy XLS import<br/>[mod.rs]"]
  node_xlsxwrite["Workbook export<br/>[write.rs]"]
  node_pivotformat["PivotTable format<br/>[pivot.rs]"]
  node_pdf["PDF export<br/>[lib.rs]"]
end

subgraph group_agents["Agent access"]
  node_mcp["MCP server<br/>[server.rs]"]
end

node_actor(("Spreadsheet user"))
node_agent(("Automation agent"))

node_actor -->|"uses"| node_desktop
node_actor -->|"uses"| node_web
node_actor -->|"runs"| node_cli
node_desktop -->|"runs"| node_ui
node_web -->|"runs"| node_ui
node_ui -->|"issues commands"| node_commands
node_cli -->|"runs commands"| node_commands
node_commands -.->|"edits workbook"| node_engine
node_engine -.->|"updates workbook"| node_model
node_formula -.->|"parses for"| node_calc
node_calc -.->|"recalculates with"| node_evaluation
node_evaluation -.->|"evaluates functions"| node_functions
node_model -.->|"formats values"| node_numberformats
node_model -.->|"renders charts"| node_charts
node_engine -->|"opens workbooks"| node_xlsxread
node_engine -->|"saves workbooks"| node_xlsxwrite
node_xlsxread -->|"reads pivot data"| node_pivotformat
node_engine -->|"imports XLS"| node_xlsimport
node_engine -->|"exports PDF"| node_pdf
node_agent -->|"sends MCP requests"| node_mcp
node_mcp -.->|"runs commands"| node_commands
node_agent -->|"runs automation"| node_cli

click node_desktop "https://github.com/eddyvn98/gridcraft/blob/main/apps/gridcraft/src/main.rs"
click node_web "https://github.com/eddyvn98/gridcraft/blob/main/apps/gridcraft-web/src/main.rs"
click node_ui "https://github.com/eddyvn98/gridcraft/blob/main/crates/ui-egui/src/grid.rs"
click node_cli "https://github.com/eddyvn98/gridcraft/blob/main/apps/gridcraft-cli/src/main.rs"
click node_commands "https://github.com/eddyvn98/gridcraft/tree/main/crates/engine/src/cmd"
click node_engine "https://github.com/eddyvn98/gridcraft/blob/main/crates/engine/src/io.rs"
click node_model "https://github.com/eddyvn98/gridcraft/blob/main/crates/model/src/workbook.rs"
click node_formula "https://github.com/eddyvn98/gridcraft/blob/main/crates/formula/src/parser.rs"
click node_calc "https://github.com/eddyvn98/gridcraft/blob/main/crates/calc/src/recalc.rs"
click node_evaluation "https://github.com/eddyvn98/gridcraft/blob/main/crates/calc/src/eval.rs"
click node_functions "https://github.com/eddyvn98/gridcraft/blob/main/crates/functions/src/lookup.rs"
click node_numberformats "https://github.com/eddyvn98/gridcraft/blob/main/crates/numfmt/src/render.rs"
click node_charts "https://github.com/eddyvn98/gridcraft/blob/main/crates/chart/src/render.rs"
click node_xlsxread "https://github.com/eddyvn98/gridcraft/blob/main/crates/xlsx/src/read.rs"
click node_xlsimport "https://github.com/eddyvn98/gridcraft/blob/main/crates/xlsx/src/xls/mod.rs"
click node_xlsxwrite "https://github.com/eddyvn98/gridcraft/blob/main/crates/xlsx/src/write.rs"
click node_pivotformat "https://github.com/eddyvn98/gridcraft/blob/main/crates/xlsx/src/pivot.rs"
click node_pdf "https://github.com/eddyvn98/gridcraft/blob/main/crates/pdf/src/lib.rs"
click node_mcp "https://github.com/eddyvn98/gridcraft/blob/main/crates/mcp/src/server.rs"

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_desktop,node_web,node_ui,node_cli,node_actor toneBlue
class node_commands,node_engine,node_model toneAmber
class node_formula,node_calc,node_evaluation,node_functions,node_numberformats,node_charts toneMint
class node_xlsxread,node_xlsimport,node_xlsxwrite,node_pivotformat,node_pdf toneRose
class node_mcp,node_agent toneIndigo
```

## Components

### User interfaces

- [Desktop app](https://github.com/eddyvn98/gridcraft/blob/main/apps/gridcraft/src/main.rs): `apps/gridcraft/src/main.rs`
- [Browser app](https://github.com/eddyvn98/gridcraft/blob/main/apps/gridcraft-web/src/main.rs): `apps/gridcraft-web/src/main.rs`
- [Spreadsheet UI](https://github.com/eddyvn98/gridcraft/blob/main/crates/ui-egui/src/grid.rs): `crates/ui-egui/src/grid.rs`
- [Headless CLI](https://github.com/eddyvn98/gridcraft/blob/main/apps/gridcraft-cli/src/main.rs): `apps/gridcraft-cli/src/main.rs`

### Workbook operations

- [Workbook commands](https://github.com/eddyvn98/gridcraft/tree/main/crates/engine/src/cmd): `crates/engine/src/cmd`
- [Workbook engine](https://github.com/eddyvn98/gridcraft/blob/main/crates/engine/src/io.rs): `crates/engine/src/io.rs`
- [Workbook model](https://github.com/eddyvn98/gridcraft/blob/main/crates/model/src/workbook.rs): `crates/model/src/workbook.rs`

### Calculation and display

- [Formula parsing](https://github.com/eddyvn98/gridcraft/blob/main/crates/formula/src/parser.rs): `crates/formula/src/parser.rs`
- [Recalculation](https://github.com/eddyvn98/gridcraft/blob/main/crates/calc/src/recalc.rs): `crates/calc/src/recalc.rs`
- [Formula evaluation](https://github.com/eddyvn98/gridcraft/blob/main/crates/calc/src/eval.rs): `crates/calc/src/eval.rs`
- [Worksheet functions](https://github.com/eddyvn98/gridcraft/blob/main/crates/functions/src/lookup.rs): `crates/functions/src/lookup.rs`
- [Number formatting](https://github.com/eddyvn98/gridcraft/blob/main/crates/numfmt/src/render.rs): `crates/numfmt/src/render.rs`
- [Chart rendering](https://github.com/eddyvn98/gridcraft/blob/main/crates/chart/src/render.rs): `crates/chart/src/render.rs`

### File formats

- [Workbook import](https://github.com/eddyvn98/gridcraft/blob/main/crates/xlsx/src/read.rs): `crates/xlsx/src/read.rs`
- [Legacy XLS import](https://github.com/eddyvn98/gridcraft/blob/main/crates/xlsx/src/xls/mod.rs): `crates/xlsx/src/xls/mod.rs`
- [Workbook export](https://github.com/eddyvn98/gridcraft/blob/main/crates/xlsx/src/write.rs): `crates/xlsx/src/write.rs`
- [PivotTable format](https://github.com/eddyvn98/gridcraft/blob/main/crates/xlsx/src/pivot.rs): `crates/xlsx/src/pivot.rs`
- [PDF export](https://github.com/eddyvn98/gridcraft/blob/main/crates/pdf/src/lib.rs): `crates/pdf/src/lib.rs`

### Agent access

- [MCP server](https://github.com/eddyvn98/gridcraft/blob/main/crates/mcp/src/server.rs): `crates/mcp/src/server.rs`

### Other components

- **Spreadsheet user**
- **Automation agent**

## Connections

- Spreadsheet user → Desktop app: uses
- Spreadsheet user → Browser app: uses
- Spreadsheet user → Headless CLI: runs
- Desktop app → Spreadsheet UI: runs (evidence: `apps/gridcraft/src/main.rs`)
- Browser app → Spreadsheet UI: runs (evidence: `apps/gridcraft-web/src/main.rs`)
- Spreadsheet UI → Workbook commands: issues commands
- Headless CLI → Workbook commands: runs commands (evidence: `apps/gridcraft-cli/src/main.rs`)
- Workbook commands → Workbook engine: edits workbook
- Workbook engine → Workbook model: updates workbook
- Formula parsing → Recalculation: parses for
- Recalculation → Formula evaluation: recalculates with
- Formula evaluation → Worksheet functions: evaluates functions
- Workbook model → Number formatting: formats values
- Workbook model → Chart rendering: renders charts
- Workbook engine → Workbook import: opens workbooks
- Workbook engine → Workbook export: saves workbooks
- Workbook import → PivotTable format: reads pivot data (evidence: `crates/xlsx/src/read.rs`)
- Workbook engine → Legacy XLS import: imports XLS
- Workbook engine → PDF export: exports PDF
- Automation agent → MCP server: sends MCP requests
- MCP server → Workbook commands: runs commands
- Automation agent → Headless CLI: runs automation
