# arpitteli/strata architecture

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

- Interactive diagram: https://gitdiagram.com/arpitteli/strata
- Repository: https://github.com/arpitteli/strata

## Overview

1. **Overall shape**
   Strata is a **desktop-first Tauri app**: a React/Vite front end in `src/` and a Rust host in `src-tauri/`. The app is designed to be **local-first**, with the UI talking to local storage and Tauri-backed native capabilities rather than a remote backend.

2. **Core boundary: the vault**
   The main architectural unit is the **vault folder** in the user’s app data directory. It mixes:
   - **plaintext `.md` node files** for human-readable notes
   - **encrypted sidecar/system files** for graph state, tags, inbox, notifications, agent config/history, Drive token, etc.
   
   The `vault.lock` file stores the generated master key material and vault metadata. This makes the repo’s key boundary: **notes are readable outside the app, system state is not**.

3. **Data model**
   The note system is built around **typed nodes**: Project, Component, Skill, Patent, Funding, Lead, and Simple Note. The repo emphasizes:
   - YAML frontmatter for node metadata
   - wikilinks (`[[...]]`) for graph edges
   - type conversion while preserving shared/base fields
   
   The UI components under `src/components/panels/typefields/` suggest each node type has a specialized field set layered on top of common node data.

4. **Application shell and navigation**
   The front end is organized as a shell with top-level pages under `src/pages/` and shared chrome in `MainLayout`, `Sidebar`, and `TopBar`. This implies the user moves between major work areas such as:
   - Graph
   - Leads
   - Search
   - Notifications
   - Settings
   - Tags
   - Agent
   - Inbox
   - Unlock screen
   
   Even though the README says there is no passphrase unlock in v0.1.0, the presence of `UnlockScreen` suggests the shell supports a security/login state, likely for future or alternate modes.

5. **Central client state**
   `src/stores/StrataStore.ts` is the main shared state boundary for the app. It likely coordinates:
   - loaded vault data
   - selected node / current view
   - graph state
   - tags, inbox, notifications
   - search results
   - agent session/config
   
   This store is what lets otherwise separate views stay consistent without a server.

6. **Graph subsystem**
   `GraphView.tsx` is the visualization surface for the knowledge graph. The README says it uses **Cytoscape.js** with color-coded nodes by type. The graph is likely derived from:
   - node files and their wikilinks
   - persisted graph layout/state in the encrypted `graph.nxs`
   
   In architecture terms, the graph is a **read-model** over the vault content plus saved layout metadata.

7. **Node detail and editing subsystem**
   `NodePanel.tsx` and its tabs handle the per-node experience: notes, files, checklist, activity, canvas, and type-specific metadata. This is the main **editor/detail boundary** between the graph/list views and the underlying vault files.
   
   The `LeadsView` / `LeadDetail` area is a specialized subdomain for CRM-like records, with its own tabs for summary, activity, files, and links.

8. **Inbox, tagging, search, and markdown utilities**
   The repo has a cluster of local productivity subsystems:
   - `InboxView` for quick capture
   - `TagsView` plus `TagsInput`
   - `SearchView` backed by local full-text indexing
   - markdown helpers and search utilities in `src/lib/markdown.ts` and `src/lib/search.ts`
   
   The import path for Obsidian vaults is also part of this layer, reinforcing that Strata treats markdown as a first-class interchange format.

9. **Automation and AI agent**
   `src/lib/agent.ts` plus encrypted `agent-config.nxs` and `chat.nxs` form the AI subsystem. The README says it is **OpenAI-compatible** and can summarize individual nodes or the whole graph using a user-supplied API key.
   
   Architecturally, this is a **client-side agent integration**, not a server-side AI service. Its data flows are local chat/config persistence plus outbound model requests.

10. **Sync, export, and backup**
   `driveSync.ts` and `export.ts` are the persistence/portability layer:
   - Google Drive sync provides encrypted backup/sync
   - vault export produces a single encrypted `.nxs` archive
   - Obsidian import walks a directory and ingests `.md` files as notes
   
   These flows all sit at the boundary between the local vault and external storage, with encryption handled before data leaves the machine.

11. **Notifications and idle/security behavior**
   The notification layer includes `notificationEngine.ts`, `nativeNotifications.ts`, and `useNotificationCheck.ts`. The README indicates due-date and threshold checks for projects/components. There is also `useIdleLock.ts`, which suggests the app can react to inactivity for privacy or state management even though v0.1.0 does not use a passphrase unlock flow.

12. **Rust/Tauri backend**
   The Rust side (`main.rs`, `lib.rs`, `api.rs`) is the native execution layer for Tauri capabilities, file access, and any privileged operations the browser-side UI cannot or should not do directly. The `capabilities/default.json` and generated schema files indicate Tauri’s permissioned command model is part of the app boundary.

13. **Tech stack and build shape**
   The repo is a **TypeScript React app** built with **Vite** and styled with **Tailwind/PostCSS**, wrapped by a **Rust/Tauri desktop runtime**. That combination matters architecturally because the UI is a local SPA, but system access, packaging, and native integrations are handled through Tauri rather than a traditional web backend.

14. **How the main data flows connect**
   The typical flow is:
   - user edits or captures data in a page/component
   - the client store updates UI state
   - node content is written to markdown files, while app-level metadata is written to encrypted sidecars
   - graph/search/notifications recompute from the vault
   - optional sync/export/agent actions bridge to external services or formats
   
   So the repo is best drawn as a **local vault-centric desktop system** with multiple read models over the same underlying markdown + encrypted metadata store.

Main entry points: [`src/stores/StrataStore.ts`](https://github.com/arpitteli/strata/blob/main/src/stores/StrataStore.ts) (Store), [`src/components/ui/Sidebar.tsx`](https://github.com/arpitteli/strata/blob/main/src/components/ui/Sidebar.tsx) (Sidebar), [`src/lib/storage.ts`](https://github.com/arpitteli/strata/blob/main/src/lib/storage.ts) (Storage), [`src/pages/MainLayout.tsx`](https://github.com/arpitteli/strata/blob/main/src/pages/MainLayout.tsx) (Layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend_shell["Frontend shell"]
  node_app["App<br/>root ui<br/>[App.tsx]"]
  node_layout["Layout<br/>shell<br/>[MainLayout.tsx]"]
  node_sidebar["Sidebar<br/>nav<br/>[Sidebar.tsx]"]
  node_topbar["Top bar<br/>chrome<br/>[TopBar.tsx]"]
  node_unlock["Unlock<br/>security view<br/>[UnlockScreen.tsx]"]
end

subgraph group_workspace_views["Workspace views"]
  node_graphview["Graph view<br/>knowledge graph<br/>[GraphView.tsx]"]
  node_nodepanel["Node panel<br/>detail editor<br/>[NodePanel.tsx]"]
  node_leads["Leads view<br/>crm workspace<br/>[LeadsView.tsx]"]
  node_leaddetail["Lead detail<br/>record view<br/>[LeadDetail.tsx]"]
  node_inbox["Inbox<br/>capture view<br/>[InboxView.tsx]"]
  node_tags["Tags<br/>taxonomy view<br/>[TagsView.tsx]"]
  node_search["Search view<br/>query view<br/>[SearchView.tsx]"]
  node_notifyview["Notifications<br/>alerts view"]
  node_settings["Settings<br/>preferences view<br/>[SettingsView.tsx]"]
  node_agentview["Agent<br/>ai view<br/>[AgentView.tsx]"]
end

subgraph group_data_core["Data core"]
  node_store[("Store<br/>state hub<br/>[StrataStore.ts]")]
  node_storage[("Storage<br/>vault I/O<br/>[storage.ts]")]
  node_crypto{{"Crypto<br/>encryption<br/>[crypto.ts]"}}
  node_markdown["Markdown<br/>node format<br/>[markdown.ts]"]
  node_searchlib["Search<br/>indexing<br/>[search.ts]"]
  node_factory["Node factory<br/>schema model<br/>[nodeFactory.ts]"]
end

subgraph group_integrations["Integrations"]
  node_agentlib["Agent<br/>ai runtime<br/>[agent.ts]"]
  node_sync["Drive sync<br/>backup sync<br/>[driveSync.ts]"]
  node_exportlib["Export<br/>archive<br/>[export.ts]"]
  node_obsidian["Obsidian import<br/>importer<br/>[obsidian.ts]"]
  node_notifycore["Notify engine<br/>rules engine"]
end

subgraph group_native_runtime["Native runtime"]
  node_native["Rust host<br/>tauri backend<br/>[main.rs]"]
  node_api["Tauri API<br/>commands<br/>[api.rs]"]
end

node_app -->|"renders"| node_layout
node_app -->|"locked state"| node_unlock
node_layout -->|"contains"| node_sidebar
node_layout -->|"contains"| node_topbar
node_layout -->|"binds"| node_store
node_sidebar -->|"navigates"| node_graphview
node_sidebar -->|"navigates"| node_leads
node_sidebar -->|"navigates"| node_search
node_sidebar -->|"navigates"| node_settings
node_store -->|"loads/saves"| node_storage
node_storage -->|"protects"| node_crypto
node_storage -->|"reads/writes"| node_markdown
node_store -->|"indexes"| node_searchlib
node_store -->|"creates"| node_factory
node_graphview -->|"consumes"| node_store
node_nodepanel -->|"edits"| node_store
node_leads -->|"drills into"| node_leaddetail
node_leaddetail -->|"consumes"| node_store
node_inbox -->|"captures to"| node_store
node_tags -->|"filters"| node_store
node_search -->|"queries"| node_searchlib
node_notifyview -->|"drives"| node_notifycore
node_agentview -->|"uses"| node_agentlib
node_agentlib -->|"summarizes"| node_store
node_sync -->|"syncs"| node_storage
node_exportlib -->|"packages"| node_crypto
node_obsidian -->|"imports"| node_markdown
node_notifycore -->|"notifies via"| node_native
node_native -->|"exposes"| node_api
node_api -->|"accesses"| node_storage

click node_app "https://github.com/arpitteli/strata/blob/main/src/App.tsx"
click node_layout "https://github.com/arpitteli/strata/blob/main/src/pages/MainLayout.tsx"
click node_sidebar "https://github.com/arpitteli/strata/blob/main/src/components/ui/Sidebar.tsx"
click node_topbar "https://github.com/arpitteli/strata/blob/main/src/components/ui/TopBar.tsx"
click node_unlock "https://github.com/arpitteli/strata/blob/main/src/pages/UnlockScreen.tsx"
click node_store "https://github.com/arpitteli/strata/blob/main/src/stores/StrataStore.ts"
click node_storage "https://github.com/arpitteli/strata/blob/main/src/lib/storage.ts"
click node_crypto "https://github.com/arpitteli/strata/blob/main/src/lib/crypto.ts"
click node_markdown "https://github.com/arpitteli/strata/blob/main/src/lib/markdown.ts"
click node_searchlib "https://github.com/arpitteli/strata/blob/main/src/lib/search.ts"
click node_factory "https://github.com/arpitteli/strata/blob/main/src/lib/nodeFactory.ts"
click node_graphview "https://github.com/arpitteli/strata/blob/main/src/components/graph/GraphView.tsx"
click node_nodepanel "https://github.com/arpitteli/strata/blob/main/src/components/panels/NodePanel.tsx"
click node_leads "https://github.com/arpitteli/strata/blob/main/src/pages/LeadsView.tsx"
click node_leaddetail "https://github.com/arpitteli/strata/blob/main/src/components/leads/LeadDetail.tsx"
click node_inbox "https://github.com/arpitteli/strata/blob/main/src/pages/InboxView.tsx"
click node_tags "https://github.com/arpitteli/strata/blob/main/src/pages/TagsView.tsx"
click node_search "https://github.com/arpitteli/strata/blob/main/src/pages/SearchView.tsx"
click node_notifyview "https://github.com/arpitteli/strata/blob/main/src/pages/NotificationsView.tsx"
click node_settings "https://github.com/arpitteli/strata/blob/main/src/pages/SettingsView.tsx"
click node_agentview "https://github.com/arpitteli/strata/blob/main/src/pages/AgentView.tsx"
click node_agentlib "https://github.com/arpitteli/strata/blob/main/src/lib/agent.ts"
click node_sync "https://github.com/arpitteli/strata/blob/main/src/lib/driveSync.ts"
click node_exportlib "https://github.com/arpitteli/strata/blob/main/src/lib/export.ts"
click node_obsidian "https://github.com/arpitteli/strata/blob/main/src/lib/obsidian.ts"
click node_notifycore "https://github.com/arpitteli/strata/blob/main/src/lib/notificationEngine.ts"
click node_native "https://github.com/arpitteli/strata/blob/main/src-tauri/src/main.rs"
click node_api "https://github.com/arpitteli/strata/blob/main/src-tauri/src/api.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_app,node_layout,node_sidebar,node_topbar,node_unlock toneBlue
class node_graphview,node_nodepanel,node_leads,node_leaddetail,node_inbox,node_tags,node_search,node_notifyview,node_settings,node_agentview toneAmber
class node_store,node_storage,node_crypto,node_markdown,node_searchlib,node_factory toneMint
class node_agentlib,node_sync,node_exportlib,node_obsidian,node_notifycore toneRose
class node_native,node_api toneIndigo
```

## Components

### Frontend shell

React/Vite UI, layout, and page routing.

- [App](https://github.com/arpitteli/strata/blob/main/src/App.tsx): root ui · Top-level React app bootstrap and routing. · `src/App.tsx`
- [Layout](https://github.com/arpitteli/strata/blob/main/src/pages/MainLayout.tsx): shell · Main application chrome and workspace container. · `src/pages/MainLayout.tsx`
- [Sidebar](https://github.com/arpitteli/strata/blob/main/src/components/ui/Sidebar.tsx): nav · Primary navigation between work areas. · `src/components/ui/Sidebar.tsx`
- [Top bar](https://github.com/arpitteli/strata/blob/main/src/components/ui/TopBar.tsx): chrome · Global actions and current-context controls. · `src/components/ui/TopBar.tsx`
- [Unlock](https://github.com/arpitteli/strata/blob/main/src/pages/UnlockScreen.tsx): security view · Locked-state entry screen. · `src/pages/UnlockScreen.tsx`

### Workspace views

Top-level screens for graphing, capture, search, and settings.

- [Graph view](https://github.com/arpitteli/strata/blob/main/src/components/graph/GraphView.tsx): knowledge graph · Cytoscape-based graph visualization over vault nodes. · `src/components/graph/GraphView.tsx`
- [Node panel](https://github.com/arpitteli/strata/blob/main/src/components/panels/NodePanel.tsx): detail editor · Node detail, notes, files, checklist, and activity. · `src/components/panels/NodePanel.tsx`
- [Leads view](https://github.com/arpitteli/strata/blob/main/src/pages/LeadsView.tsx): crm workspace · Lead-oriented workspace and pipeline entry point. · `src/pages/LeadsView.tsx`
- [Lead detail](https://github.com/arpitteli/strata/blob/main/src/components/leads/LeadDetail.tsx): record view · Detailed lead record with summary, activity, files, and links. · `src/components/leads/LeadDetail.tsx`
- [Inbox](https://github.com/arpitteli/strata/blob/main/src/pages/InboxView.tsx): capture view · Quick capture and triage workspace. · `src/pages/InboxView.tsx`
- [Tags](https://github.com/arpitteli/strata/blob/main/src/pages/TagsView.tsx): taxonomy view · Tag browsing and tag input workflow. · `src/pages/TagsView.tsx`
- [Search view](https://github.com/arpitteli/strata/blob/main/src/pages/SearchView.tsx): query view · User-facing search results and lookup surface. · `src/pages/SearchView.tsx`
- [Notifications](https://github.com/arpitteli/strata/blob/main/src/pages/NotificationsView.tsx): alerts view · Notification center for due-date and threshold events. · `src/pages/NotificationsView.tsx`
- [Settings](https://github.com/arpitteli/strata/blob/main/src/pages/SettingsView.tsx): preferences view · App configuration and account/sync settings. · `src/pages/SettingsView.tsx`
- [Agent](https://github.com/arpitteli/strata/blob/main/src/pages/AgentView.tsx): ai view · Client-side AI assistant workspace. · `src/pages/AgentView.tsx`

### Data core

Local state, vault I/O, markdown, indexing, and encryption.

- [Store](https://github.com/arpitteli/strata/blob/main/src/stores/StrataStore.ts): state hub · Shared client state for vault, selection, and derived views. · `src/stores/StrataStore.ts`
- [Storage](https://github.com/arpitteli/strata/blob/main/src/lib/storage.ts): vault I/O · Local vault persistence and file operations. · `src/lib/storage.ts`
- [Crypto](https://github.com/arpitteli/strata/blob/main/src/lib/crypto.ts): encryption · Vault encryption and key handling. · `src/lib/crypto.ts`
- [Markdown](https://github.com/arpitteli/strata/blob/main/src/lib/markdown.ts): node format · Frontmatter, wikilinks, and note serialization. · `src/lib/markdown.ts`
- [Search](https://github.com/arpitteli/strata/blob/main/src/lib/search.ts): indexing · Local search and result ranking helpers. · `src/lib/search.ts`
- [Node factory](https://github.com/arpitteli/strata/blob/main/src/lib/nodeFactory.ts): schema model · Typed node creation and conversion helpers. · `src/lib/nodeFactory.ts`

### Integrations

Agent, sync, export, notifications, and external import paths.

- [Agent](https://github.com/arpitteli/strata/blob/main/src/lib/agent.ts): ai runtime · OpenAI-compatible agent orchestration and chat logic. · `src/lib/agent.ts`
- [Drive sync](https://github.com/arpitteli/strata/blob/main/src/lib/driveSync.ts): backup sync · Encrypted sync to Google Drive or similar remote storage. · `src/lib/driveSync.ts`
- [Export](https://github.com/arpitteli/strata/blob/main/src/lib/export.ts): archive · Encrypted vault export and portable archive creation. · `src/lib/export.ts`
- [Obsidian import](https://github.com/arpitteli/strata/blob/main/src/lib/obsidian.ts): importer · Imports markdown vault content from Obsidian-style folders. · `src/lib/obsidian.ts`
- [Notify engine](https://github.com/arpitteli/strata/blob/main/src/lib/notificationEngine.ts): rules engine · Local notification evaluation and scheduling. · `src/lib/notificationEngine.ts`

### Native runtime

Tauri/Rust boundary for desktop capabilities.

- [Rust host](https://github.com/arpitteli/strata/blob/main/src-tauri/src/main.rs): tauri backend · Native desktop runtime and privileged command surface. · `src-tauri/src/main.rs`
- [Tauri API](https://github.com/arpitteli/strata/blob/main/src-tauri/src/api.rs): commands · Rust-side application commands and bridge logic. · `src-tauri/src/api.rs`

## Connections

- App → Layout: renders · App composes the shell and workspace container.
- App → Unlock: locked state · Locked sessions route to the unlock screen.
- Layout → Sidebar: contains · Main layout hosts primary navigation.
- Layout → Top bar: contains · Main layout hosts global actions.
- Layout → Store: binds · Layout and pages read shared client state.
- Sidebar → Graph view: navigates · Navigation routes into the graph workspace.
- Sidebar → Leads view: navigates · Navigation routes into the leads workspace.
- Sidebar → Search view: navigates · Navigation routes into search.
- Sidebar → Settings: navigates · Navigation routes into settings.
- Store → Storage: loads/saves · Store coordinates vault persistence.
- Storage → Crypto: protects · Vault data is encrypted before leaving local storage.
- Storage → Markdown: reads/writes · Note files are serialized as markdown with frontmatter.
- Store → Search: indexes · Derived search state comes from vault content.
- Store → Node factory: creates · Typed node creation and conversion feed the store.
- Graph view → Store: consumes · Graph view renders from shared vault state.
- Node panel → Store: edits · Node detail updates flow through the store.
- Leads view → Lead detail: drills into · Lead list opens detailed lead records.
- Lead detail → Store: consumes · Lead detail shares the common vault state.
- Inbox → Store: captures to · Quick capture writes into the shared vault model.
- Tags → Store: filters · Tag views derive from stored node metadata.
- Search view → Search: queries · Search UI uses local indexing helpers.
- Notifications → Notify engine: drives · Notification screen reflects the local rules engine.
- Agent → Agent: uses · Agent UI invokes local agent orchestration.
- Agent → Store: summarizes · Agent operates over vault state and selected content.
- Drive sync → Storage: syncs · Sync operates on the local vault boundary.
- Export → Crypto: packages · Exports are encrypted for portability.
- Obsidian import → Markdown: imports · Obsidian import converts markdown notes into vault content.
- Notify engine → Rust host: notifies via · Notification engine can surface native alerts.
- Rust host → Tauri API: exposes · Rust host exposes desktop commands through the API layer.
- Tauri API → Storage: accesses · Native commands handle privileged file and system operations.
