# muhammadtalhasultan/sirat-e-mustaqeem architecture

> Architecture diagram of the GitHub repository muhammadtalhasultan/sirat-e-mustaqeem, 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/muhammadtalhasultan/sirat-e-mustaqeem
- Repository: https://github.com/muhammadtalhasultan/sirat-e-mustaqeem

## Overview

##### Major Components
- Mobile Application: Represent the overall Flutter app that spans both Android and iOS.
- Presentation Layer (UI): This is handled by Flutter widgets, screens, and layouts found in directories like lib/src/features/[feature]/screen and lib/src/features/[feature]/widget.
- Business Logic Layer: Emphasize the BLoC pattern being used. Each major feature (e.g., Allah Names, Quran, Bookmark, Prayer Timing, Tasbih, etc.) has its dedicated BLoC subfolder managing events, states, and business logic.
- Data & Network Layer: Identify services for API interactions (lib/src/core/network), local databases (lib/src/core/database), and error handling (lib/src/core/error). These modules are responsible for fetching data from external sources or local storage.
- Controllers and Utilities: Mark the role of controllers (located in lib/src/core/util/controller and lib/src/features/[feature]/controller) and utility models that help connect UI and BLoCs.
- Assets and Resources: Include the folder for assets (images, fonts, sound) and configuration files that support the UI (design and theming in lib/src/core/theme, assets folder etc.).

##### Relationships and Interactions
- The UI (Screens/Widgets) initiates user interactions, sending events to the corresponding BLoC.
- The BLoC layer processes events using business logic, fetching or updating data via the Data/Network layer or through local controllers.
- Data is retrieved from services such as the API service (lib/src/core/network/api_service.dart) or the local database service (lib/src/core/database/database_service.dart) and then stream updates back to the UI.
- Error handling and notification modules sit alongside, catching failures and informing the UI (via BLoC state updates) to render error dialogs or notifications.
- You might also include a “Feature Modules” compartment that visually separates key functionalities (e.g., Quran, Dua, Tasbih, Prayer Timing, Qibla, etc.), each of which follows the same general pattern of UI → BLoC → Data Services.

##### Architectural Patterns & Design Principles
- Use of the BLoC pattern for state management.
- Modular approach where each feature is self-contained (with its own BLoC, UI, and sometimes controllers), which allows for better separation of concerns.
- Recognize the layered architecture: presentation (UI), business logic (BLoC and controllers), and data (network/database/error handling).

##### Relevant Technologies & Frameworks
- Flutter as the development framework supporting both Android and iOS (the android/ and ios/ directories give context).
- Dart as the programming language.
- BLoC library/pattern (evident in many directories under lib/src/core/util/bloc and lib/src/features/[feature]/bloc).
- Other Flutter plugins responsible for notifications, location, permissions, etc. (these might be referenced in the dependency configuration in pubspec.yaml).

- Under the app, delineate:
- UI Layer: Show components like “Splash Screen”, “Home Screen”, “Quran Screen”, “Dua Screen”, “Tasbih Screen”, etc.
- Utility/Controller Layer: Show “Location Controller”, “Notification Controller”, etc., often used by both BLoCs and UI components.
- Enclose static assets usage by referencing the Assets directory (images, fonts, sounds) used by the UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Application Layer
    entryPoint["Mobile App Entry Point"]:::app

    %% Presentation Layer
    subgraph "Presentation Layer"
        splashUI["Splash Screen UI"]:::ui
        homeUI["Home Screen UI"]:::ui
        quranUI["Quran Screen UI"]:::ui
        duaUI["Dua Screen UI"]:::ui
        tasbihUI["Tasbih Screen UI"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        coreBloc["Core BLoC Utilities"]:::bloc
        quranBloc["Quran BLoC"]:::bloc
        duaBloc["Dua BLoC"]:::bloc
        tasbihBloc["Tasbih BLoC"]:::bloc
        allahNameBloc["Allah Name BLoC"]:::bloc
    end

    %% Controllers & Utilities Layer
    subgraph "Controllers & Utilities"
        coreController["Core Controllers"]:::controller
        splashController["Splash Controller"]:::controller
        quranController["Quran Controller"]:::controller
        duaController["Dua Controller"]:::controller
    end

    %% Data & Network Layer
    subgraph "Data & Network Layer"
        apiService["API Service"]:::data
        networkClient["Network Client"]:::data
        databaseService["Database Service"]:::data
        errorHandling["Error Handling Modules"]:::data
    end

    %% Assets & Resources Layer
    subgraph "Assets & Resources"
        assets["Assets"]:::assets
        themeConfig["Theme Configuration"]:::assets
        androidCfg["Android Config"]:::assets
        iosCfg["iOS Config"]:::assets
    end

    %% Connections from Mobile App Entry Point to Presentation Layer and Assets
    entryPoint -->|"starts"| splashUI
    entryPoint -->|"starts"| homeUI
    entryPoint -->|"starts"| quranUI
    entryPoint -->|"starts"| duaUI
    entryPoint -->|"starts"| tasbihUI
    entryPoint -->|"loads"| assets
    entryPoint -->|"applies"| themeConfig
    entryPoint -->|"platform"| androidCfg
    entryPoint -->|"platform"| iosCfg

    %% UI to Controllers connections
    splashUI -->|"triggers"| splashController
    quranUI -->|"triggers"| quranController
    duaUI -->|"triggers"| duaController

    %% Controllers to BLoC connections
    splashController -->|"calls"| coreBloc
    quranController -->|"calls"| quranBloc
    duaController -->|"calls"| duaBloc

    %% Additional UI direct connection
    homeUI -->|"navigates"| coreBloc

    %% BLoC to Data & Network Layer connections
    coreBloc -->|"fetches"| apiService
    coreBloc -->|"fetches"| databaseService
    quranBloc -->|"fetches"| apiService
    quranBloc -->|"fetches"| networkClient
    duaBloc -->|"fetches"| apiService
    tasbihBloc -->|"fetches"| databaseService
    allahNameBloc -->|"fetches"| apiService

    %% Data Layer error notifications
    apiService -->|"errors"| errorHandling
    networkClient -->|"errors"| errorHandling

    %% Controllers reusing core utilities
    splashController -.->|"utilizes"| coreController
    quranController -.->|"utilizes"| coreController
    duaController -.->|"utilizes"| coreController

    %% Click Events
    click entryPoint "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/main.dart"
    click homeUI "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/features/home/screen/home_screen.dart"
    click quranUI "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/features/quran/screen/quran_screen.dart"
    click coreBloc "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/lib/src/core/util/bloc"
    click quranBloc "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/lib/src/features/quran/bloc"
    click tasbihBloc "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/lib/src/features/tasbih/bloc"
    click duaBloc "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/lib/src/features/dua/bloc"
    click apiService "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/core/network/api_service.dart"
    click networkClient "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/core/network/network_client.dart"
    click databaseService "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/core/database/database_service.dart"
    click errorHandling "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/lib/src/core/error"
    click coreController "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/lib/src/core/util/controller"
    click duaController "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/features/dua/controller/dua_controller.dart"
    click quranController "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/features/quran/controller/quran_controller.dart"
    click splashController "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/features/splash/controller/splash_controller.dart"
    click assets "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/assets/"
    click themeConfig "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/blob/master/lib/src/core/theme.dart"
    click androidCfg "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/android/"
    click iosCfg "https://github.com/muhammadtalhasultan/sirat-e-mustaqeem/tree/master/ios/"

    %% Styles
    classDef app fill:#CFE2F3,stroke:#3366CC,stroke-width:2px;
    classDef ui fill:#FCE4D6,stroke:#E69138,stroke-width:2px;
    classDef bloc fill:#D9EAD3,stroke:#6AA84F,stroke-width:2px;
    classDef controller fill:#EAD1DC,stroke:#CC0000,stroke-width:2px;
    classDef data fill:#D0E0E3,stroke:#1155CC,stroke-width:2px;
    classDef assets fill:#FFF2CC,stroke:#BF9000,stroke-width:2px;
```
