# marwan/quranwbw architecture

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

- Interactive diagram: https://gitdiagram.com/marwan/quranwbw
- Repository: https://github.com/marwan/quranwbw

## Overview

##### Main Components

Frontend Architecture (Primary Focus):
- Client-Side Application (SvelteKit)
- UI Components Layer
- Data Management Layer
- Audio Controller System
- Settings Management
- Navigation System

##### Component Relationships

A. Core Application Structure:
**[Client Browser] → [SvelteKit Application]**
- Routing Layer (+layout.js, +page.js files)
- View Components
- Utility Services

B. Feature Modules:
**[Display Module] ← → [Audio Controller]**
- ↓
**[Translation/Transliteration Engine]**
- ↓
**[Word Processing System]**

##### Detailed Component Breakdown

a) UI Layer (Top Level):
**[Navbar] ← → [Bottom Toolbar] ← → [Settings Drawer]**
- ↓             ↓                       ↓
**[Modal System] [Display Components] [Configuration]**

b) Core Features (Middle Layer):
**[Word-by-Word Display] ← → [Audio Controller]**
**[Tajweed Visualization] ← → [Translation Engine]**
**[Morphology Analysis]   ← → [Tafsir System]**

c) Data Management (Bottom Layer):
**[Local Storage] ← → [Cloud Settings]**
**[State Stores]  ← → [Configuration]**

**[Word Processing]**
- Translation System
- Transliteration Engine
- Tajweed Rules
- Morphology Analysis

**[Audio System]**
- Word-by-Word Playback
- Verse Recitation
- Multiple Reciters

##### Implementation Details

- SvelteKit's file-based routing system
- Component hierarchy (src/components structure)
- State management using Svelte stores
- Modal system for feature interactions
- Settings management and synchronization
- Multi-language support architecture

##### Key Interactions

Critical flows:
**User Input → Router → Page Component → Feature Module → Data Layer**
**Settings Changes → State Store → UI Update → Cloud Sync**
**Audio Playback → Controller → UI Feedback → State Update**

##### Technical Notes

Architectural patterns:
- Component-based architecture (Svelte)
- Client-side routing (SvelteKit)
- State management (Svelte stores)
- Event-driven interactions
- Responsive design system
- Modular feature implementation

Remember to highlight the unique aspects of QuranWBW, such as the word-by-word translation system, audio integration, and multiple display layouts, while showing how they integrate with the core SvelteKit architecture.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph "SvelteKit Application"
        Router["Routing Layer"]:::router
        click Router "https://github.com/marwan/quranwbw/tree/main/src/routes/"

        subgraph "UI Layer"
            direction TB
            Navbar["Navigation Bar"]:::ui
            click Navbar "https://github.com/marwan/quranwbw/blob/main/src/components/ui/Navbar.svelte"
            BottomToolbar["Bottom Toolbar"]:::ui
            click BottomToolbar "https://github.com/marwan/quranwbw/tree/main/src/components/ui/BottomToolbar/"
            Settings["Settings Drawer"]:::ui
            click Settings "https://github.com/marwan/quranwbw/tree/main/src/components/ui/SettingsDrawer/"
            Modals["Modal System"]:::ui
            click Modals "https://github.com/marwan/quranwbw/tree/main/src/components/ui/Modals/"
        end

        subgraph "Feature Modules"
            direction TB
            DisplayModule["Display Module"]:::feature
            click DisplayModule "https://github.com/marwan/quranwbw/tree/main/src/components/display/"
            
            subgraph "Layout System"
                direction TB
                Continuous["Continuous Layout"]:::layout
                click Continuous "https://github.com/marwan/quranwbw/blob/main/src/components/display/layouts/Continuous.svelte"
                Normal["Normal Layout"]:::layout
                click Normal "https://github.com/marwan/quranwbw/blob/main/src/components/display/layouts/Normal.svelte"
                SideBySide["Side by Side Layout"]:::layout
                click SideBySide "https://github.com/marwan/quranwbw/blob/main/src/components/display/layouts/SideBySide.svelte"
                WordByWord["Word By Word Layout"]:::layout
                click WordByWord "https://github.com/marwan/quranwbw/blob/main/src/components/display/layouts/WordByWord.svelte"
            end

            AudioController["Audio Controller"]:::feature
            click AudioController "https://github.com/marwan/quranwbw/blob/main/src/utils/audioController.js"
            WordProcessor["Word Processing System"]:::feature
            click WordProcessor "https://github.com/marwan/quranwbw/blob/main/src/components/display/verses/Word.svelte"
            TransEngine["Translation/Transliteration Engine"]:::feature
            click TransEngine "https://github.com/marwan/quranwbw/tree/main/src/components/display/verses/translations/"
        end

        subgraph "Data Management"
            direction TB
            StateStores["State Stores"]:::data
            click StateStores "https://github.com/marwan/quranwbw/blob/main/src/utils/stores.js"
            LocalStorage["Local Storage"]:::data
            CloudSync["Cloud Settings"]:::data
            click CloudSync "https://github.com/marwan/quranwbw/blob/main/src/utils/cloudSettings.js"
            DataLayer["Data Layer"]:::data
            click DataLayer "https://github.com/marwan/quranwbw/tree/main/src/data/"
        end
    end

    %% Relationships
    Browser --> Router
    Router --> DisplayModule
    DisplayModule --> WordProcessor
    WordProcessor --> TransEngine
    DisplayModule --> AudioController
    
    Navbar --> Modals
    BottomToolbar --> DisplayModule
    Settings --> StateStores
    
    StateStores --> CloudSync
    StateStores --> LocalStorage
    StateStores --> DisplayModule

    %% Styles
    classDef ui fill:#2196F3,stroke:#1565C0,color:#fff
    classDef feature fill:#4CAF50,stroke:#2E7D32,color:#fff
    classDef data fill:#FFC107,stroke:#FFA000,color:#000
    classDef router fill:#9C27B0,stroke:#7B1FA2,color:#fff
    classDef layout fill:#FF5722,stroke:#E64A19,color:#fff

    %% Legend
    subgraph Legend
        UI["UI Components"]:::ui
        Features["Feature Modules"]:::feature
        Data["Data Management"]:::data
        Routing["Routing"]:::router
        Layouts["Layouts"]:::layout
    end
```
