# uphy/obsidian-reminder architecture

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

- Interactive diagram: https://gitdiagram.com/uphy/obsidian-reminder
- Repository: https://github.com/uphy/obsidian-reminder

## Overview

##### Project Overview
- Type & Purpose: This project is an Obsidian plugin that adds reminder functionality to markdown TODOs. It extends Obsidian’s core behavior by parsing reminders in task items (with formats like “@YYYY-MM-DD” and others) and providing UI components, notifications, and interoperability with other plugins (e.g., Tasks, Kanban).
- Key Features: Setting reminders, listing them, delivering notifications, and interoperability with related plugin formats.

##### Main Components
- Plugin Core / Entry Point:
– Highlight the main file (src/main.ts) which serves as the plugin’s initialization point.
- Model Layer:
– “src/model” houses the data definitions and reminder/format logic. Include nodes representing:
- Content models (content.ts)
- Parsing and formatting modules (the markdown formatter, reminder-base, reminder-default, reminder-kanban-plugin, reminder-tasks-plugin, splitter, etc.)
- Time-related utilities (time.ts) and refinement logic (reminder.ts, ref.ts)
- Plugin Logic:
- Commands: (found under src/plugin/commands – e.g., convert-reminder-time-format, scan-reminders, show-date-chooser, etc.) which handle user-triggered actions.
- Data and Filesystem Abstraction: (src/plugin/data.ts and filesystem.ts) that interface with the underlying file system where Obsidian stores markdown notes.
- Notification Worker: (src/plugin/notification-worker.ts) which manages background notification tasks.
- Obsidian Integration Layer: (src/plugin/obsidian-hack) which might tweak or extend Obsidian’s behavior, including event handling and possibly UI hooks.
- Plugin Settings and Helper Modules: (src/plugin/settings and associated helpers) that manage configuration.
- User Interface (UI):
– “src/ui” contains Svelte components that render on-screen elements such as the Calendar, DateTimeChooser, Reminder lists, and individual Reminder components.
– Additionally, “src/plugin/ui” holds helper UI functionalities and modals (for autocomplete, date chooser modals, datetime-format modal, etc.).
- Documentation and Developer Support:
– The “docs” directory holds the guides, which indirectly explain how users interact with the plugin but are also useful for understanding how components relate (e.g., how reminders are set, modified, and listed).

##### Relationships & Flow
- Initialization: From the main entry point (src/main.ts), the plugin loads its various modules (model, plugin logic, UI components) and registers command handlers with Obsidian’s API.
- Data Flow:
– User actions via UI components (in Svelte) trigger commands (in src/plugin/commands).
– Those commands use model functions to parse and format task reminders.
– Via the filesystem abstraction, the plugin scans and updates markdown files.
– A notification worker asynchronously monitors reminder times and triggers Obsidian notifications.
- Integration:
– The “obsidian-hack” directory shows integration points where Obsidian’s internal behaviors might be modified or extended (such as custom commands or debugging hooks).

##### Architectural Patterns & Design Principles
- Modularization: Each concern (data modeling, command handling, UI rendering, etc.) is isolated in its respective module/sub-directory.
- Separation of Concerns: UI components are separated from business logic and data format processing.
- Extensibility: The use of plugin-specific directories like obsidian-hack and the existence of various command modules indicate a design that favors extensibility and future integration with other tools/plugins.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Plugin Core / Entry Point
    Core["Plugin Core (main.ts)"]:::plugin

    %% Model Layer
    subgraph "Model Layer"
        ModelContent["Content Model (content.ts)"]:::model
        ModelRef["Reference (ref.ts)"]:::model
        ModelReminder["Reminder Logic (reminder.ts)"]:::model
        ModelTime["Time Utilities (time.ts)"]:::model
        ModelFormat["Parsing & Formatting Modules (format/)"]:::model
    end

    %% Plugin Logic
    subgraph "Plugin Logic"
        Cmd["Commands (commands)"]:::logic
        Data["Data Abstraction (data.ts)"]:::logic
        FS["Filesystem (filesystem.ts)"]:::logic
        Notify["Notification Worker (notification-worker.ts)"]:::logic
        Obsidian["Obsidian Integration (obsidian-hack)"]:::logic
        Settings["Plugin Settings (settings)"]:::logic
    end

    %% User Interface
    subgraph "User Interface"
        UI["Svelte Components (ui)"]:::ui
        PluginUI["UI Helpers/Modals (plugin/ui)"]:::ui
    end

    %% Documentation
    Docs["Documentation (docs)"]:::docs

    %% Initialization from Plugin Core
    Core -->|"initializes"| ModelContent
    Core -->|"initializes"| ModelRef
    Core -->|"initializes"| ModelReminder
    Core -->|"initializes"| ModelTime
    Core -->|"initializes"| ModelFormat
    Core -->|"initializes"| Cmd
    Core -->|"initializes"| Data
    Core -->|"initializes"| FS
    Core -->|"initializes"| Notify
    Core -->|"initializes"| Obsidian
    Core -->|"initializes"| Settings
    Core -->|"initializes"| UI
    Core -->|"initializes"| PluginUI

    %% User Interactions and Data Flow
    UI -->|"triggers"| Cmd
    PluginUI -->|"supports"| UI
    Cmd -->|"parses|formats"| ModelFormat
    Cmd -->|"reads/writes"| FS
    Cmd -->|"updates"| Data
    Cmd -->|"schedules"| Notify
    UI -->|"hooks"| Obsidian

    %% Documentation connection (informational)
    Docs ---|"provides info"| Core

    %% Class Definitions for styling
    classDef plugin fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef model fill:#fff2cc,stroke:#cca300,stroke-width:2px;
    classDef logic fill:#d0f0c0,stroke:#4ca64c,stroke-width:2px;
    classDef ui fill:#cce5ff,stroke:#337ab7,stroke-width:2px;
    classDef docs fill:#e6e6e6,stroke:#999,stroke-width:2px;

click Core "https://github.com/uphy/obsidian-reminder/blob/master/src/main.ts"
click ModelContent "https://github.com/uphy/obsidian-reminder/blob/master/src/model/content.ts"
click ModelRef "https://github.com/uphy/obsidian-reminder/blob/master/src/model/ref.ts"
click ModelReminder "https://github.com/uphy/obsidian-reminder/blob/master/src/model/reminder.ts"
click ModelTime "https://github.com/uphy/obsidian-reminder/blob/master/src/model/time.ts"
click ModelFormat "https://github.com/uphy/obsidian-reminder/tree/master/src/model/format/"
click Cmd "https://github.com/uphy/obsidian-reminder/tree/master/src/plugin/commands"
click Data "https://github.com/uphy/obsidian-reminder/blob/master/src/plugin/data.ts"
click FS "https://github.com/uphy/obsidian-reminder/blob/master/src/plugin/filesystem.ts"
click Notify "https://github.com/uphy/obsidian-reminder/blob/master/src/plugin/notification-worker.ts"
click Obsidian "https://github.com/uphy/obsidian-reminder/tree/master/src/plugin/obsidian-hack"
click Settings "https://github.com/uphy/obsidian-reminder/tree/master/src/plugin/settings"
click UI "https://github.com/uphy/obsidian-reminder/tree/master/src/ui"
click PluginUI "https://github.com/uphy/obsidian-reminder/tree/master/src/plugin/ui"
click Docs "https://github.com/uphy/obsidian-reminder/tree/master/docs"
```
