# 0himu1/the-noor-jar architecture

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

- Interactive diagram: https://gitdiagram.com/0himu1/the-noor-jar
- Repository: https://github.com/0himu1/the-noor-jar

## Overview

##### Main Components

A. Frontend Layer:
- React Application Core
- Page Components (HomePage, VersesPage)
- Reusable Components (MoodCard, VerseCard)
- Static Data Management (moods, initialVerses)

B. Data Persistence Layer:
- IndexedDB (via Dexie.js)
- Local Storage Management

C. External Services:
- Web Share API Integration
- HTML-to-Image Conversion Service

**┌─────────────────────────────────────┐**
- Presentation             │
- (React Components + Tailwind CSS)  │
- ┘
- ↕
**┌─────────────────────────────────────┐**
- Application Logic           │
- (State Management + Services)    │
- ┘
- ↕
**┌─────────────────────────────────────┐**
- Data Persistence            │
- (IndexedDB via Dexie.js)      │
- ┘

##### Component Relationships

- Rectangles: Core components
- Rounded rectangles: Services
- Hexagons: External APIs

- Blue: UI components
- Green: Data storage
- Orange: External services
- Purple: Application logic

##### Detailed Component Breakdown

A. Presentation Layer (Blue):
- MoodCard and VerseCard as child components

B. Application Logic (Purple):
- Mood selection handler
- Verse filtering system
- Image generation service
- Share functionality

C. Data Layer (Green):
- IndexedDB storage for verses
- Static mood configurations
- Caching mechanism

D. External Services (Orange):
- Web Share API
- HTML-to-Image conversion

##### Data Flow Indicators

- User interaction flow
- Data retrieval paths
- Storage operations
- External API calls

##### Technical Stack Indicators

Technology labels:
- React + TypeScript
- Tailwind CSS
- Dexie.js
- Web Share API
- HTML-to-Image library

##### The clear separation between UI, logic, and data layers

Keep the abstraction level focused on the architectural components while including enough detail to show the unique features of the mood-based verse selection and sharing capabilities.

Remember to indicate the responsive nature of the application and how it handles offline scenarios through IndexedDB, as these are crucial aspects of the application's architecture.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        RC[React Core]
        PC[Page Components]
        COMP[Reusable Components]
        SD[Static Data]
        
        subgraph Pages
            HP["HomePage"]
            VP["VersesPage"]
        end
        
        subgraph Components
            MC["MoodCard"]
            VC["VerseCard"]
        end
        
        subgraph StaticData
            M["Moods"]
            IV["Initial Verses"]
        end
        
        PC --> Pages
        COMP --> Components
        SD --> StaticData
    end
    
    subgraph ApplicationLogic
        SM[State Management]
        TS[TypeScript Types]
        CSS[Styling System]
        BC[Build Config]
    end
    
    subgraph DataPersistence
        IDB[(IndexedDB)]
        LS[(LocalStorage)]
    end
    
    subgraph ExternalServices
        WS{Web Share API}
        HTI{HTML-to-Image}
    end
    
    %% Relationships
    RC --> PC
    RC --> COMP
    PC --> SD
    COMP --> SD
    Components --> SM
    SM --> IDB
    VC --> HTI
    HTI --> WS
    
    %% Click Events
    click RC "https://github.com/0Himu1/the-noor-jar/blob/main/src/App.tsx"
    click HP "https://github.com/0Himu1/the-noor-jar/blob/main/src/pages/HomePage.tsx"
    click VP "https://github.com/0Himu1/the-noor-jar/blob/main/src/pages/VersesPage.tsx"
    click MC "https://github.com/0Himu1/the-noor-jar/blob/main/src/components/MoodCard.tsx"
    click VC "https://github.com/0Himu1/the-noor-jar/blob/main/src/components/VerseCard.tsx"
    click M "https://github.com/0Himu1/the-noor-jar/blob/main/src/data/moods.ts"
    click IV "https://github.com/0Himu1/the-noor-jar/blob/main/src/data/initialVerses.ts"
    click IDB "https://github.com/0Himu1/the-noor-jar/blob/main/src/db/index.ts"
    click TS "https://github.com/0Himu1/the-noor-jar/blob/main/src/types/index.ts"
    click CSS "https://github.com/0Himu1/the-noor-jar/blob/main/src/index.css"
    click BC "https://github.com/0Himu1/the-noor-jar/blob/main/vite.config.ts"
    
    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef storage fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white
    classDef logic fill:#9b59b6,stroke:#8e44ad,color:white
    
    class RC,PC,COMP,SD,HP,VP,MC,VC,M,IV frontend
    class IDB,LS storage
    class WS,HTI external
    class SM,TS,CSS,BC logic
    
    %% Legend
    subgraph Legend
        UI[UI Component]:::frontend
        ST[(Storage)]:::storage
        EX{External Service}:::external
        LG[Logic Component]:::logic
    end
```
