# marcusolsson/obsidian-projects architecture

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

- Interactive diagram: https://gitdiagram.com/marcusolsson/obsidian-projects
- Repository: https://github.com/marcusolsson/obsidian-projects

## Overview

The provided project is an Obsidian plugin that helps users manage projects by visualizing notes in different views (Table, Board, Calendar, Gallery, Developer, etc.). The codebase is split between core logic (data-handling, file system interaction, datasources, metadata, etc.), and a rich, Svelte-based user interface. With multiple layers of abstraction, the system is designed to integrate seamlessly with Obsidian’s native environment and to offer several customizable views and tools for project management.

##### Main Components
- Plugin Entry Point & Integration:
– Highlight src/main.ts which boots up the plugin.
– Include integration points with Obsidian (e.g., src/obsidianProjects.d.ts and src/lib/obsidian.ts) which bridge the plugin with the Obsidian API.
- Core Library (Data & Business Logic):
– In the src/lib directory, you have several submodules:
– Datasources: Under src/lib/datasources, there are dedicated modules for dataview, folder, frontmatter, and tag. These represent how data is extracted and standardized.
– Filesystem: Handling both in-memory (inmem) and Obsidian-specific filesystem integrations.
– Metadata: Encoding/decoding metadata from notes.
– Stores: Managing state for capabilities, custom views, settings, translations, and events.
– Templates and Helpers: For processing note templates and utility functions.
- User Interface (UI):
– The src/ui directory contains a rich Svelte-based frontend.
– UI/views: Separate directories for each view (Board, Calendar, Gallery, Table, Developer) with components for layout, options, settings, and interactions.
– UI/app: Main application components like App.svelte, onboarding, toolbar, and view switching.
– UI/components and UI/modals: Specific reusable widgets and modal dialogs.
– UI/settings: Components for adjusting user settings.
- Configuration, Testing, and Build Infrastructure:
– Build/build config files (esbuild.config.mjs, jest.config.js)
– Testing mocks (__mocks__), TypeScript configurations, and shared project settings.
– Continuous integration and release workflows in the .github directory.

##### Relationships and Interactions
- The Plugin Launch:
– The plugin is initialized via src/main.ts, which registers commands and integrates with Obsidian.
- Data Flow between Modules:
– The UI layer (Svelte components) interacts with the core logic through the stores (found in src/lib/stores) to fetch, update, and reflect project data.
– The datasources modules provide abstraction to fetch notes data from different sources (e.g., dataview queries, folder structures, front matter, and tags). Their output is standardized and fed into the user interface.
- State & Event Handling:
– Events and state updates are managed by the events module (src/events.ts) and the stores, ensuring a reactive UI.
- File/Data Persistence:
– The filesystem modules (both in-memory and Obsidian integrated) handle reading and writing operations, ensuring that the plugin does not leave any persistent configuration traces in the user’s notes (in line with the “leave no trace” design philosophy).

##### Architectural Patterns and Design Principles
- Modular Architecture: Each concern is isolated—datasources, filesystem integration, metadata handling, and UI component rendering are all encapsulated in their respective modules.
- Separation of Concerns: UI components (Svelte files), business logic (lib and settings), and plugin integration (main.ts and Obsidian APIs) are clearly segregated.
- Native Experience: The project emphasizes native usage of Obsidian’s APIs and a familiar UI experience for consistency.
- Testability: The presence of __mocks__ and Jest configurations underscores an architecture that values robust testing.

– A top-level view that starts with Obsidian’s environment, through which the plugin is loaded (from manifest.json to src/main.ts).
– A breakdown of the Plugin Core:
- Data Management Cluster (comprising datasources, filesystem, metadata).
- State Handling and Business Logic (stores and events).
– A separate yet interacting cluster for the User Interface:
- Main Application view, with decomposed sub-components (views, modals, and smaller UI components).
– Interconnections between these clusters should show the data flow and event propagation.
– Annotation of integration points with external platforms (like the native Obsidian API) and testing/infrastructure aspects (CI workflows, build scripts).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Obsidian Environment
    subgraph "Obsidian Environment"
        O1["Manifest & Obsidian API"]:::external
    end

    %% Plugin Entry Point & Integration
    subgraph "Plugin Entry Point & Integration"
        P1["main.ts"]:::integration
        P2["obsidianProjects.d.ts"]:::integration
        P3["obsidian.ts"]:::integration
    end

    O1 -->|"loads"| P1
    P1 -->|"bridges"| P2
    P1 -->|"bridges"| P3

    %% Core Library
    subgraph "Core Library"
        %% Data Management Cluster
        subgraph "Data Management Cluster"
            subgraph "Datasources"
                D1["dataview datasource (module)"]:::datasource
                D2["folder datasource"]:::datasource
                D3["frontmatter datasource"]:::datasource
                D4["tag datasource"]:::datasource
                D5["Helpers"]:::datasource
            end

            subgraph "Filesystem Integration"
                FS1["General filesystem"]:::filesystem
                FS2["In-memory filesystem"]:::filesystem
                FS3["Obsidian filesystem"]:::filesystem
            end

            subgraph "Metadata Handling"
                M1["Metadata Encoding/Decoding"]:::metadata
            end
        end

        %% State Management & Business Logic
        subgraph "State & Business Logic"
            S1["Stores (State Management)"]:::business
            S2["Events Handler"]:::business
        end

        %% Templates & Helpers
        subgraph "Templates & Helpers"
            T1["Templates Module"]:::helper
            T2["General Helpers"]:::helper
        end
    end

    %% User Interface (UI)
    subgraph "User Interface (UI)"
        subgraph "Main Application"
            UI1["App & Providers"]:::ui
        end

        subgraph "Views"
            UIV1["Board View"]:::ui
            UIV2["Calendar View"]:::ui
            UIV3["Gallery View"]:::ui
            UIV4["Table View"]:::ui
            UIV5["Developer View"]:::ui
        end

        subgraph "Components & Modals"
            UIC1["Reusable Components"]:::ui
            UIM1["Modals"]:::ui
            UIS1["UI Settings"]:::ui
        end
    end

    %% Configuration, Testing & Build Infrastructure
    subgraph "Configuration, Testing & Build"
        C1["Build Configurations"]:::config
        C2["Testing Mocks & TS Configs"]:::config
        C3["CI & Release Workflows"]:::config
    end

    %% Interconnections
    P1 -->|"initializes"| S1
    P1 -->|"initializes"| S2

    S1 -->|"updates"| UI1
    S1 -->|"feeds"| UIV1
    S1 -->|"feeds"| UIV2
    S1 -->|"feeds"| UIV3
    S1 -->|"feeds"| UIV4
    S1 -->|"feeds"| UIV5

    D1 -->|"suppliesData"| S1
    D2 -->|"suppliesData"| S1
    D3 -->|"suppliesData"| S1
    D4 -->|"suppliesData"| S1

    FS1 -->|"persistsData"| S1
    FS2 -->|"persistsData"| S1
    FS3 -->|"persistsData"| S1

    M1 -->|"processesMeta"| S1
    T1 -->|"assists"| S1
    T2 -->|"assists"| S1

    UI1 -->|"renders"| UIV1
    UI1 -->|"renders"| UIV2
    UI1 -->|"renders"| UIV3
    UI1 -->|"renders"| UIV4
    UI1 -->|"renders"| UIV5
    UI1 -->|"includes"| UIC1
    UI1 -->|"includes"| UIM1
    UI1 -->|"includes"| UIS1

    C1 -->|"builds"| P1
    C2 -->|"mocks"| S2
    C3 -->|"integrates"| P1

    %% Click Events
    click P1 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/main.ts"
    click P2 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/obsidianProjects.d.ts"
    click P3 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/obsidian.ts"

    click D1 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/lib/datasources/dataview/"
    click D2 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/datasources/folder/datasource.ts"
    click D3 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/lib/datasources/frontmatter/"
    click D4 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/datasources/tag/datasource.ts"
    click D5 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/datasources/helpers.ts"

    click FS1 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/filesystem/filesystem.ts"
    click FS2 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/filesystem/inmem/filesystem.ts"
    click FS3 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/filesystem/obsidian/filesystem.ts"

    click M1 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/metadata/index.ts"

    click S1 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/lib/stores/"
    click S2 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/events.ts"

    click T1 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/lib/templates/"
    click T2 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/lib/helpers.ts"

    click UI1 "https://github.com/marcusolsson/obsidian-projects/blob/main/src/ui/app/App.svelte"
    click UIV1 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/ui/views/Board/"
    click UIV2 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/ui/views/Calendar/"
    click UIV3 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/ui/views/Gallery/"
    click UIV4 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/ui/views/Table/"
    click UIV5 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/ui/views/Developer/"
    click UIC1 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/ui/components/"
    click UIM1 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/ui/modals/"
    click UIS1 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/ui/settings/"

    click C1 "https://github.com/marcusolsson/obsidian-projects/blob/main/esbuild.config.mjs"
    click C2 "https://github.com/marcusolsson/obsidian-projects/tree/main/src/__mocks__/"
    click C3 "https://github.com/marcusolsson/obsidian-projects/tree/main/.github/"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:2px;
    classDef integration fill:#bbf,stroke:#333,stroke-width:2px;
    classDef datasource fill:#cfc,stroke:#333,stroke-width:2px;
    classDef filesystem fill:#fcf,stroke:#333,stroke-width:2px;
    classDef metadata fill:#cff,stroke:#333,stroke-width:2px;
    classDef business fill:#ff9,stroke:#333,stroke-width:2px;
    classDef helper fill:#9ff,stroke:#333,stroke-width:2px;
    classDef ui fill:#f96,stroke:#333,stroke-width:2px;
    classDef config fill:#ccc,stroke:#333,stroke-width:2px;
```
