# profhameed/pisopal architecture

> Architecture diagram of the GitHub repository profhameed/pisopal, 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/profhameed/pisopal
- Repository: https://github.com/profhameed/pisopal

## Overview

##### Main Components

a. Client-Side (Mobile Application):
- Present this as the top-level layer
- Divide into three main modules:
- UI Layer (Pages & Widgets)
- Business Logic Layer (Controllers)
- Data Layer (Models & Repository)

b. Authentication Services:
- Multiple auth providers:
- Google Sign-In
- Facebook Sign-In
- Apple Sign-In

c. Local Storage:
- SQLite Database
- Shared Preferences

d. Backend Services (implied by network directory)

##### Component Relationships

**[Mobile App]**
- UI Layer
- Pages (Login, Signup, Dashboard, Questions)
- Widgets (Custom Components)

- Controller Layer
- Business Logic Controllers

- Data Layer
- Models
- Repository
- Network Services

- Authentication Layer
- Google Auth
- Facebook Auth
- Apple Auth

- Storage Layer
- SQLite
- Shared Preferences

##### Specific Implementation Details

a. Flow sequence:
1. User Authentication Flow
2. Questionnaire Flow
3. Dashboard Data Flow
4. Success Path Flow

b. Architectural patterns:
- MVC pattern (evident from the directory structure)
- Repository pattern (for data management)
- Service pattern (for auth services)

##### Technical Specifications

- Flutter Framework (Mobile UI)
- Native Platforms (iOS/Android)
- Local Storage Solutions
- Authentication Providers
- Network Layer Implementation

##### Additional Elements

Specific features:
- Currency formatting utilities
- Age calculation functionality
- Category determination logic
- Picture encoding/decoding utilities

##### Data Flow Indicators

- User input flow
- Authentication flow
- Data persistence flow
- API communication flow

Remember to:
- Keep the main components clearly separated
- Bidirectional relationships where applicable
- Version/environment indicators
- Platform-specific implementations

This system design should give a clear understanding of how the application's components interact while maintaining a level of detail that's useful for both high-level understanding and detailed implementation references.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Mobile_Application
        subgraph UI_Layer
            Pages["Pages"]:::ui
            Widgets["Widgets"]:::ui
        end

        subgraph Business_Logic_Layer
            Controllers["Controllers"]:::controller
        end

        subgraph Data_Layer
            Models["Models"]:::data
            Repository["Repository"]:::data
            NetworkServices["Network Services"]:::data
        end

        subgraph Authentication_Layer
            AuthManager["Auth Manager"]:::auth
            GoogleAuth["Google Sign-In"]:::auth
            FacebookAuth["Facebook Sign-In"]:::auth
            AppleAuth["Apple Sign-In"]:::auth
        end

        subgraph Storage_Layer
            SQLite["SQLite Database"]:::storage
            SharedPrefs["Shared Preferences"]:::storage
        end

        subgraph Utility_Services
            CurrencyFormat["Currency Formatter"]:::util
            AgeCalc["Age Calculator"]:::util
            CategoryDet["Category Determiner"]:::util
            PicEncDec["Picture Encoder/Decoder"]:::util
        end

        subgraph Theme_Layer
            ThemeData["Theme Data"]:::theme
            TextStyles["Text Styles"]:::theme
        end
    end

    %% Relationships
    Pages --> Controllers
    Widgets --> Controllers
    Controllers --> Repository
    Repository --> Models
    Repository --> NetworkServices
    Repository --> SQLite
    Repository --> SharedPrefs
    AuthManager --> GoogleAuth
    AuthManager --> FacebookAuth
    AuthManager --> AppleAuth
    Controllers --> AuthManager
    Pages --> ThemeData
    Pages --> TextStyles
    Controllers --> Utility_Services

    %% Click Events
    click Pages "https://github.com/Profhameed/pisopal/tree/master/lib/pages"
    click Widgets "https://github.com/Profhameed/pisopal/tree/master/lib/widgets"
    click Controllers "https://github.com/Profhameed/pisopal/tree/master/lib/controllers"
    click Models "https://github.com/Profhameed/pisopal/tree/master/lib/data/models"
    click Repository "https://github.com/Profhameed/pisopal/blob/master/lib/data/repository.dart"
    click NetworkServices "https://github.com/Profhameed/pisopal/blob/master/lib/data/network/network.dart"
    click GoogleAuth "https://github.com/Profhameed/pisopal/blob/master/lib/shared/GoogleSignInApi.dart"
    click FacebookAuth "https://github.com/Profhameed/pisopal/blob/master/lib/shared/facebookSignInApi.dart"
    click AppleAuth "https://github.com/Profhameed/pisopal/blob/master/lib/shared/appleSignInApi.dart"
    click AuthManager "https://github.com/Profhameed/pisopal/blob/master/lib/shared/auth_manager.dart"
    click SQLite "https://github.com/Profhameed/pisopal/blob/master/lib/data/sqlite/database_helper.dart"
    click SharedPrefs "https://github.com/Profhameed/pisopal/blob/master/lib/shared/prefs_helper.dart"
    click CurrencyFormat "https://github.com/Profhameed/pisopal/blob/master/lib/utils/currencyformatter.dart"
    click AgeCalc "https://github.com/Profhameed/pisopal/blob/master/lib/utils/calculate_age.dart"
    click CategoryDet "https://github.com/Profhameed/pisopal/blob/master/lib/utils/category_determiner.dart"
    click PicEncDec "https://github.com/Profhameed/pisopal/blob/master/lib/utils/pic_enc_dec.dart"
    click ThemeData "https://github.com/Profhameed/pisopal/blob/master/lib/shared/theme_data.dart"
    click TextStyles "https://github.com/Profhameed/pisopal/blob/master/lib/shared/app_text_styles.dart"

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef controller fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white
    classDef storage fill:#9b59b6,stroke:#8e44ad,color:white
    classDef util fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef theme fill:#1abc9c,stroke:#16a085,color:white
```
