# rhkrskdud/team_project1 architecture

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

- Interactive diagram: https://gitdiagram.com/rhkrskdud/team_project1
- Repository: https://github.com/rhkrskdud/team_project1

## Overview

##### Project type and purpose
- This is a cross-platform Flutter mobile (and desktop/web) application named “스마트환승철” (Smart Subway), whose purpose is to compute and display optimal subway routes (minimum distance/time), allow station search, favorites, plus mini-games and auxiliary features (dark mode, language toggle). It uses Firebase as its backend (for data persistence) and is built/deployed to Android, iOS, Web, Windows, Linux, and macOS targets.

##### Key architectural components
a. Client Application (Flutter)
– UI Layer: Flutter widgets under lib/widgets, screens under modules (FindWay, SearchSta, Setting, killingTime).
– Domain/Business Logic Layer:
· Route-finding algorithms (lib/FIndWay – graph construction, Dijkstra for distance/time).
· Mini-game logic (lib/killingTime).
· Settings logic (dark mode, language switching in lib/Setting).
– Data Layer:
· Firebase integration (lib/firebase_options.dart, lib/util/firebaseUtil.dart) for persisting favorites and user preferences.
· Local assets (images under assets/images, translations under assets/langs).

b. External Service
– Firebase (Firestore or Realtime Database) for storing user-specific data (favorites, maybe user settings).
– Google-services (android/app/google-services.json, iOS equivalent).

c. Build & Deployment Targets
– Flutter toolchain (pubspec.yaml, platform directories: android/, ios/, web/, windows/, macos/, linux/).

##### Relationships & Data Flow
– UI Layer ↔ Business Logic: user taps UI widgets → Business services are invoked (search route, play game, toggle settings) → UI updates.
– Business Logic ↔ Data Layer: services call Firebase SDK (through firebaseUtil) to read/write user data.
– Asset Loading: UI and logic layers load JSON/graph data & images from bundled assets.

##### Architectural Patterns & Principles
– Layered architecture: clear separation between Presentation (widgets), Domain (route/search logic), Data (Firebase & assets).
– Modular code organization: each feature in its own directory (FindWay, SearchSta, Setting, killingTime).
– Single codebase, multiple platform outputs via Flutter’s cross-compilation.
– BaaS (Backend-as-a-Service) approach—no custom server code, all persistence via Firebase.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Flutter Client Container
    subgraph "Flutter Client"
        %% Presentation / UI Layer
        subgraph "Presentation / UI Layer"
            FW["findWay.dart"]:::ui
            MO["menuOverlay.dart"]:::ui
            SB["searchBar.dart"]:::ui
            SR["searchResultItem.dart"]:::ui
            SS["SearchSta.dart"]:::ui
            ST["Settings.dart"]:::ui
            KT_UI["killingTime.dart"]:::ui
        end

        %% Business Logic Layer
        subgraph "Business Logic Layer"
            SM["StationMap.dart"]:::biz
            WS["WriteStation.dart"]:::biz
            MD["minimumDistance.dart"]:::biz
            MT["minimumTime.dart"]:::biz
            BF["bonFire.dart"]:::biz
            MG["miniGame.dart"]:::biz
            DM["DisplayMode.dart"]:::biz
            LS["LocalServiceTerms.dart"]:::biz
            PP["PrivacyPolicy.dart"]:::biz
            TS["TermsOfService.dart"]:::biz
        end

        %% Data Layer
        subgraph "Data Layer"
            FO["firebase_options.dart"]:::data
            FU["firebaseUtil.dart"]:::data
            UT["util.dart"]:::data
            AI["assets/images/"]:::data
            EN["en.json"]:::data
            KO["ko.json"]:::data
            GS_JSON["google-services.json"]:::data
            FZ_JSON["firebase.json"]:::data
        end
    end

    %% External Services
    subgraph "External Services"
        FIRE["Firebase (Firestore)"]:::external
    end

    %% Platform Targets
    subgraph "Build & Deployment Targets"
        PUB["pubspec.yaml"]:::platform
        ANDR["android/"]:::platform
        IOS["ios/"]:::platform
        WEB["web/"]:::platform
        LNX["linux/"]:::platform
        MAC["macos/"]:::platform
        WIN["windows/"]:::platform
    end

    %% Connections: UI -> Business Logic
    FW -->|"user interaction"| SM
    SS -->|"user interaction"| SM
    ST -->|"user interaction"| DM
    KT_UI -->|"user interaction"| MG
    SB -->|"asset read"| EN
    SB -->|"asset read"| KO

    %% Business Logic -> Data Layer
    SM -->|"Graph computation"| FU
    MD -->|"compute route"| UT
    MG -->|"game data"| FU
    DM -->|"load settings"| FU

    %% Data Layer -> External Services
    FU -->|"SDK calls"| FIRE
    FO -->|"config load"| FIRE

    %% Data Layer -> Assets
    AI -.->|"bundle read"| FW

    %% Flutter Client -> Platform Targets
    FW --> PUB
    MB[Flutter Engine]:::platform --> ANDR
    MB --> IOS
    MB --> WEB
    MB --> LNX
    MB --> MAC
    MB --> WIN

    %% Click Events
    click FW "https://github.com/rhkrskdud/team_project1/blob/main/lib/widgets/findWay.dart"
    click MO "https://github.com/rhkrskdud/team_project1/blob/main/lib/widgets/menuOverlay.dart"
    click SB "https://github.com/rhkrskdud/team_project1/blob/main/lib/widgets/searchBar.dart"
    click SR "https://github.com/rhkrskdud/team_project1/blob/main/lib/widgets/searchResultItem.dart"
    click SS "https://github.com/rhkrskdud/team_project1/blob/main/lib/SearchSta/SearchSta.dart"
    click ST "https://github.com/rhkrskdud/team_project1/blob/main/lib/Setting/Settings.dart"
    click KT_UI "https://github.com/rhkrskdud/team_project1/blob/main/lib/killingTime/killingTime.dart"
    click SM "https://github.com/rhkrskdud/team_project1/blob/main/lib/FIndWay/StationMap.dart"
    click WS "https://github.com/rhkrskdud/team_project1/blob/main/lib/FIndWay/WriteStation.dart"
    click MD "https://github.com/rhkrskdud/team_project1/blob/main/lib/FIndWay/minimumDistance.dart"
    click MT "https://github.com/rhkrskdud/team_project1/blob/main/lib/FIndWay/minimumTime.dart"
    click BF "https://github.com/rhkrskdud/team_project1/blob/main/lib/killingTime/bonFire.dart"
    click MG "https://github.com/rhkrskdud/team_project1/blob/main/lib/killingTime/miniGame.dart"
    click DM "https://github.com/rhkrskdud/team_project1/blob/main/lib/Setting/DisplayMode.dart"
    click LS "https://github.com/rhkrskdud/team_project1/blob/main/lib/Setting/LocalServiceTerms.dart"
    click PP "https://github.com/rhkrskdud/team_project1/blob/main/lib/Setting/PrivacyPolicy.dart"
    click TS "https://github.com/rhkrskdud/team_project1/blob/main/lib/Setting/TermsOfService.dart"
    click FO "https://github.com/rhkrskdud/team_project1/blob/main/lib/firebase_options.dart"
    click FU "https://github.com/rhkrskdud/team_project1/blob/main/lib/util/firebaseUtil.dart"
    click UT "https://github.com/rhkrskdud/team_project1/blob/main/lib/util/util.dart"
    click AI "https://github.com/rhkrskdud/team_project1/tree/main/assets/images/"
    click EN "https://github.com/rhkrskdud/team_project1/blob/main/assets/langs/en.json"
    click KO "https://github.com/rhkrskdud/team_project1/blob/main/assets/langs/ko.json"
    click GS_JSON "https://github.com/rhkrskdud/team_project1/blob/main/android/app/google-services.json"
    click FZ_JSON "https://github.com/rhkrskdud/team_project1/blob/main/firebase.json"
    click PUB "https://github.com/rhkrskdud/team_project1/blob/main/pubspec.yaml"
    click ANDR "https://github.com/rhkrskdud/team_project1/tree/main/android/"
    click IOS "https://github.com/rhkrskdud/team_project1/tree/main/ios/"
    click WEB "https://github.com/rhkrskdud/team_project1/tree/main/web/"
    click LNX "https://github.com/rhkrskdud/team_project1/tree/main/linux/"
    click MAC "https://github.com/rhkrskdud/team_project1/tree/main/macos/"
    click WIN "https://github.com/rhkrskdud/team_project1/tree/main/windows/"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,color:#000;
    classDef biz fill:#90EE90,stroke:#000,color:#000;
    classDef data fill:#FFA500,stroke:#000,color:#000;
    classDef external fill:#DDA0DD,stroke:#000,color:#000;
    classDef platform fill:#D3D3D3,stroke:#000,color:#000;
```
