# sedraalsabagh/salamhack architecture

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

- Interactive diagram: https://gitdiagram.com/sedraalsabagh/salamhack
- Repository: https://github.com/sedraalsabagh/salamhack

## Overview

##### Primary Components
- Cross-Platform Native Containers: Represent the native folders (android, ios, linux, macos, windows, web) as hosting environments. Although these are mostly boilerplate for Flutter deployment, they illustrate how the same codebase is adapted to run on different platforms.
- Core Flutter Application (in the “lib” folder): Divide this into:
- Presentation Layer: Includes screens, widgets, and routing (e.g., “presentaion/screen”, “app_router.dart”). This is the UI that the end users interact with.
- Business Logic Layer: Contains the state management components (all the cubits found under “lib/business_logic/cubit”) that manage application states such as authentication, CV/resume evaluation, job opportunities, quiz handling, recommendations, etc.
- Data Layer: Includes models (in “lib/data/models”), repositories (in “lib/data/repository”), and web services (in “lib/data/webService”). This layer is responsible for fetching, parsing, and processing data from external APIs or other sources.

##### Relationships and Data Flow
- The Presentation Layer’s screens and widgets send user interactions (such as navigation events or form submissions) to the Business Logic Layer.
- The Business Logic Layer (Cubit controllers) processes these inputs and, if needed, requests data from the Data Layer.
- The Data Layer communicates with external resources via Web Services, using Repository classes as an abstraction over API calls. Retrieved or updated data then flows back through the Cubit to update the UI.
- There should also be a clear separation when it comes to routing; the “app_router.dart” manages navigation between different screens.
- Optionally, highlight integration with platform-specific assets or native code by referencing the native directories.

##### Architectural Patterns and Technologies
- Use of Flutter as the cross-platform UI framework.
- Cubit (part of the Bloc state management pattern) for handling state.
- Repository pattern in the Data Layer, which abstracts the interaction with WebServices.
- Clear separation of concerns in line with MVC/MVVM principles, where the business logic and view layers are decoupled from data-fetching responsibilities.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Native Platforms
    subgraph "Native Platforms"
        Android["Android Platform"]
        iOS["iOS Platform"]
        Linux["Linux Platform"]
        macOS["macOS Platform"]
        Windows["Windows Platform"]
        Web["Web Platform"]
    end

    %% Flutter App Core
    subgraph "Flutter App Core"
        subgraph "Presentation Layer"
            UI1["Screens & Widgets"]
            UI2["Routing (app_router.dart)"]
        end
        subgraph "Business Logic Layer"
            Biz1["Cubit Controllers"]
        end
        subgraph "Data Layer"
            Data1["Data Models"]
            Data2["Repository Classes"]
            Data3["Web Services"]
        end
        subgraph "Constants & Utilities"
            Util1["Constants"]
            Util2["Animation Utilities"]
        end
    end

    %% Deployment arrows from Flutter UI to Native Platforms
    UI1 -->|"runs_on"| Android
    UI1 -->|"runs_on"| iOS
    UI1 -->|"runs_on"| Linux
    UI1 -->|"runs_on"| macOS
    UI1 -->|"runs_on"| Windows
    UI1 -->|"runs_on"| Web

    %% Navigation within Presentation Layer
    UI2 -->|"navigates_to"| UI1

    %% Interaction between Presentation and Business Logic Layers
    UI1 -->|"userAction"| Biz1

    %% Business Logic requesting data from Data Layer
    Biz1 -->|"request"| Data2

    %% Data Layer interactions
    Data2 -->|"API_call"| Data3
    Data3 -->|"response"| Data2
    Data2 -->|"update"| Biz1

    %% Business Logic updating the UI
    Biz1 -->|"state_update"| UI1

    %% Constants & Utilities supporting the Presentation Layer
    Util1 -->|"support"| UI1
    Util2 -->|"support"| UI1

    %% Click Events for Native Platforms
    click Android "https://github.com/sedraalsabagh/salamhack/tree/main//android"
    click iOS "https://github.com/sedraalsabagh/salamhack/tree/main//ios"
    click Linux "https://github.com/sedraalsabagh/salamhack/tree/main//linux"
    click macOS "https://github.com/sedraalsabagh/salamhack/tree/main//macos"
    click Windows "https://github.com/sedraalsabagh/salamhack/tree/main//windows"
    click Web "https://github.com/sedraalsabagh/salamhack/tree/main//web"

    %% Click Events for Presentation Layer
    click UI1 "https://github.com/sedraalsabagh/salamhack/tree/main//lib/presentaion/screen"
    click UI2 "https://github.com/sedraalsabagh/salamhack/blob/main//lib/app_router.dart"

    %% Click Event for Business Logic Layer
    click Biz1 "https://github.com/sedraalsabagh/salamhack/tree/main//lib/business_logic/cubit"

    %% Click Events for Data Layer
    click Data1 "https://github.com/sedraalsabagh/salamhack/tree/main//lib/data/models"
    click Data2 "https://github.com/sedraalsabagh/salamhack/tree/main//lib/data/repository"
    click Data3 "https://github.com/sedraalsabagh/salamhack/tree/main//lib/data/webService"

    %% Click Events for Constants & Utilities
    click Util1 "https://github.com/sedraalsabagh/salamhack/tree/main//lib/constants"
    click Util2 "https://github.com/sedraalsabagh/salamhack/tree/main//lib/Animation"

    %% Class Definitions for Color Coding
    classDef native fill:#9370DB,stroke:#4B0082,stroke-width:2px;
    classDef ui fill:#87CEFA,stroke:#1E90FF,stroke-width:2px;
    classDef biz fill:#90EE90,stroke:#32CD32,stroke-width:2px;
    classDef data fill:#FFA07A,stroke:#FF6347,stroke-width:2px;
    classDef utils fill:#F0E68C,stroke:#DAA520,stroke-width:2px;

    %% Assign classes to nodes
    class Android,iOS,Linux,macOS,Windows,Web native;
    class UI1,UI2 ui;
    class Biz1 biz;
    class Data1,Data2,Data3 data;
    class Util1,Util2 utils;
```
