# shehryar-dev/al_quran architecture

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

- Interactive diagram: https://gitdiagram.com/shehryar-dev/al_quran
- Repository: https://github.com/shehryar-dev/al_quran

## Overview

##### Main Components
- Frontend (Flutter UI Layer):
- Primary "presentation" layer, which contains screens (home_screen, surat_screen, splash_screen, etc.) and common reusable widgets.
- "lib/presentation" folder and its subdirectories, where UI components, widgets, and screen-specific logic reside.
- Business Logic Layer (State Management with Bloc):
- Blocs under "lib/presentation/blocs" for handling state (e.g., adhan_time_bloc, asma_al_husna_bloc, bookmark_bloc, etc.).
- Data Layer:
- "lib/data" directory that contains models (Freezed models for surahs, bookmarks, etc.), repositories (e.g., quran_repository, adhan_repository), network services (using Dio-based API services), and API response handling.
- How repositories interface with both remote APIs (Quran API, Qibla API, Prayer Time API) and potentially local storages.
- Core Layer (Shared Utilities and Resources):
- Dependency Injection:
- Configuration:
- Routing and configuration files in "lib/config", showing how navigation between screens is managed.
- Platform-Specific Shells:
- Nodes for platform-specific components (android, ios, web, macos, windows, linux directories) to indicate that the same Flutter codebase targets multiple platforms.

##### Relationships and Interactions
- Data Flow:
- Dependency Injection:
- External Services:
- Shared Resources:
- A central node for "Core Resources" to indicate how constants, themes, and utilities are used by multiple layers.

##### Architectural Patterns and Design Principles
- Layered/Clean Architecture:
- Separation of concerns by grouping different parts of the application as discussed.
- Use of Bloc and GetIt:
- Bloc pattern to show state management and GetIt for dependency management.
- Scalability and Modularity:
- That the repository pattern in “lib/data/repositories” allows swapping between mock and HTTP API implementations (as noted in file names), illustrating flexibility.

##### Final Checklist
- All major components should be clearly labeled with their folder/role (UI, Bloc, Data, Core/Utils, DI, Config).
- Annotating components with key technologies (e.g., Flutter, Dart, Bloc, GetIt, Dio) to provide context.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer (Flutter UI Layer)
    subgraph "Frontend Layer (UI - Screens & Widgets)"
        UI["Presentation Layer\n(lib/presentation)"]:::ui
    end

    %% Business Logic Layer (Bloc)
    subgraph "Business Logic Layer (State Management - Bloc)"
        BLOC["Bloc Layer\n(lib/presentation/blocs)"]:::bloc
    end

    %% Data Layer (Models, Repositories, Network Services)
    subgraph "Data Layer"
        DATA["Data Layer\n(lib/data)"]:::data
        QA["Quran API"]:::external
        QI["Qibla API"]:::external
        PTA["PrayerTime API"]:::external
    end

    %% Core Layer (Shared Utilities and Resources)
    subgraph "Core Layer (Constants, Themes, Utils)"
        CORE["Core Resources\n(lib/core)"]:::core
    end

    %% Dependency Injection
    subgraph "Dependency Injection"
        DI["Service Locator\n(lib/di/service_locator.dart)"]:::di
    end

    %% Configuration (Routing and App Setup)
    subgraph "Configuration"
        CONFIG["App Configuration\n(lib/config)"]:::config
    end

    %% Platform-Specific Shells
    subgraph "Platform-Specific Shells"
        ANDROID["Android"]:::platform
        IOS["iOS"]:::platform
        LINUX["Linux"]:::platform
        MACOS["MacOS"]:::platform
        WINDOWS["Windows"]:::platform
        WEB["Web"]:::platform
    end

    %% Data Flow Arrows
    UI -->|"event_dispatching"| BLOC
    BLOC -->|"api_calls"| DATA
    DATA -->|"response_data"| BLOC
    BLOC -->|"state_update"| UI

    %% External API interactions
    DATA -->|"calls"| QA
    DATA -->|"calls"| QI
    DATA -->|"calls"| PTA

    %% Dependency Injection relationships
    DI -->|"injects"| BLOC
    DI -->|"injects"| DATA
    DI -->|"injects"| CORE

    %% Configuration integration
    CONFIG -->|"routes_to"| UI

    %% Platform-specific support noted for mobile and desktop
    UI --- ANDROID
    UI --- IOS
    UI --- LINUX
    UI --- MACOS
    UI --- WINDOWS
    UI --- WEB

    %% Click Events
    click UI "https://github.com/shehryar-dev/al_quran/tree/main/lib/presentation"
    click BLOC "https://github.com/shehryar-dev/al_quran/tree/main/lib/presentation/blocs"
    click DATA "https://github.com/shehryar-dev/al_quran/tree/main/lib/data"
    click CORE "https://github.com/shehryar-dev/al_quran/tree/main/lib/core"
    click DI "https://github.com/shehryar-dev/al_quran/blob/main/lib/di/service_locator.dart"
    click CONFIG "https://github.com/shehryar-dev/al_quran/tree/main/lib/config"
    click ANDROID "https://github.com/shehryar-dev/al_quran/tree/main/android"
    click IOS "https://github.com/shehryar-dev/al_quran/tree/main/ios"
    click LINUX "https://github.com/shehryar-dev/al_quran/tree/main/linux"
    click MACOS "https://github.com/shehryar-dev/al_quran/tree/main/macos"
    click WINDOWS "https://github.com/shehryar-dev/al_quran/tree/main/windows"
    click WEB "https://github.com/shehryar-dev/al_quran/tree/main/web"

    %% Styles
    classDef ui fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef bloc fill:#C1F7C1,stroke:#333,stroke-width:2px;
    classDef data fill:#FFF5BA,stroke:#333,stroke-width:2px;
    classDef core fill:#F9D5E5,stroke:#333,stroke-width:2px;
    classDef di fill:#FFD1BA,stroke:#333,stroke-width:2px;
    classDef config fill:#E6E6FA,stroke:#333,stroke-width:2px;
    classDef platform fill:#D3BDF0,stroke:#333,stroke-width:2px;
    classDef external fill:#F5A9A9,stroke:#333,stroke-width:2px;
```
