# akuk7/dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/akuk7/dashboard
- Repository: https://github.com/akuk7/dashboard

## Overview

##### Project Type and Purpose
- This is a single-page, front-end React application built with TypeScript and Vite.
- The feature set (AddHabit, HabitTracker/Dashboard, BreakTracker/Dashboard, DigitalJournal, TodoKanban, WatchList, DayCounter, SpotifyPlayer) indicates a personal productivity/dashboard app that tracks habits, breaks, tasks, journaling, watch lists, and music.

##### File Structure Analysis
- Top-level:
- public/ – static assets (favicon, index.html).
- src/ – application source.
- eslint.config.js, tsconfig*.json, vite.config.ts – linting, TypeScript, and build configuration.
- src/components/ – React UI components organized by feature.
- src/lib/ – external-service connectors (supabase.ts).
- src/models/ – client-side data models (editor/viewer models, distribution, category).
- src/types/ – TypeScript type definitions for journals, todos, breaks, habits, watch lists.
- src/App.tsx, main.tsx – application entry points (root component mounting, routing if any).

##### Insights from README
- This is the official React-TypeScript Vite template; no custom backend in this repo.
- Supabase (via src/lib/supabase.ts) is the primary data backend (authentication + database).
- No separate microservice code—backend is fully managed by Supabase; client talks directly to Supabase APIs.

a. Main Components
- Browser (User Agent)
- Vite Development/Build Server (dev HMR & build pipeline)
- React SPA (App.tsx)
– UI Modules (components for Habits, Breaks, Journal, Todos, WatchList, DayCounter, SpotifyPlayer)
– State/Model Layer (src/models + React state/hooks)
– Service Layer (supabase client, third-party Spotify API calls)
- External Services
– Supabase (Auth + Postgres Database)
– Spotify Web API
b. Interactions
- User interacts with UI Modules → triggers React events/hook calls
- React SPA → supabase.ts client → CRUD on Supabase Auth & Database
- React SPA → SpotifyPlayer component → fetch/stream data via Spotify Web API
- Data responses flow back to UI via service layer → state/models → re-render components
c. Architectural Patterns & Principles
- Component-based UI (React) with feature grouping
- Clear separation of concerns: UI, data models, service clients
- Direct client-to-backend communication (serverless architecture leveraging Supabase)
- Type safety via TypeScript types and models
d. Key Technologies
- Vite + @vitejs/plugin-react (build & dev server)
- React 18 + TypeScript
- Supabase JavaScript client
- Spotify Web API
- ESLint + Type-checked linting rules

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top layer: User Agent and Dev Server
    Browser["User Browser"]:::external
    Vite["Vite Dev/Build Server"]:::service
    click Vite "https://github.com/akuk7/dashboard/blob/main/vite.config.ts"

    Browser -->|"loads SPA"| ReactSPA

    %% React SPA Layer
    subgraph "React SPA" 
        direction TB
        ReactSPA["React SPA"]:::frontend
        click ReactSPA "https://github.com/akuk7/dashboard/blob/main/src/App.tsx"
        click ReactSPA "https://github.com/akuk7/dashboard/blob/main/src/main.tsx"

        %% UI Modules
        subgraph "UI Modules"
            direction TB
            AddHabit["AddHabit Component"]:::frontend
            click AddHabit "https://github.com/akuk7/dashboard/blob/main/src/components/AddHabit.tsx"
            HabitTracker["HabitTracker"]:::frontend
            click HabitTracker "https://github.com/akuk7/dashboard/blob/main/src/components/HabitTracker.tsx"
            HabitDashboard["HabitDashboard"]:::frontend
            click HabitDashboard "https://github.com/akuk7/dashboard/blob/main/src/components/HabitDashboard.tsx"
            BreakTracker["BreakTracker"]:::frontend
            click BreakTracker "https://github.com/akuk7/dashboard/blob/main/src/components/BreakTracker.tsx"
            BreakDashboard["BreakDashboard"]:::frontend
            click BreakDashboard "https://github.com/akuk7/dashboard/blob/main/src/components/BreakDashboard.tsx"
            DigitalJournal["DigitalJournal"]:::frontend
            click DigitalJournal "https://github.com/akuk7/dashboard/blob/main/src/components/DigitalJournal.tsx"
            TodoKanban["TodoKanban"]:::frontend
            click TodoKanban "https://github.com/akuk7/dashboard/blob/main/src/components/TodoKanban.tsx"
            WatchList["WatchList"]:::frontend
            click WatchList "https://github.com/akuk7/dashboard/blob/main/src/components/WatchList.tsx"
            DayCounter["DayCounter"]:::frontend
            click DayCounter "https://github.com/akuk7/dashboard/blob/main/src/components/DayCounter.tsx"
            SpotifyPlayer["SpotifyPlayer"]:::frontend
            click SpotifyPlayer "https://github.com/akuk7/dashboard/blob/main/src/components/SpotifyPlayer.tsx"
            HeroSection["HeroSection"]:::frontend
            click HeroSection "https://github.com/akuk7/dashboard/blob/main/src/components/HeroSection.tsx"
            Navbar["Navbar"]:::frontend
            click Navbar "https://github.com/akuk7/dashboard/blob/main/src/components/Navbar.tsx"
        end

        %% Model Layer
        subgraph "State / Model Layer"
            direction TB
            CategoryModel["CategoryModel"]:::model
            click CategoryModel "https://github.com/akuk7/dashboard/blob/main/src/models/CategoryModel.tsx"
            EditorModel["EditorModel"]:::model
            click EditorModel "https://github.com/akuk7/dashboard/blob/main/src/models/EditorModel.tsx"
            TodoEditorModel["TodoEditorModel"]:::model
            click TodoEditorModel "https://github.com/akuk7/dashboard/blob/main/src/models/TodoEditorModel.tsx"
            ViewerModel["ViewerModel"]:::model
            click ViewerModel "https://github.com/akuk7/dashboard/blob/main/src/models/ViewerModel.tsx"
            WeeklyTaskDistribution["WeeklyTaskDistribution"]:::model
            click WeeklyTaskDistribution "https://github.com/akuk7/dashboard/blob/main/src/models/WeeklyTaskDistribution.tsx"
        end

        %% Service Layer
        subgraph "Service Layer"
            direction TB
            SupabaseClient["Supabase Client"]:::service
            click SupabaseClient "https://github.com/akuk7/dashboard/blob/main/src/lib/supabase.ts"
        end

        %% Type Definitions
        subgraph "Type Definitions"
            direction TB
            JournalTypes["JournalTypes"]:::model
            click JournalTypes "https://github.com/akuk7/dashboard/blob/main/src/types/JournalTypes.ts"
            TodoTypes["TodoTypes"]:::model
            click TodoTypes "https://github.com/akuk7/dashboard/blob/main/src/types/TodoTypes.ts"
            BreakTypes["BreakTypes"]:::model
            click BreakTypes "https://github.com/akuk7/dashboard/blob/main/src/types/break.ts"
            HabitTypes["HabitTypes"]:::model
            click HabitTypes "https://github.com/akuk7/dashboard/blob/main/src/types/habit.ts"
            WatchListTypes["WatchListTypes"]:::model
            click WatchListTypes "https://github.com/akuk7/dashboard/blob/main/src/types/watchList.ts"
        end

        %% Config & Assets
        subgraph "Config & Assets"
            direction TB
            ESLint["eslint.config.js"]:::service
            click ESLint "https://github.com/akuk7/dashboard/blob/main/eslint.config.js"
            TSConfig["tsconfig*.json"]:::service
            click TSConfig "https://github.com/akuk7/dashboard/blob/main/tsconfig.json"
            README["README.md"]:::service
            click README "https://github.com/akuk7/dashboard/blob/main/README.md"
            PublicIndex["public/index.html"]:::service
            click PublicIndex "https://github.com/akuk7/dashboard/blob/main/public/index.html"
            CSS["src/index.css / src/App.css"]:::service
            click CSS "https://github.com/akuk7/dashboard/blob/main/src/index.css"
        end
    end

    %% External Services
    subgraph "External Services"
        direction TB
        SupabaseAuth["Supabase Auth"]:::external
        SupabaseDB["Supabase Postgres DB"]:::db
        SpotifyAPI["Spotify Web API"]:::external
    end

    %% Connections
    Browser --> ReactSPA
    ReactSPA -->|"renders UI"| AddHabit
    ReactSPA --> HabitTracker
    ReactSPA --> BreakTracker
    ReactSPA --> DigitalJournal
    ReactSPA --> TodoKanban
    ReactSPA --> WatchList
    ReactSPA --> DayCounter
    ReactSPA --> SpotifyPlayer

    AddHabit --> CategoryModel
    AddHabit --> SupabaseClient
    HabitTracker --> CategoryModel
    HabitTracker --> SupabaseClient
    BreakTracker --> SupabaseClient
    DigitalJournal --> ViewerModel
    DigitalJournal --> SupabaseClient
    TodoKanban --> TodoEditorModel
    TodoKanban --> SupabaseClient
    WatchList --> SupabaseClient
    DayCounter --> SupabaseClient
    SpotifyPlayer --> SpotifyAPI

    SupabaseClient --> SupabaseAuth
    SupabaseClient --> SupabaseDB
    SpotifyPlayer --> SpotifyAPI

    SupabaseAuth -->|token| SupabaseClient
    SupabaseDB -->|data| SupabaseClient

    %% Styles
    classDef frontend fill:#f9f,stroke:#333,stroke-width:1px
    classDef service fill:#ccf,stroke:#333,stroke-width:1px
    classDef model fill:#cfc,stroke:#333,stroke-width:1px
    classDef external fill:#fcf,stroke:#333,stroke-width:1px
    classDef db fill:#ffc,stroke:#333,stroke-width:1px
```
