# stockbuddy07/pg_helper architecture

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

- Interactive diagram: https://gitdiagram.com/stockbuddy07/pg_helper
- Repository: https://github.com/stockbuddy07/pg_helper

## Overview

##### Project type and purpose
- This is a cross-platform Flutter mobile/web/desktop application (“pg_helper”) that manages PG (paying guest) accommodations, user queries, room listings, payments, and administrative workflows.
- It uses Firebase as its backend (authentication, database, possibly storage/functions) and local preferences for storing small user settings.

##### File structure
- Top-level “lib” holds all Dart UI code: pages (e.g., HomePage, AdminHomePage, HelpDesk), models under “lib/models,” service wrappers (firebase_api.dart, firebase_options.dart), and utility code (saveSharePreferences.dart).
- Platform folders (“android,” “ios,” “linux,” “macos,” “windows,” “web”) contain generated Flutter host code and any native integration.
- Assets folder holds animations and static resources.
- pubspec.yaml defines dependencies; firebase.json and android/app/google-services.json configure Firebase.

##### README
- We deduce architecture by inspecting code organization and Firebase integration.

##### Detail
- Model class (or group them) under Data Models.
- Asset pipeline: animation JSON → UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation/UI Layer
    subgraph "Presentation/UI Layer"
        UI["Flutter UI Pages"]:::frontend
    end

    %% Data Models Layer
    subgraph "Data Models Layer"
        Models["Dart Model Classes"]:::model
    end

    %% Service Layer
    subgraph "Service Layer"
        API["firebase_api.dart"]:::service
        Config["firebase_options.dart"]:::service
        Prefs["saveSharePreferences.dart"]:::service
    end

    %% External Backend
    subgraph "External Backend"
        Auth["Firebase Auth"]:::external
        DB["Firestore/RealtimeDB"]:::external
        CF["Cloud Functions"]:::external
    end

    %% Platform Hosts
    subgraph "Platform Host Runtimes"
        Android["Android"]:::platform
        iOS["iOS"]:::platform
        Web["Web"]:::platform
        Linux["Linux"]:::platform
        macOS["macOS"]:::platform
        Windows["Windows"]:::platform
    end

    %% Interactions
    Android -->|runs on| UI
    iOS -->|runs on| UI
    Web -->|runs on| UI
    Linux -->|runs on| UI
    macOS -->|runs on| UI
    Windows -->|runs on| UI

    UI -->|uses models| Models
    UI -->|calls| API
    UI -->|caches prefs| Prefs

    API -->|auth request| Auth
    API -->|data I/O| DB
    API -->|exec functions| CF
    API -->|loads config| Config
    API -->|reads/writes| Prefs

    Auth -->|auth response| API
    DB -->|data response| API
    CF -->|function response| API
    API -->|response| UI

    %% Click Events
    click UI "https://github.com/stockbuddy07/pg_helper/tree/main/lib/"
    click Models "https://github.com/stockbuddy07/pg_helper/tree/main/lib/models/"
    click API "https://github.com/stockbuddy07/pg_helper/blob/main/lib/firebase_api.dart"
    click Config "https://github.com/stockbuddy07/pg_helper/blob/main/lib/firebase_options.dart"
    click Prefs "https://github.com/stockbuddy07/pg_helper/blob/main/lib/saveSharePreferences.dart"
    click Auth "https://github.com/stockbuddy07/pg_helper/blob/main/firebase.json"
    click DB "https://github.com/stockbuddy07/pg_helper/blob/main/firebase.json"
    click CF "https://github.com/stockbuddy07/pg_helper/blob/main/firebase.json"
    click Android "https://github.com/stockbuddy07/pg_helper/tree/main/android/"
    click iOS "https://github.com/stockbuddy07/pg_helper/tree/main/ios/"
    click Web "https://github.com/stockbuddy07/pg_helper/tree/main/web/"
    click Linux "https://github.com/stockbuddy07/pg_helper/tree/main/linux/"
    click macOS "https://github.com/stockbuddy07/pg_helper/tree/main/macos/"
    click Windows "https://github.com/stockbuddy07/pg_helper/tree/main/windows/"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6,stroke-width:1px;
    classDef model fill:#E8F7D4,stroke:#22863A,color:#22863A,stroke-width:1px;
    classDef service fill:#FFE4B5,stroke:#D18616,color:#D18616,stroke-width:1px;
    classDef external fill:#FFDDE0,stroke:#CB2431,color:#CB2431,stroke-width:1px;
    classDef platform fill:#F0F0F0,stroke:#6A737D,color:#6A737D,stroke-width:1px;
```
