# rubarmo/crysta architecture

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

- Interactive diagram: https://gitdiagram.com/rubarmo/crysta
- Repository: https://github.com/rubarmo/crysta

## Overview

Crysta is a local-first Snowflake Method writing workspace. A writer creates or opens a project, develops the novel through guided steps and planning tools, then can prepare a formatted book export. The frontend invokes native Rust commands through the Tauri bridge, with SQLite-backed project data. The README documents snapshots, bilingual directionality, and export formats; some of those implementations were not sampled, so their internal wiring is shown conservatively.

Main entry points: [`src/components/Workspace.tsx`](https://github.com/rubarmo/crysta/blob/main/src/components/Workspace.tsx) (Writing workspace), [`src-tauri/src/lib.rs`](https://github.com/rubarmo/crysta/blob/main/src-tauri/src/lib.rs) (Tauri runtime), [`src/lib.ts`](https://github.com/rubarmo/crysta/blob/main/src/lib.ts) (Command bridge), [`src/App.tsx`](https://github.com/rubarmo/crysta/blob/main/src/App.tsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App shell<br/>[App.tsx]"]
  node_language["Language settings"]
end

subgraph group_writing["Story development"]
  node_workspace["Writing workspace<br/>[Workspace.tsx]"]
  node_datahook["Workspace data"]
  node_snowflake["Snowflake steps<br/>[Workspace.tsx]"]
  node_character["Character planning<br/>[Workspace.tsx]"]
  node_scenes["Scene outlining"]
  node_draft["Novel drafting<br/>[WriteNovelTab.tsx]"]
  node_wordcount["Word counts<br/>[WordCounter.tsx]"]
end

subgraph group_persistence["Local project data"]
  node_bridge["Command bridge<br/>[lib.ts]"]
  node_projects["Project commands<br/>[project.rs]"]
  node_novels["Novel commands<br/>[novel.rs]"]
  node_story["Story commands<br/>[story.rs]"]
  node_snapshots["Snapshot commands<br/>[snapshots.rs]"]
  node_database[("SQLite project data<br/>[db.rs]")]
end

subgraph group_publishing["Book production"]
  node_bookstudio["Book studio<br/>[BookStudioTab.tsx]"]
  node_exportservice["Book export"]
  node_exportcommands["Export commands<br/>[export.rs]"]
end

subgraph group_native["Native services"]
  node_nativeapp["Tauri runtime<br/>[lib.rs]"]
end

node_writer(("Writer"))
node_filesystem["Local files"]

node_writer -->|"uses"| node_app
node_app -->|"manages projects"| node_bridge
node_app -->|"opens workspace"| node_workspace
node_app -->|"sets language"| node_language
node_app -->|"loads progress"| node_bridge
node_workspace -->|"edits story data"| node_datahook
node_workspace -->|"presents steps"| node_snowflake
node_workspace -->|"presents planning"| node_character
node_workspace -->|"presents outlines"| node_scenes
node_workspace -->|"presents drafting"| node_draft
node_workspace -->|"counts words"| node_wordcount
node_datahook -->|"loads and saves"| node_bridge
node_bridge -->|"invokes commands"| node_nativeapp
node_nativeapp -->|"dispatches"| node_projects
node_nativeapp -->|"dispatches"| node_novels
node_nativeapp -->|"dispatches"| node_story
node_nativeapp -->|"dispatches"| node_snapshots
node_nativeapp -->|"dispatches"| node_exportcommands
node_projects -->|"reads and writes"| node_database
node_novels -->|"reads and writes"| node_database
node_story -->|"reads and writes"| node_database
node_snapshots -->|"backs up"| node_database
node_bookstudio -->|"saves formatting"| node_bridge
node_bookstudio -->|"exports book"| node_exportservice
node_exportservice -->|"saves export"| node_bridge
node_exportcommands -->|"reads and writes"| node_database
node_projects -->|"selects project files"| node_filesystem
node_exportcommands -->|"writes export"| node_filesystem

click node_app "https://github.com/rubarmo/crysta/blob/main/src/App.tsx"
click node_language "https://github.com/rubarmo/crysta/blob/main/src/LanguageContext.tsx"
click node_workspace "https://github.com/rubarmo/crysta/blob/main/src/components/Workspace.tsx"
click node_datahook "https://github.com/rubarmo/crysta/blob/main/src/hooks/useWorkspaceData.ts"
click node_snowflake "https://github.com/rubarmo/crysta/blob/main/src/components/Workspace.tsx"
click node_character "https://github.com/rubarmo/crysta/blob/main/src/components/Workspace.tsx"
click node_scenes "https://github.com/rubarmo/crysta/blob/main/src/components/workspace/SceneMatrixView.tsx"
click node_draft "https://github.com/rubarmo/crysta/blob/main/src/components/workspace/WriteNovelTab.tsx"
click node_wordcount "https://github.com/rubarmo/crysta/blob/main/src/components/WordCounter.tsx"
click node_bridge "https://github.com/rubarmo/crysta/blob/main/src/lib.ts"
click node_projects "https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/project.rs"
click node_novels "https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/novel.rs"
click node_story "https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/story.rs"
click node_snapshots "https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/snapshots.rs"
click node_database "https://github.com/rubarmo/crysta/blob/main/src-tauri/src/db.rs"
click node_bookstudio "https://github.com/rubarmo/crysta/blob/main/src/components/workspace/BookStudioTab.tsx"
click node_exportservice "https://github.com/rubarmo/crysta/blob/main/src/services/bookExportService.ts"
click node_exportcommands "https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/export.rs"
click node_nativeapp "https://github.com/rubarmo/crysta/blob/main/src-tauri/src/lib.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_language toneBlue
class node_workspace,node_datahook,node_snowflake,node_character,node_scenes,node_draft,node_wordcount toneAmber
class node_bridge,node_projects,node_novels,node_story,node_snapshots,node_database toneMint
class node_bookstudio,node_exportservice,node_exportcommands toneRose
class node_nativeapp,node_writer,node_filesystem toneIndigo
```

## Components

### Application shell

- [App shell](https://github.com/rubarmo/crysta/blob/main/src/App.tsx): `src/App.tsx`
- [Language settings](https://github.com/rubarmo/crysta/blob/main/src/LanguageContext.tsx): `src/LanguageContext.tsx`

### Story development

- [Writing workspace](https://github.com/rubarmo/crysta/blob/main/src/components/Workspace.tsx): `src/components/Workspace.tsx`
- [Workspace data](https://github.com/rubarmo/crysta/blob/main/src/hooks/useWorkspaceData.ts): `src/hooks/useWorkspaceData.ts`
- [Snowflake steps](https://github.com/rubarmo/crysta/blob/main/src/components/Workspace.tsx): `src/components/Workspace.tsx`
- [Character planning](https://github.com/rubarmo/crysta/blob/main/src/components/Workspace.tsx): `src/components/Workspace.tsx`
- [Scene outlining](https://github.com/rubarmo/crysta/blob/main/src/components/workspace/SceneMatrixView.tsx): `src/components/workspace/SceneMatrixView.tsx`
- [Novel drafting](https://github.com/rubarmo/crysta/blob/main/src/components/workspace/WriteNovelTab.tsx): `src/components/workspace/WriteNovelTab.tsx`
- [Word counts](https://github.com/rubarmo/crysta/blob/main/src/components/WordCounter.tsx): `src/components/WordCounter.tsx`

### Local project data

- [Command bridge](https://github.com/rubarmo/crysta/blob/main/src/lib.ts): `src/lib.ts`
- [Project commands](https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/project.rs): `src-tauri/src/commands/project.rs`
- [Novel commands](https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/novel.rs): `src-tauri/src/commands/novel.rs`
- [Story commands](https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/story.rs): `src-tauri/src/commands/story.rs`
- [Snapshot commands](https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/snapshots.rs): `src-tauri/src/commands/snapshots.rs`
- [SQLite project data](https://github.com/rubarmo/crysta/blob/main/src-tauri/src/db.rs): `src-tauri/src/db.rs`

### Book production

- [Book studio](https://github.com/rubarmo/crysta/blob/main/src/components/workspace/BookStudioTab.tsx): `src/components/workspace/BookStudioTab.tsx`
- [Book export](https://github.com/rubarmo/crysta/blob/main/src/services/bookExportService.ts): `src/services/bookExportService.ts`
- [Export commands](https://github.com/rubarmo/crysta/blob/main/src-tauri/src/commands/export.rs): `src-tauri/src/commands/export.rs`

### Native services

- [Tauri runtime](https://github.com/rubarmo/crysta/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Other components

- **Writer**
- **Local files**

## Connections

- Writer → App shell: uses
- App shell → Command bridge: manages projects
- App shell → Writing workspace: opens workspace
- App shell → Language settings: sets language
- App shell → Command bridge: loads progress
- Writing workspace → Workspace data: edits story data
- Writing workspace → Snowflake steps: presents steps
- Writing workspace → Character planning: presents planning
- Writing workspace → Scene outlining: presents outlines
- Writing workspace → Novel drafting: presents drafting
- Writing workspace → Word counts: counts words
- Workspace data → Command bridge: loads and saves
- Command bridge → Tauri runtime: invokes commands
- Tauri runtime → Project commands: dispatches
- Tauri runtime → Novel commands: dispatches
- Tauri runtime → Story commands: dispatches
- Tauri runtime → Snapshot commands: dispatches
- Tauri runtime → Export commands: dispatches
- Project commands → SQLite project data: reads and writes
- Novel commands → SQLite project data: reads and writes
- Story commands → SQLite project data: reads and writes
- Snapshot commands → SQLite project data: backs up
- Book studio → Command bridge: saves formatting
- Book studio → Book export: exports book
- Book export → Command bridge: saves export
- Export commands → SQLite project data: reads and writes
- Project commands → Local files: selects project files
- Export commands → Local files: writes export
