# ssyruss/stpms_mobile architecture

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

- Interactive diagram: https://gitdiagram.com/ssyruss/stpms_mobile
- Repository: https://github.com/ssyruss/stpms_mobile

## Overview

##### Project Type and Purpose
- This is a cross-platform full-stack Flutter application (mobile: Android/iOS; desktop: Windows/macOS/Linux; web).
- It provides user authentication (login/register), profile management, and event/facility management. Data appears to be stored locally via SQLite and possibly fetched from remote services (see query.dart).

##### File-Structure Analysis
- Top-level:
- android/, ios/, macos/, windows/, linux/, web/ – platform runner code and build configs
- lib/ – the Dart application code
- test/ – automated widget tests
- pubspec.yaml – dependency and asset configuration
- Under lib/:
- main.dart – application entry point
- components/ – reusable UI widgets (input controls)
- screens/ – per-screen UI and screen controllers
– login/, register/, home/, profile/, event/
- model/ – data classes (User, Event, Facility, etc.)
- utils/ – data-persistence and local storage helpers (SQL, key-value store)
- query.dart – data-access layer (net calls or repository facade)
- extension.dart – Dart extensions to augment built-ins

##### README Insights
- Confirms Flutter 3.13.8, Dart 3.1.4, Android SDK 34.0.0
- Standard Flutter run instructions; no custom architecture docs

a. Main Components
1. Flutter Framework & Engine
2. Presentation Layer (Screens + UI Components)
3. Application Logic Layer (Screen Controllers)
4. Data Layer
- Local Storage (SQLite via utils/sql)
- Local Key-Value Store (utils/store)
- Remote API / Repository (query.dart)
5. Domain Models (in model/)
6. Platform Integration
- Android: MainActivity.kt, AndroidManifest
- iOS: AppDelegate.swift, Info.plist
- Web: index.html, manifest.json
- Desktop: runner code under linux/, macos/, windows/
b. Relationships and Data Flows
- User interacts with Presentation Layer → events sent to Controllers
- Controllers orchestrate CRUD: fetch/save via Data Layer
- Data Layer reads/writes to SQLite or calls remote API → returns Domain Models
- Controllers update Presentation with model data
- All Dart code runs on Flutter Engine; Engine communicates with platform via channels
c. Architectural Patterns
- Layered Architecture (UI → Controller → Data / Repository → Storage)
- MVC-/MVVM-like separation (View = Screens, Controller = *-controller.dart, Model = model/*)
- Plugin-based platform integration (Flutter engine + platform code)
d. Core Technologies
- Flutter & Dart
- sqflite or similar SQLite plugin
- Shared Preferences or equivalent (utils/store)
- HTTP client or custom RPCs in query.dart
- Platform channels for native calls

## Diagram (Mermaid)

```mermaid
graph TB
    %% Platform Runners
    subgraph "Platform Runners"
        Android["Android Runner"]:::platform
        iOS["iOS Runner"]:::platform
        Web["Web Runner"]:::platform
        Linux["Linux Runner"]:::platform
        macOS["macOS Runner"]:::platform
        Windows["Windows Runner"]:::platform
    end

    %% Flutter Engine
    Engine["Flutter Framework & Engine"]:::engine

    %% Entry Point
    Main["main.dart"]:::entry

    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        Components["input.dart"]:::presentation
        LoginScreen["login.dart"]:::presentation
        RegisterScreen["register.dart"]:::presentation
        HomeScreen["home.dart"]:::presentation
        ProfileScreen["profile.dart"]:::presentation
        EventScreen["event.dart"]:::presentation
    end

    %% Logic Layer
    subgraph "Application Logic Layer"
        direction TB
        LoginCtrl["login-controller.dart"]:::logic
        HomeCtrl["home-controller.dart"]:::logic
    end

    %% Domain Models
    subgraph "Domain Models"
        direction TB
        ClassModel["class-model.dart"]:::model
        EventDayModel["event-day-model.dart"]:::model
        EventModel["event-model.dart"]:::model
        FacilityModel["facility-model.dart"]:::model
        UserModel["user-model.dart"]:::model
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Query["query.dart"]:::data
        SQLite["SQLite Storage"]:::storage
        KeyValue["Key-Value Store"]:::storage
        ExternalAPI["External API"]:::external
    end

    %% Styling & Extensions
    ThemeColors["colors.dart"]:::theme
    ThemeSetup["theme.dart"]:::theme
    Extensions["extension.dart"]:::extension
    Pubspec["pubspec.yaml"]:::manifest

    %% Connections
    Android ---|platform channels| Engine
    iOS ---|platform channels| Engine
    Web ---|web plugins| Engine
    Linux ---|desktop embed| Engine
    macOS ---|desktop embed| Engine
    Windows ---|desktop embed| Engine

    Engine -->|launch| Main
    Main -->|build Widget Tree| Components
    Main -->|navigate| LoginScreen
    Main -->|navigate| RegisterScreen
    Main -->|navigate| HomeScreen
    Main -->|navigate| ProfileScreen
    Main -->|navigate| EventScreen

    Components -->|user events| LoginCtrl
    Components -->|user events| HomeCtrl

    LoginScreen -->|binds| LoginCtrl
    HomeScreen -->|binds| HomeCtrl

    LoginCtrl -->|uses| Query
    HomeCtrl -->|uses| Query

    Query -->|INSERT/UPDATE/SELECT| SQLite
    Query -->|READ/WRITE| KeyValue
    Query -->|HTTP GET/POST| ExternalAPI

    SQLite -->|data| LoginCtrl
    KeyValue -->|data| HomeCtrl
    ExternalAPI -->|response| LoginCtrl
    ExternalAPI -->|response| HomeCtrl

    LoginCtrl -->|update UI| LoginScreen
    HomeCtrl -->|update UI| HomeScreen

    Query -->|provides| ClassModel
    Query -->|provides| EventDayModel
    Query -->|provides| EventModel
    Query -->|provides| FacilityModel
    Query -->|provides| UserModel

    ClassModel -->|used by| LoginCtrl
    EventDayModel -->|used by| HomeCtrl
    EventModel -->|used by| HomeCtrl
    FacilityModel -->|used by| HomeCtrl
    UserModel -->|used by| LoginCtrl

    ThemeColors -->|defines| ThemeSetup
    ThemeSetup -->|applies| Components
    ThemeSetup -->|applies| Screens
    Extensions -->|augments| Components

    Pubspec -->|configures| Android
    Pubspec -->|configures| iOS
    Pubspec -->|configures| Web
    Pubspec -->|configures| Linux
    Pubspec -->|configures| macOS
    Pubspec -->|configures| Windows

    %% Click Events
    click Components "https://github.com/ssyruss/stpms_mobile/blob/master/lib/components/input.dart"
    click LoginScreen "https://github.com/ssyruss/stpms_mobile/blob/master/lib/screens/login/login.dart"
    click RegisterScreen "https://github.com/ssyruss/stpms_mobile/blob/master/lib/screens/register/register.dart"
    click HomeScreen "https://github.com/ssyruss/stpms_mobile/blob/master/lib/screens/home/home.dart"
    click ProfileScreen "https://github.com/ssyruss/stpms_mobile/blob/master/lib/screens/profile/profile.dart"
    click EventScreen "https://github.com/ssyruss/stpms_mobile/blob/master/lib/screens/event/event.dart"
    click LoginCtrl "https://github.com/ssyruss/stpms_mobile/blob/master/lib/screens/login/login-controller.dart"
    click HomeCtrl "https://github.com/ssyruss/stpms_mobile/blob/master/lib/screens/home/home-controller.dart"
    click ClassModel "https://github.com/ssyruss/stpms_mobile/blob/master/lib/model/class-model.dart"
    click EventDayModel "https://github.com/ssyruss/stpms_mobile/blob/master/lib/model/event-day-model.dart"
    click EventModel "https://github.com/ssyruss/stpms_mobile/blob/master/lib/model/event-model.dart"
    click FacilityModel "https://github.com/ssyruss/stpms_mobile/blob/master/lib/model/facility-model.dart"
    click UserModel "https://github.com/ssyruss/stpms_mobile/blob/master/lib/model/user-model.dart"
    click Query "https://github.com/ssyruss/stpms_mobile/blob/master/lib/query.dart"
    click SQLite "https://github.com/ssyruss/stpms_mobile/blob/master/lib/utils/sql.dart"
    click KeyValue "https://github.com/ssyruss/stpms_mobile/blob/master/lib/utils/store.dart"
    click Main "https://github.com/ssyruss/stpms_mobile/blob/master/lib/main.dart"
    click ThemeColors "https://github.com/ssyruss/stpms_mobile/blob/master/lib/theme/colors.dart"
    click ThemeSetup "https://github.com/ssyruss/stpms_mobile/blob/master/lib/theme/theme.dart"
    click Extensions "https://github.com/ssyruss/stpms_mobile/blob/master/lib/extension.dart"
    click Android "https://github.com/ssyruss/stpms_mobile/blob/master/android/app/src/main/kotlin/com/example/stpms/MainActivity.kt"
    click Android "https://github.com/ssyruss/stpms_mobile/blob/master/android/app/src/main/AndroidManifest.xml"
    click iOS "https://github.com/ssyruss/stpms_mobile/blob/master/ios/Runner/AppDelegate.swift"
    click iOS "https://github.com/ssyruss/stpms_mobile/blob/master/ios/Runner/Info.plist"
    click Web "https://github.com/ssyruss/stpms_mobile/blob/master/web/index.html"
    click Web "https://github.com/ssyruss/stpms_mobile/blob/master/web/manifest.json"
    click Linux "https://github.com/ssyruss/stpms_mobile/blob/master/linux/main.cc"
    click macOS "https://github.com/ssyruss/stpms_mobile/blob/master/macos/Runner/AppDelegate.swift"
    click Windows "https://github.com/ssyruss/stpms_mobile/blob/master/windows/runner/main.cpp"
    click Pubspec "https://github.com/ssyruss/stpms_mobile/blob/master/pubspec.yaml"

    %% Styles
    classDef presentation fill:#D0E7FF,stroke:#024A86,color:#024A86
    classDef logic fill:#DFF7D9,stroke:#256917,color:#256917
    classDef data fill:#FFE7C1,stroke:#B36B00,color:#B36B00
    classDef storage fill:#FFECB3,stroke:#B36B00,color:#B36B00
    classDef external fill:#F3D1E4,stroke:#9B1D47,color:#9B1D47
    classDef model fill:#FFF2CC,stroke:#997300,color:#997300
    classDef theme fill:#ECECEC,stroke:#555555,color:#555555
    classDef extension fill:#ECECEC,stroke:#555555,color:#555555
    classDef manifest fill:#ECECEC,stroke:#555555,color:#555555
    classDef platform fill:#E0E0E0,stroke:#666666,color:#666666
    classDef engine fill:#FFFFFF,stroke:#999999,color:#333333
    classDef entry fill:#FFFFFF,stroke:#333333,color:#333333
```
