# troazz/notecal architecture

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

- Interactive diagram: https://gitdiagram.com/troazz/notecal
- Repository: https://github.com/troazz/notecal

## Overview

notecal is a cross-platform calculator notepad: users edit plain-text notes, see line-by-line calculation results, and have notes saved automatically. The main path runs from the editor through the Tauri command bridge to the evaluation engine; separate branches manage note files, settings, rates, themes, onboarding, and updates. The CLI provides a second evaluation entry point. Some wiring is only documented or lies in unsampled excerpts, so those relationships are marked unverified rather than inferred as direct calls.

Main entry points: [`src-tauri/src/commands.rs`](https://github.com/troazz/notecal/blob/main/src-tauri/src/commands.rs) (Command bridge), [`crates/notecal-core/src/lib.rs`](https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/lib.rs) (Expression engine), [`src-tauri/src/main.rs`](https://github.com/troazz/notecal/blob/main/src-tauri/src/main.rs) (Tauri runtime), [`ui/src/Editor.svelte`](https://github.com/troazz/notecal/blob/main/ui/src/Editor.svelte) (Note editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_editor["Note editor<br/>[Editor.svelte]"]
  node_editor_tools["Editor features"]
  node_app["App shell<br/>[App.svelte]"]
  node_switcher["Note switcher<br/>[Switcher.svelte]"]
  node_session["Note session<br/>[session.ts]"]
  node_onboarding["First-run setup<br/>[Onboarding.svelte]"]
  node_settings_ui["Settings screen<br/>[Settings.svelte]"]
  node_localization["Interface language<br/>[i18n.svelte.ts]"]
end

subgraph group_backend["Application services"]
  node_tauri["Tauri runtime<br/>[main.rs]"]
  node_commands["Command bridge<br/>[commands.rs]"]
  node_evaluator_service["Evaluation service<br/>[evaluator.rs]"]
  node_notes[("Note storage<br/>[notes.rs]")]
  node_watcher["Disk change watcher<br/>[watch.rs]"]
  node_theme_service["Theme service<br/>[theme.rs]"]
  node_pin["Window pinning<br/>[pin.rs]"]
  node_updates["Update checks<br/>[updates.rs]"]
end

subgraph group_engine["Calculation engine"]
  node_core["Expression engine<br/>[lib.rs]"]
  node_preprocess["Expression preprocessing<br/>[preprocess.rs]"]
  node_dates["Dates and zones<br/>[datetime.rs]"]
  node_zone_aliases["Zone aliases<br/>[zones.rs]"]
  node_format["Result formatting<br/>[format.rs]"]
  node_cheatsheet["Calculation cheatsheet<br/>[cheatsheet.rs]"]
  node_cli["Command-line calculator<br/>[main.rs]"]
end

subgraph group_environment["User data and integrations"]
  node_settings["Settings and definitions<br/>[settings.rs]"]
  node_filesystem["Atomic file access<br/>[fs.rs]"]
  node_rates[("Cached exchange rates<br/>[rates.rs]")]
  node_rate_provider["Exchange-rate service"]
  node_external_themes["User and system themes<br/>[theme.rs]"]
end

node_user(("Notecal user"))

node_user -->|"edits notes"| node_editor
node_editor -->|"uses editor features"| node_editor_tools
node_app -->|"renders"| node_editor
node_editor -.->|"requests evaluation"| node_evaluator_service
node_evaluator_service -.->|"evaluates expressions"| node_core
node_core -->|"preprocesses input"| node_preprocess
node_core -->|"evaluates dates"| node_dates
node_dates -->|"resolves zones"| node_zone_aliases
node_core -->|"formats results"| node_format
node_user -->|"chooses notes"| node_switcher
node_switcher -->|"opens and switches"| node_session
node_session -.->|"loads and saves"| node_commands
node_commands -->|"manages note files"| node_notes
node_notes -->|"writes atomically"| node_filesystem
node_watcher -->|"reports disk changes"| node_commands
node_tauri -->|"registers commands"| node_commands
node_tauri -->|"initializes service"| node_evaluator_service
node_tauri -->|"initializes storage"| node_notes
node_settings_ui -.->|"updates settings"| node_commands
node_onboarding -->|"uses settings API"| node_settings_ui
node_commands -->|"loads and applies"| node_settings
node_settings -->|"derives engine settings"| node_core
node_commands -->|"resolves themes"| node_theme_service
node_user -->|"supplies palettes"| node_external_themes
node_theme_service -.->|"loads palettes"| node_external_themes
node_tauri -->|"starts window controls"| node_pin
node_tauri -->|"starts update checks"| node_updates
node_user -->|"enters calculation"| node_cli
node_cli -.->|"evaluates input"| node_core
node_core -->|"provides examples"| node_cheatsheet
node_switcher -.->|"searches examples"| node_cheatsheet
node_tauri -->|"loads cached rates"| node_rates
node_commands -.->|"fetches rates"| node_rate_provider
node_rates -->|"persists cache"| node_filesystem
node_app -->|"translates interface"| node_localization
node_onboarding -->|"translates setup"| node_localization

click node_editor "https://github.com/troazz/notecal/blob/main/ui/src/Editor.svelte"
click node_editor_tools "https://github.com/troazz/notecal/tree/main/ui/src/editor"
click node_app "https://github.com/troazz/notecal/blob/main/ui/src/App.svelte"
click node_switcher "https://github.com/troazz/notecal/blob/main/ui/src/notes/Switcher.svelte"
click node_session "https://github.com/troazz/notecal/blob/main/ui/src/notes/session.ts"
click node_onboarding "https://github.com/troazz/notecal/blob/main/ui/src/onboarding/Onboarding.svelte"
click node_settings_ui "https://github.com/troazz/notecal/blob/main/ui/src/settings/Settings.svelte"
click node_localization "https://github.com/troazz/notecal/blob/main/ui/src/i18n.svelte.ts"
click node_tauri "https://github.com/troazz/notecal/blob/main/src-tauri/src/main.rs"
click node_commands "https://github.com/troazz/notecal/blob/main/src-tauri/src/commands.rs"
click node_evaluator_service "https://github.com/troazz/notecal/blob/main/src-tauri/src/evaluator.rs"
click node_notes "https://github.com/troazz/notecal/blob/main/src-tauri/src/notes.rs"
click node_watcher "https://github.com/troazz/notecal/blob/main/src-tauri/src/watch.rs"
click node_theme_service "https://github.com/troazz/notecal/blob/main/src-tauri/src/theme.rs"
click node_pin "https://github.com/troazz/notecal/blob/main/src-tauri/src/pin.rs"
click node_updates "https://github.com/troazz/notecal/blob/main/src-tauri/src/updates.rs"
click node_core "https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/lib.rs"
click node_preprocess "https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/preprocess.rs"
click node_dates "https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/datetime.rs"
click node_zone_aliases "https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/datetime/zones.rs"
click node_format "https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/format.rs"
click node_cheatsheet "https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/cheatsheet.rs"
click node_cli "https://github.com/troazz/notecal/blob/main/crates/notecal-cli/src/main.rs"
click node_settings "https://github.com/troazz/notecal/blob/main/crates/notecal-env/src/settings.rs"
click node_filesystem "https://github.com/troazz/notecal/blob/main/crates/notecal-env/src/fs.rs"
click node_rates "https://github.com/troazz/notecal/blob/main/crates/notecal-env/src/rates.rs"
click node_external_themes "https://github.com/troazz/notecal/blob/main/src-tauri/src/theme.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_editor,node_editor_tools,node_app,node_switcher,node_session,node_onboarding,node_settings_ui,node_localization,node_user toneBlue
class node_tauri,node_commands,node_evaluator_service,node_notes,node_watcher,node_theme_service,node_pin,node_updates toneAmber
class node_core,node_preprocess,node_dates,node_zone_aliases,node_format,node_cheatsheet,node_cli toneMint
class node_settings,node_filesystem,node_rates,node_rate_provider,node_external_themes toneRose
```

## Components

### Desktop interface

- [Note editor](https://github.com/troazz/notecal/blob/main/ui/src/Editor.svelte): `ui/src/Editor.svelte`
- [Editor features](https://github.com/troazz/notecal/tree/main/ui/src/editor): `ui/src/editor`
- [App shell](https://github.com/troazz/notecal/blob/main/ui/src/App.svelte): `ui/src/App.svelte`
- [Note switcher](https://github.com/troazz/notecal/blob/main/ui/src/notes/Switcher.svelte): `ui/src/notes/Switcher.svelte`
- [Note session](https://github.com/troazz/notecal/blob/main/ui/src/notes/session.ts): `ui/src/notes/session.ts`
- [First-run setup](https://github.com/troazz/notecal/blob/main/ui/src/onboarding/Onboarding.svelte): `ui/src/onboarding/Onboarding.svelte`
- [Settings screen](https://github.com/troazz/notecal/blob/main/ui/src/settings/Settings.svelte): `ui/src/settings/Settings.svelte`
- [Interface language](https://github.com/troazz/notecal/blob/main/ui/src/i18n.svelte.ts): `ui/src/i18n.svelte.ts`

### Application services

- [Tauri runtime](https://github.com/troazz/notecal/blob/main/src-tauri/src/main.rs): `src-tauri/src/main.rs`
- [Command bridge](https://github.com/troazz/notecal/blob/main/src-tauri/src/commands.rs): `src-tauri/src/commands.rs`
- [Evaluation service](https://github.com/troazz/notecal/blob/main/src-tauri/src/evaluator.rs): `src-tauri/src/evaluator.rs`
- [Note storage](https://github.com/troazz/notecal/blob/main/src-tauri/src/notes.rs): `src-tauri/src/notes.rs`
- [Disk change watcher](https://github.com/troazz/notecal/blob/main/src-tauri/src/watch.rs): `src-tauri/src/watch.rs`
- [Theme service](https://github.com/troazz/notecal/blob/main/src-tauri/src/theme.rs): `src-tauri/src/theme.rs`
- [Window pinning](https://github.com/troazz/notecal/blob/main/src-tauri/src/pin.rs): `src-tauri/src/pin.rs`
- [Update checks](https://github.com/troazz/notecal/blob/main/src-tauri/src/updates.rs): `src-tauri/src/updates.rs`

### Calculation engine

- [Expression engine](https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/lib.rs): `crates/notecal-core/src/lib.rs`
- [Expression preprocessing](https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/preprocess.rs): `crates/notecal-core/src/preprocess.rs`
- [Dates and zones](https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/datetime.rs): `crates/notecal-core/src/datetime.rs`
- [Zone aliases](https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/datetime/zones.rs): `crates/notecal-core/src/datetime/zones.rs`
- [Result formatting](https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/format.rs): `crates/notecal-core/src/format.rs`
- [Calculation cheatsheet](https://github.com/troazz/notecal/blob/main/crates/notecal-core/src/cheatsheet.rs): `crates/notecal-core/src/cheatsheet.rs`
- [Command-line calculator](https://github.com/troazz/notecal/blob/main/crates/notecal-cli/src/main.rs): `crates/notecal-cli/src/main.rs`

### User data and integrations

- [Settings and definitions](https://github.com/troazz/notecal/blob/main/crates/notecal-env/src/settings.rs): `crates/notecal-env/src/settings.rs`
- [Atomic file access](https://github.com/troazz/notecal/blob/main/crates/notecal-env/src/fs.rs): `crates/notecal-env/src/fs.rs`
- [Cached exchange rates](https://github.com/troazz/notecal/blob/main/crates/notecal-env/src/rates.rs): `crates/notecal-env/src/rates.rs`
- **Exchange-rate service**
- [User and system themes](https://github.com/troazz/notecal/blob/main/src-tauri/src/theme.rs): `src-tauri/src/theme.rs`

### Other components

- **Notecal user**

## Connections

- Notecal user → Note editor: edits notes (evidence: `README.md`)
- Note editor → Editor features: uses editor features (evidence: `ui/src/Editor.svelte`)
- App shell → Note editor: renders (evidence: `ui/src/App.svelte`)
- Note editor → Evaluation service: requests evaluation
- Evaluation service → Expression engine: evaluates expressions
- Expression engine → Expression preprocessing: preprocesses input (evidence: `crates/notecal-core/src/lib.rs`)
- Expression engine → Dates and zones: evaluates dates (evidence: `crates/notecal-core/src/lib.rs`)
- Dates and zones → Zone aliases: resolves zones (evidence: `crates/notecal-core/src/datetime.rs`)
- Expression engine → Result formatting: formats results (evidence: `crates/notecal-core/src/lib.rs`)
- Notecal user → Note switcher: chooses notes (evidence: `README.md`)
- Note switcher → Note session: opens and switches (evidence: `ui/src/notes/Switcher.svelte`)
- Note session → Command bridge: loads and saves
- Command bridge → Note storage: manages note files (evidence: `src-tauri/src/commands.rs`)
- Note storage → Atomic file access: writes atomically (evidence: `src-tauri/src/notes.rs`)
- Disk change watcher → Command bridge: reports disk changes (evidence: `src-tauri/src/commands.rs`)
- Tauri runtime → Command bridge: registers commands (evidence: `src-tauri/src/main.rs`)
- Tauri runtime → Evaluation service: initializes service (evidence: `src-tauri/src/main.rs`)
- Tauri runtime → Note storage: initializes storage (evidence: `src-tauri/src/main.rs`)
- Settings screen → Command bridge: updates settings
- First-run setup → Settings screen: uses settings API (evidence: `ui/src/onboarding/Onboarding.svelte`)
- Command bridge → Settings and definitions: loads and applies (evidence: `src-tauri/src/commands.rs`)
- Settings and definitions → Expression engine: derives engine settings (evidence: `crates/notecal-env/src/settings.rs`)
- Command bridge → Theme service: resolves themes (evidence: `src-tauri/src/commands.rs`)
- Notecal user → User and system themes: supplies palettes (evidence: `README.md`)
- Theme service → User and system themes: loads palettes (evidence: `src-tauri/src/theme.rs`)
- Tauri runtime → Window pinning: starts window controls (evidence: `src-tauri/src/main.rs`)
- Tauri runtime → Update checks: starts update checks (evidence: `src-tauri/src/main.rs`)
- Notecal user → Command-line calculator: enters calculation (evidence: `README.md`)
- Command-line calculator → Expression engine: evaluates input
- Expression engine → Calculation cheatsheet: provides examples (evidence: `crates/notecal-core/src/lib.rs`)
- Note switcher → Calculation cheatsheet: searches examples
- Tauri runtime → Cached exchange rates: loads cached rates (evidence: `src-tauri/src/main.rs`)
- Command bridge → Exchange-rate service: fetches rates
- Cached exchange rates → Atomic file access: persists cache (evidence: `crates/notecal-env/src/rates.rs`)
- App shell → Interface language: translates interface (evidence: `ui/src/App.svelte`)
- First-run setup → Interface language: translates setup (evidence: `ui/src/onboarding/Onboarding.svelte`)
