# pkrverma/lcv2 architecture

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

- Interactive diagram: https://gitdiagram.com/pkrverma/lcv2
- Repository: https://github.com/pkrverma/lcv2

## Overview

##### Project Type and Purpose
- This is a mobile full-stack proof-of-concept application (“Future of Furniture”) combining an Android client (Jetpack Compose + ARCore) with a lightweight Node.js backend.
- The Android app uses ARCore to render furniture in AR, Jetpack Compose for UI, Retrofit for networking, and Firebase Auth (via google-services.json) for user authentication.
- The backend (app/backend/server.js) likely provides REST endpoints for product listings, orders, and payment processing.

##### Main Components
a. Android Client
- UI Layer (Jetpack Compose Screens: HomeScreen, DetailScreen, CheckoutScreen, etc.)
- ViewModel Layer (SharedViewModel) – implements MVVM, holds UI state & orchestrates business logic
- Network Layer (RetrofitClient, ApiService) – defines HTTP API to the backend
- AR Core Integration – invoked in PaymentHandler or MainActivity for AR rendering
- Firebase Auth Helper – handles login/register/forgot-password flows via Firebase SDK
- Local Data Utils (LocalData) – for any cached or persisted data

b. Backend Service (Node.js / Express)
- server.js – entry point defining REST endpoints (products, orders, auth callbacks, payments)
- .env – config for DB connections or secret keys
- (Implicit) Database or storage – could be MongoDB/PostgreSQL or Firebase functions

c. External Services
- Google ARCore – on-device AR rendering engine
- Firebase Auth – user authentication & management
- (Optional) Payment Gateway – invoked from PaymentHandler or backend

##### Relationships & Data Flows
- UI Events → SharedViewModel → Repository/Network → ApiService → Node.js Backend → Database/Payment Gateway
- On login/register, Android calls Firebase SDK → Firebase Auth service → returns token → passed to backend for session management
- AR interactions stay on-device via ARCore
- On “Place Order”, backend processes payment (via gateway) and persists order

##### Architectural Patterns & Design Principles
- MVVM on the Android side: Compose UI ↔ ViewModel ↔ Repository ↔ Network
- Layered separation: UI, business logic, data layer
- Use of single-responsibility modules: screens, network, utils, models
- Backend follows RESTful service principles

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Android Client Tier
    subgraph "Android Client (Mobile Device)"
        direction TB
        UI["Compose UI\nScreens\n(Kotlin,\nJetpack Compose)"]:::client
        VM["SharedViewModel\n(ViewModel)"]:::client
        Repo["Repository\n/ Network"]:::client
        RetrofitClient["RetrofitClient\n(Kotlin)"]:::client
        ApiService["ApiService\n(Kotlin)"]:::client
        ARCore["ARCore Engine"]:::external
        FirebaseSDK["Firebase Auth SDK"]:::external
        LocalData["LocalData\n(Utils)"]:::client
        MainActivity["MainActivity\n(Entry, AR trigger)"]:::client
        PaymentHandler["PaymentHandler\n(AR-enabled UI)"]:::client
        FirebaseHelper["FirebaseAuthHelper\n(Kotlin)"]:::client
        Manifest["AndroidManifest.xml"]:::client
        GoogleServices["google-services.json"]:::client
    end

    %% Backend Tier
    subgraph "Backend Service"
        direction TB
        Express["Express.js Server\n(Node.js)"]:::backend
        ENV[".env\n(Config)"]:::backend
        PackageJSON["package.json\n/ node_modules"]:::backend
        DataStore["Data Store\n(MongoDB / Firestore)"]:::backend
        PaymentGateway["Payment Gateway"]:::external
    end

    %% Build and Config
    subgraph "Project Build & Config"
        direction TB
        RootBuild["build.gradle\nsettings.gradle"]:::backend
        AppBuild["app/build.gradle"]:::backend
        Proguard["proguard-rules.pro"]:::backend
    end

    %% Connections
    UI -->|"UI events"| VM
    VM -->|"orchestrates"| Repo
    Repo -->|"calls API"| RetrofitClient
    RetrofitClient -->|"uses"| ApiService
    ApiService -->|"HTTPS calls"| Express
    Express -->|"reads/writes"| DataStore
    Express -->|"process payment"| PaymentGateway

    MainActivity -->|invokes| ARCore
    PaymentHandler -->|renders AR UI| ARCore
    VM -->|uses| LocalData
    UI -->|auth flows| FirebaseSDK
    FirebaseSDK -->|returns token| FirebaseHelper
    FirebaseHelper -->|passes token| Express

    RootBuild --> AppBuild
    AppBuild --> Manifest
    AppBuild --> GoogleServices

    %% Click Events
    click UI "https://github.com/pkrverma/lcv2/tree/main/app/src/main/java/in/kay/luxture/screens"
    click VM "https://github.com/pkrverma/lcv2/blob/main/app/src/main/java/in/kay/luxture/SharedViewModel.kt"
    click SwipeRepo "https://github.com/pkrverma/lcv2/blob/main/app/src/main/java/in/kay/luxture/network/RetrofitClient.kt"
    click ApiService "https://github.com/pkrverma/lcv2/blob/main/app/src/main/java/in/kay/luxture/network/ApiService.kt"
    click MainActivity "https://github.com/pkrverma/lcv2/blob/main/app/src/main/java/in/kay/luxture/MainActivity.kt"
    click PaymentHandler "https://github.com/pkrverma/lcv2/blob/main/app/src/main/java/in/kay/luxture/PaymentHandler.kt"
    click FirebaseHelper "https://github.com/pkrverma/lcv2/blob/main/app/src/main/java/in/kay/luxture/screens/firebase/FirebaseAuthHelper.kt"
    click LocalData "https://github.com/pkrverma/lcv2/blob/main/app/src/main/java/in/kay/luxture/utils/LocalData.kt"
    click GoogleServices "https://github.com/pkrverma/lcv2/blob/main/app/google-services.json"
    click Manifest "https://github.com/pkrverma/lcv2/blob/main/app/src/main/AndroidManifest.xml"
    click Express "https://github.com/pkrverma/lcv2/blob/main/app/backend/server.js"
    click ENV "https://github.com/pkrverma/lcv2/blob/main/app/backend/.env"
    click PackageJSON "https://github.com/pkrverma/lcv2/blob/main/app/backend/package.json"
    click RootBuild "https://github.com/pkrverma/lcv2/blob/main/build.gradle"
    click RootBuild "https://github.com/pkrverma/lcv2/blob/main/settings.gradle"
    click AppBuild "https://github.com/pkrverma/lcv2/blob/main/app/build.gradle"
    click Proguard "https://github.com/pkrverma/lcv2/blob/main/app/proguard-rules.pro"

    %% Styles
    classDef client fill:#cfe2f3,stroke:#034f84,color:#034f84
    classDef backend fill:#d9ead3,stroke:#38761d,color:#38761d
    classDef external fill:#e7e6e6,stroke:#666,color:#666
```
