# pelixpng/pastvuapp architecture

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

- Interactive diagram: https://gitdiagram.com/pelixpng/pastvuapp
- Repository: https://github.com/pelixpng/pastvuapp

## Overview

##### Project type and purpose
- This is a cross-platform mobile application (Android, iOS, watchOS, macOS, visionOS) built in React Native using Expo and TypeScript.
- The app’s sole “backend” is the external PastVu REST API (for historical photos) and mapping APIs (Google Maps on Android/Expo, Apple Maps on iOS/watchOS).

##### File structure
- Top-level “code/” directory holds everything:
- android/ & ios/ subprojects: native host containers and build scripts
- src/: React-Native TypeScript code – organized by API services, UI components, hooks, navigation, screens (view + view-model), global store, types, utilities
- assets/ & app.json, babel.config.js, metro.config.js, eas.json: Expo configuration and static assets
- targets/: platform-specific Swift code for Apple Watch widget and home-screen widget
- Presence of “.vm.ts” files indicates an MVVM-style pattern (Screen.view ↔ Screen.vm).
- Global store files (Api.store.ts, Map.store.ts, Theme.store.ts) suggest a centralized state management solution.
- No custom backend code—external third-party services only (PastVu API, Google/Apple Maps).

##### README for additional insights
- Confirms use of TaigaUI components, PastVu API, Google & Apple Maps
- Targets multiple OSes via Expo’s “eas.json” and “expo-target.config.js” in targets/

- Blue for JS layers (UI, VM, Store, Service)
- Green for external services (PastVu API, Map API)
- Orange for native hosts (Android, iOS, watchOS, widget)
- Rectangles for modules/directories
- Clouds for external APIs

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build Pipeline
    subgraph "Build Pipeline"
        ExpoCLI["Expo CLI"]:::js
        MetroBundler["Metro Bundler"]:::js
        ExpoCLI -->|"bundles JS"| MetroBundler
    end

    %% JS Bundle
    MetroBundler -->|"outputs JS bundle"| JSBundle["JavaScript Bundle"]:::js

    %% JS Layer
    subgraph "JS Layer"
        direction TB
        subgraph "App Shell"
            direction TB
            MobileAppShell["Mobile App Shell"]:::js
        end
        subgraph "Presentation Layer"
            direction TB
            UIComponents["UI Components"]:::js
            Navigation["Navigation"]:::js
        end
        subgraph "ViewModel Layer"
            direction TB
            MapVM["Map.vm.ts"]:::js
        end
        subgraph "State Management"
            direction TB
            ApiStore["Api.store.ts"]:::js
            MapStore["Map.store.ts"]:::js
            ThemeStore["Theme.store.ts"]:::js
        end
        subgraph "Service Layer"
            direction TB
            ApiService["apiService.ts"]:::js
        end
        subgraph "Utilities & Storage"
            direction TB
            Storage["Storage.ts"]:::js
            Utils["getColor.ts"]:::js
        end

        JSBundle --> MobileAppShell
        MobileAppShell --> UIComponents
        MobileAppShell --> Navigation
        UIComponents --> MapVM
        Navigation --> MapVM
        MapVM --> ApiStore
        MapVM --> MapStore
        MapVM --> ApiService
        ApiService --> ApiStore
        ApiStore --> UIComponents
        ApiStore --> MapStore
        MapStore --> UIComponents
        MapVM --> Storage
        MapVM --> Utils
    end

    %% Native Layer
    subgraph "Native Layer"
        direction TB
        AndroidHost["Android Host"]:::native
        iOSHost["iOS Host"]:::native
        WatchTarget["watchOS Target"]:::native
        WidgetTarget["Widget Target"]:::native
    end

    MobileAppShell --> AndroidHost
    MobileAppShell --> iOSHost
    MobileAppShell --> WatchTarget
    MobileAppShell --> WidgetTarget

    %% External Services
    subgraph "External Services"
        direction TB
        PastVuAPI["PastVu REST API"]:::external
        GoogleMaps["Google Maps SDK"]:::external
        AppleMaps["Apple Maps"]:::external
    end

    ApiService --> PastVuAPI
    AndroidHost --> GoogleMaps
    iOSHost --> AppleMaps
    WatchTarget --> AppleMaps
    WidgetTarget --> PastVuAPI

    %% Click Events
    click MobileAppShell "https://github.com/pelixpng/pastvuapp/blob/master/code/App.tsx"
    click UIComponents "https://github.com/pelixpng/pastvuapp/tree/master/code/src/components/ui/"
    click Navigation "https://github.com/pelixpng/pastvuapp/blob/master/code/src/navigation/BottomTabsNavigator.tsx"
    click Navigation "https://github.com/pelixpng/pastvuapp/blob/master/code/src/navigation/MainStackNavigator.tsx"
    click MapVM "https://github.com/pelixpng/pastvuapp/blob/master/code/src/screens/home/map/Map.vm.ts"
    click ApiStore "https://github.com/pelixpng/pastvuapp/blob/master/code/src/store/global/Api.store.ts"
    click MapStore "https://github.com/pelixpng/pastvuapp/blob/master/code/src/store/global/Map.store.ts"
    click ThemeStore "https://github.com/pelixpng/pastvuapp/blob/master/code/src/store/global/Theme.store.ts"
    click ApiService "https://github.com/pelixpng/pastvuapp/blob/master/code/src/api/apiService.ts"
    click Storage "https://github.com/pelixpng/pastvuapp/blob/master/code/src/Storage/Storage.ts"
    click Utils "https://github.com/pelixpng/pastvuapp/blob/master/code/src/utils/getColor.ts"
    click AndroidHost "https://github.com/pelixpng/pastvuapp/tree/master/code/android/"
    click iOSHost "https://github.com/pelixpng/pastvuapp/tree/master/code/ios/"
    click WatchTarget "https://github.com/pelixpng/pastvuapp/tree/master/code/targets/watch/"
    click WidgetTarget "https://github.com/pelixpng/pastvuapp/tree/master/code/targets/widget/"

    %% Styles
    classDef js fill:#ccf,stroke:#333,stroke-width:1px
    classDef native fill:#ffe4b5,stroke:#333,stroke-width:1px
    classDef external fill:#d0f0c0,stroke:#333,stroke-width:1px
```
