# dannymcc/granola-to-obsidian architecture

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

- Interactive diagram: https://gitdiagram.com/dannymcc/granola-to-obsidian
- Repository: https://github.com/dannymcc/granola-to-obsidian

## Overview

##### Project type and purpose
- This is an Obsidian Community Plugin (“Granola Sync”) that runs inside the Obsidian host, fetches meeting notes from the external Granola AI service, converts them to Markdown, and writes them into your vault with rich metadata and integrations.

##### File structure
- Top‐level files only:
- main.js – plugin entrypoint, loads settings, registers commands, scheduler, and handlers
- manifest.json – plugin metadata (id, version, name, commands) used by Obsidian
- styles.css – custom CSS for status bar and ribbon UI elements
- versions.json – tracks plugin release versions
- .github folder contains CI/workflow for automated releases.
- No nested source folders: logic is modularized within main.js (or imported modules if built).

##### Key insights from the README
- Core features: auto/manual sync, customizable filename/date templates, daily‐note & periodic‐note integration, attendee tagging, smart update handling, Granola URL linking.
- Uses Obsidian Plugin API for scheduling, commands, settings screen, file I/O, and UI updates.
- Reads a local auth file (supabase.json) to authenticate against Granola API.

##### Details to capture
- Plugin lifecycle hooks (onload → registers commands & scheduler, onunload → clean up)
- Settings → Configurable folder path, templates, auth path
- Scheduler intervals (1min → daily)
- Error & success flows back to the status bar
- Distinct modules rather than lumped together for clarity

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External User
    User("User"):::actor

    %% Obsidian Host
    subgraph "Obsidian Host Environment" 
        direction TB
        ObsidianCore["Obsidian Core API"]:::host
        subgraph "Granola Sync Plugin"
            direction TB
            SettingsManager["Settings Manager"]:::plugin
            Scheduler["Scheduler (Auto-sync timer)"]:::plugin
            CommandHandler["Command Handler"]:::plugin
            APIClient["API Client"]:::plugin
            ContentTransformer["Content Transformer"]:::plugin
            FileWriter["File Writer"]:::plugin
            subgraph "UI Modules"
                direction TB
                StatusBar["Status Bar Indicator"]:::plugin
                RibbonButton["Ribbon Button & Command Palette"]:::plugin
            end
            subgraph "Integration Adapters"
                direction TB
                DailyNotesAdapter["Daily Notes Adapter"]:::plugin
                PeriodicNotesAdapter["Periodic Notes Adapter"]:::plugin
            end
        end
    end

    %% External Service
    GranolaAPI["Granola AI API"]:::external

    %% Vault File System
    Vault["Obsidian Vault (File System)"]:::vault

    %% Relationships
    User -->|click ribbon| RibbonButton
    User -->|scheduler triggers| Scheduler
    RibbonButton -->|"sync command"| CommandHandler
    Scheduler -->|"trigger sync"| CommandHandler
    CommandHandler -->|"calls API"| APIClient
    APIClient -->|"fetch meeting JSON"| GranolaAPI
    GranolaAPI -->|"meeting data JSON"| APIClient
    APIClient -->|"raw JSON"| ContentTransformer
    ContentTransformer -->|"Markdown + frontmatter"| FileWriter
    FileWriter -->|"write files"| Vault
    FileWriter -->|"to daily note"| DailyNotesAdapter
    DailyNotesAdapter -->|"write to daily note file"| Vault
    FileWriter -->|"to periodic note"| PeriodicNotesAdapter
    PeriodicNotesAdapter -->|"write to periodic note file"| Vault
    SettingsManager -->|"provides config"| CommandHandler
    SettingsManager -->|"provides config"| Scheduler
    %% Status updates
    SettingsManager -->|"status update"| StatusBar
    Scheduler -->|"status update"| StatusBar
    CommandHandler -->|"status update"| StatusBar
    APIClient -->|"status update"| StatusBar
    ContentTransformer -->|"status update"| StatusBar
    FileWriter -->|"status update"| StatusBar
    DailyNotesAdapter -->|"status update"| StatusBar
    PeriodicNotesAdapter -->|"status update"| StatusBar

    %% Repository Files
    subgraph "Repository Files"
        direction TB
        Manifest["manifest.json"]:::docs
        Versions["versions.json"]:::docs
        Readme["readme.md"]:::docs
        CI[".github/workflows/release.yml"]:::docs
        License["LICENSE"]:::docs
        Changelog["CHANGELOG.md"]:::docs
        Gitignore[".gitignore"]:::docs
    end

    %% Click Events
    click SettingsManager "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click Scheduler "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click CommandHandler "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click APIClient "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click ContentTransformer "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click FileWriter "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click StatusBar "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click RibbonButton "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click DailyNotesAdapter "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click PeriodicNotesAdapter "https://github.com/dannymcc/granola-to-obsidian/blob/main/main.js"
    click Manifest "https://github.com/dannymcc/granola-to-obsidian/blob/main/manifest.json"
    click Versions "https://github.com/dannymcc/granola-to-obsidian/blob/main/versions.json"
    click Readme "https://github.com/dannymcc/granola-to-obsidian/blob/main/readme.md"
    click CI "https://github.com/dannymcc/granola-to-obsidian/blob/main/.github/workflows/release.yml"
    click License "https://github.com/dannymcc/granola-to-obsidian/tree/main/LICENSE"
    click Changelog "https://github.com/dannymcc/granola-to-obsidian/blob/main/CHANGELOG.md"
    click Gitignore "https://github.com/dannymcc/granola-to-obsidian/blob/main/.gitignore"

    %% Styles
    classDef host fill:#AED6F1,stroke:#1F618D,color:#1B2631
    classDef plugin fill:#ABEBC6,stroke:#196F3D,color:#145A32
    classDef external fill:#F5B041,stroke:#B9770E,color:#7E5109
    classDef vault fill:#D5DBDB,stroke:#566573,color:#1C2833
    classDef docs fill:#E8DAEF,stroke:#7D3C98,color:#4A235A
    classDef actor fill:#FAD7A0,stroke:#B9770E,color:#784212
```
