# hiimjako/obsidian-live-syncinator architecture

> Architecture diagram of the GitHub repository hiimjako/obsidian-live-syncinator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hiimjako/obsidian-live-syncinator
- Repository: https://github.com/hiimjako/obsidian-live-syncinator

## Overview

##### Main Components Identification

a) Client-Side (Obsidian Plugin)
- API Layer
- Storage Management
- WebSocket Communication
- Cache System
- Diff Engine
- Message Queue
- Settings Management

b) Server-Side (External Component)
- Syncinator Server (referenced in README)

**┌─ Obsidian Plugin ──────────────────────┐**

- ┌─ API Layer ─┐    ┌─ Storage ─┐     │
- HTTP/WS     │    │ File Ops  │     │
- ┘    └──────────┘      │

- ┌─ Diff Engine ┐  ┌─ Cache ─┐        │

- ┘  └─────────┘         │

- ┌─ Message Queue ┐ ┌─ Settings ┐     │

- ┘ └───────────┘      │
- ┘

##### Connection Flows

- WebSocket real-time communication between plugin and server
- File synchronization flow
- Cache interactions
- Storage operations

##### Implementation Details

Specific features mentioned in TODO:
- Configuration sync (planned)
- Consistency management
- Client cursor tracking (planned)
- Connection heartbeat (planned)

##### Technical Stack Indicators

- TypeScript (based on .ts files)
- Obsidian platform
- WebSocket protocol
- HTTP protocol

##### Additional Recommendations

- Error handling flows
- Offline storage mechanism
- Version control points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Obsidian_Plugin
        API["API Layer"]
        Storage["Storage Management"]
        WS["WebSocket Communication"]
        Cache["Cache System"]
        Diff["Diff Engine"]
        Queue["Message Queue"]
        Settings["Settings Management"]
        Logger["Logger"]
        Main["Main Plugin"]
        Utils["Utilities"]
        
        Main --> API
        Main --> Storage
        Main --> Cache
        Main --> Settings
        Main --> Logger
        
        API --> WS
        API --> HTTP["HTTP Fallback"]
        
        WS --> Queue
        HTTP --> Queue
        
        Queue --> Diff
        Diff --> Storage
        Storage --> Cache
        
        Utils --> Storage
        Utils --> API
    end
    
    Server["Syncinator Server"]
    
    WS <--> Server
    HTTP <-.-> Server
    
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef server fill:#e1f5fe,stroke:#0288d1
    classDef storage fill:#e8f5e9,stroke:#2e7d32
    classDef processing fill:#fff3e0,stroke:#f57c00
    classDef config fill:#f5f5f5,stroke:#616161
    
    class Server server
    class Storage,Cache storage
    class Diff,Queue processing
    class Settings,Utils config
    
    click API "https://github.com/hiimjako/obsidian-live-syncinator/tree/main/src/api/"
    click Storage "https://github.com/hiimjako/obsidian-live-syncinator/tree/main/src/storage/"
    click WS "https://github.com/hiimjako/obsidian-live-syncinator/blob/main/src/api/ws.ts"
    click Cache "https://github.com/hiimjako/obsidian-live-syncinator/blob/main/src/cache.ts"
    click Diff "https://github.com/hiimjako/obsidian-live-syncinator/blob/main/src/diff/diff.ts"
    click Queue "https://github.com/hiimjako/obsidian-live-syncinator/blob/main/src/messageQueue.ts"
    click Settings "https://github.com/hiimjako/obsidian-live-syncinator/blob/main/src/settings.ts"
    click Logger "https://github.com/hiimjako/obsidian-live-syncinator/blob/main/src/logger/logger.ts"
    click Main "https://github.com/hiimjako/obsidian-live-syncinator/blob/main/src/plugin.ts"
    click Utils "https://github.com/hiimjako/obsidian-live-syncinator/tree/main/src/utils/"
    click HTTP "https://github.com/hiimjako/obsidian-live-syncinator/blob/main/src/api/http.ts"
```
