# neptune-life/ticketme3 architecture

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

- Interactive diagram: https://gitdiagram.com/neptune-life/ticketme3
- Repository: https://github.com/neptune-life/ticketme3

## Overview

##### Project type and purpose
- This is a cross-platform (iOS, Android, Web) React Native/Expo application called “TicketMe.”
- It uses Expo Router’s file-based routing in the **app/** directory to deliver mobile (admin & client) and web (public pages & store management) experiences.
- Native modules (bluetooth ESC/POS printer, PDF generation) and Firebase (via Google services JSON) provide printing, receipts, and real-time data/storage.

##### File structure
- Top-level **android/** and **ios/** directories: native Android (Gradle, Java/Kotlin) and iOS (Xcode, Obj-C/Swift) projects.
- **app/** directory: file-based routes subdivided into (mobile) → (admin, auth, client) and (web) → (Lpages, auth, storeManagement).
- **components/** and **hooks/**: reusable UI widgets and custom React hooks (Bluetooth, session management).
- **databaseConfig.js**: centralized configuration for remote DB (Firebase or other).
- **babel.config.js**, **metro.config.js**, **package.json**: build and bundler configuration.
- **scripts/reset-project.js**, **patches/**: development helper scripts and patch overrides for native dependencies.

##### README
- Confirms an Expo project scaffolded with `create-expo-app`.
- Recommends `npm install` and `npx expo start`.
- Mentions file-based routing in **app/** as the main development pattern.
- No server backend code present → likely serverless or cloud-hosted APIs (Firebase).

##### Main components and their interactions
a. Frontend layers
- Mobile App (Expo Go / Dev build)
- Web App (responsive React‐based pages)
- Shared UI component library (**components/**, **utility/**)
b. Native bridging
- Bluetooth printer plugin (react-native-bluetooth-escpos-printer)
- PDF generator (react-native-html-to-pdf)
c. Cloud services
- Authentication & Database (Firebase / Google services)
- Storage (images, fonts) via Firebase or CDN
d. Build & deployment
- Metro bundler → JS bundle
- Android: Gradle → APK / AAB
- iOS: Xcode → IPA
- Web: Static asset generation / hosting (Next-style router)

##### Architectural patterns & design principles
- File-based routing (Expo Router) separates screens into routes.
- Feature folders under **app/** enforce domain boundaries (admin vs. client).
- Componentization and hooks encourage reuse and separation of concerns.
- Native modules are wrapped via React Native bridge for printer and PDF.
- Environment config (databaseConfig.js, Google JSON) isolates service endpoints.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Clients" 
        direction TB
        MobileApp["TicketMe Mobile App"]:::ui
        WebApp["TicketMe Web App"]:::ui
    end

    %% Application Layer
    subgraph "Application Layer" 
        direction TB
        ExpoConfig["Cross-Platform Entry Point\n(app.json)"]:::ui
        JSRuntime["React Native JS Bundle\n(index.js)"]:::ui
        ExpoRouter["Expo Router\n(file-based routing)"]:::ui
        subgraph "Mobile Routes" 
            direction TB
            LayoutMobile["Layout Entry\n(app/(mobile)/_layout.tsx)"]:::ui
            AdminScreens["Admin Screens\n(app/(mobile)/(admin))"]:::ui
            AuthScreens["Auth Screens\n(app/(mobile)/(auth))"]:::ui
            ClientScreens["Client Screens\n(app/(mobile)/(client))"]:::ui
        end
        subgraph "Web Routes" 
            direction TB
            LayoutWeb["Root Layout\n(app/(web)/_layout.tsx)"]:::ui
            Lpages["Landing Pages\n(app/(web)/(Lpages))"]:::ui
            WebAuth["Web Auth\n(app/(web)/(auth))"]:::ui
            StoreMgmt["Store Management\n(app/(web)/(storeManagement))"]:::ui
        end
        SharedComponents["Shared UI Components\n(components/)"]:::ui
        SharedUtils["Shared Utilities\n(utility/)"]:::ui
        subgraph "Custom Hooks" 
            direction TB
            BluetoothService["BluetoothService.tsx"]:::ui
            BluetoothManager["bluetoothManager.tsx"]:::ui
            SessionAdmin["sessionAdmin.tsx"]:::ui
            UseColorScheme["useColorScheme.ts"]:::ui
            UseThemeColor["useThemeColor.ts"]:::ui
        end
    end

    %% Services & Infrastructure Layer
    subgraph "Services & Infrastructure"
        direction TB
        OSNativeMobile["Android (Gradle, Kotlin)\niOS (Xcode, Swift)"]:::native
        CloudServices["Firebase Auth/Firestore/Storage\n(google-services.json)"]:::data
        CDNStorage["CDN / Storage"]:::data
        DatabaseConfig["DB Config\n(databaseConfig.js)"]:::data
        BLEBridge["Bluetooth Printer Bridge\n(react-native-bluetooth-escpos-printer.ts)"]:::native
        BLEPatch["Android Patch Overrides\n(patches/react-native-bluetooth-escpos-printer/)"]:::native
        PDFBridge["PDF Generation Bridge\n(react-native-html-to-pdf.ts)"]:::native
        subgraph "Build & Deploy Tools"
            direction TB
            Metro["metro.config.js"]:::native
            Babel["babel.config.js"]:::native
            TSConfig["tsconfig.json"]:::native
            EAS["eas.json"]:::native
        end
        DevScripts["Dev Scripts & Patches\n(scripts/reset-project.js, patches/)"]:::native
    end

    %% Connections
    MobileApp -->|"loads" | JSRuntime
    WebApp -->|"loads" | JSRuntime
    ExpoConfig --> JSRuntime
    JSRuntime --> ExpoRouter
    ExpoRouter --> LayoutMobile
    LayoutMobile --> AdminScreens
    LayoutMobile --> AuthScreens
    LayoutMobile --> ClientScreens
    ExpoRouter --> LayoutWeb
    LayoutWeb --> Lpages
    LayoutWeb --> WebAuth
    LayoutWeb --> StoreMgmt
    JSRuntime --> SharedComponents
    JSRuntime --> SharedUtils
    JSRuntime --> BluetoothService
    JSRuntime --> BluetoothManager
    JSRuntime --> SessionAdmin
    JSRuntime --> UseColorScheme
    JSRuntime --> UseThemeColor
    SharedComponents --> CloudServices
    SharedUtils --> CloudServices
    BluetoothService --> BLEBridge
    BluetoothManager --> BLEBridge
    BLEBridge --> OSNativeMobile
    BLEPatch --> BLEBridge
    JSRuntime --> PDFBridge
    PDFBridge --> OSNativeMobile
    JSRuntime --> DatabaseConfig
    DatabaseConfig --> CloudServices
    CloudServices --> CDNStorage
    JSRuntime --> Metro
    JSRuntime --> Babel
    JSRuntime --> TSConfig
    JSRuntime --> EAS
    DevScripts --> OSNativeMobile
    DevScripts --> OSNativeMobile

    %% Click Events
    click ExpoConfig "https://github.com/neptune-life/ticketme3/blob/main/app.json"
    click LayoutMobile "https://github.com/neptune-life/ticketme3/blob/main/app/(mobile)/_layout.tsx"
    click AdminScreens "https://github.com/neptune-life/ticketme3/tree/main/app/(mobile)/(admin)"
    click AuthScreens "https://github.com/neptune-life/ticketme3/tree/main/app/(mobile)/(auth)"
    click ClientScreens "https://github.com/neptune-life/ticketme3/tree/main/app/(mobile)/(client)"
    click LayoutWeb "https://github.com/neptune-life/ticketme3/blob/main/app/(web)/_layout.tsx"
    click Lpages "https://github.com/neptune-life/ticketme3/tree/main/app/(web)/(Lpages)"
    click WebAuth "https://github.com/neptune-life/ticketme3/tree/main/app/(web)/(auth)"
    click StoreMgmt "https://github.com/neptune-life/ticketme3/tree/main/app/(web)/(storeManagement)"
    click SharedComponents "https://github.com/neptune-life/ticketme3/tree/main/components/"
    click SharedUtils "https://github.com/neptune-life/ticketme3/tree/main/utility/"
    click BluetoothService "https://github.com/neptune-life/ticketme3/blob/main/hooks/BluetoothService.tsx"
    click BluetoothManager "https://github.com/neptune-life/ticketme3/blob/main/hooks/bluetoothManager.tsx"
    click SessionAdmin "https://github.com/neptune-life/ticketme3/blob/main/hooks/sessionAdmin.tsx"
    click UseColorScheme "https://github.com/neptune-life/ticketme3/blob/main/hooks/useColorScheme.ts"
    click UseThemeColor "https://github.com/neptune-life/ticketme3/blob/main/hooks/useThemeColor.ts"
    click DatabaseConfig "https://github.com/neptune-life/ticketme3/blob/main/databaseConfig.js"
    click AndroidCred "https://github.com/neptune-life/ticketme3/blob/main/android/app/google-services.json"
    click IOSCred "https://github.com/neptune-life/ticketme3/blob/main/ios/GoogleService-Info.plist"
    click WebCred "https://github.com/neptune-life/ticketme3/blob/main/google-services.json"
    click BLEBridge "https://github.com/neptune-life/ticketme3/blob/main/react-native-bluetooth-escpos-printer.ts"
    click BLEPatch "https://github.com/neptune-life/ticketme3/tree/main/patches/react-native-bluetooth-escpos-printer/"
    click PDFBridge "https://github.com/neptune-life/ticketme3/blob/main/react-native-html-to-pdf.ts"
    click Metro "https://github.com/neptune-life/ticketme3/blob/main/metro.config.js"
    click Babel "https://github.com/neptune-life/ticketme3/blob/main/babel.config.js"
    click TSConfig "https://github.com/neptune-life/ticketme3/blob/main/tsconfig.json"
    click EAS "https://github.com/neptune-life/ticketme3/blob/main/eas.json"
    click ResetScript "https://github.com/neptune-life/ticketme3/blob/main/scripts/reset-project.js"
    click Patches "https://github.com/neptune-life/ticketme3/tree/main/patches/"
    click AndroidNative "https://github.com/neptune-life/ticketme3/tree/main/android/app/"
    click AndroidGradle "https://github.com/neptune-life/ticketme3/tree/main/android/"
    click IOSNative "https://github.com/neptune-life/ticketme3/blob/main/ios/TicketMe.xcworkspace"
    click IOSProject "https://github.com/neptune-life/ticketme3/tree/main/ios/TicketMe/"
    click Entry "https://github.com/neptune-life/ticketme3/blob/main/index.js"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085;
    classDef data fill:#d4edda,stroke:#155724;
    classDef native fill:#fff3cd,stroke:#856404;
```
