# tuando169/ar-scan-fe architecture

> Architecture diagram of the GitHub repository tuando169/ar-scan-fe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tuando169/ar-scan-fe
- Repository: https://github.com/tuando169/ar-scan-fe

## Overview

##### Project type and purpose
- This is a single-page front-end application built with React, TypeScript, and Vite. There is no embedded backend in the repo; all server-side behavior is delegated to external APIs (endpoints defined in src/apiEndpoints.ts).
- The purpose is an AR-enabled model viewer/manager with user authentication, model scanning, and model-management UIs.

##### File structure
- public/
- Static assets (e.g., druid.gltf) and index.html
- src/
- App.tsx, main.tsx: the SPA entrypoint
- apiEndpoints.ts: central config for all HTTP endpoints
- components/
– ar/: AR scene and 3D model renderers
– auth/: Login/Register popups
– scan/: scanning UI
– manage/: CRUD popups for models
– layouts/: shared layout elements (e.g., BottomNav)
- types.tsx: shared TS types
- config files: vite.config.ts, tsconfig*.json, eslint.config.js

##### README for additional insights
- It’s a minimal Vite template with HMR, React + TS setup, ESLint rules.
- No built-in backend; the architecture relies on external services.

##### Elements
– Labels: “User Browser,” “Vite Dev Server,” “Static Host (CDN),” each React module.
- from Browser → Static Host (initial load)
- from React Components → API Gateway → Services
- between Services → Databases / Asset Storage
- Blue rectangles for front-end modules
- Gray clouds for external services
- Orange diamonds for build tools (Vite)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layer 1: User & Browser
    User["User Browser"]:::user
    User -->|loads index.html| StaticHost["Static Host (CDN)"]:::cloud

    %% Layer 2: Build & Deploy
    subgraph "Build & Deploy"
        direction TB
        Vite{"Vite Build Tool"}:::build
        Dist["/dist (bundled assets)"]:::artifact
        Vite -->|outputs to| Dist
        StaticHost -->|serves| Dist
    end

    %% Layer 3: Front-end runtime
    subgraph "Front-end SPA (React + TS)" 
        direction TB
        Main["main.tsx"]:::frontend
        App["App.tsx"]:::frontend
        APIConfig["apiEndpoints.ts"]:::frontend
        Types["types.tsx"]:::frontend
        subgraph "Modules"
            direction TB
            subgraph "AR Module"
                direction TB
                ArContainer["ArSpaceContainer.tsx"]:::frontend
                ArScene["ArSpace.tsx"]:::frontend
                Model3D["Model.tsx"]:::frontend
            end
            subgraph "Auth Module"
                direction TB
                Login["LoginPopup.tsx"]:::frontend
                Register["RegisterPopup.tsx"]:::frontend
            end
            subgraph "Scan Module"
                direction TB
                Scan["Scan.tsx"]:::frontend
            end
            subgraph "Manage Module"
                direction TB
                ManageDash["Manage.tsx"]:::frontend
                CreatePopup["CreateModelPopup.tsx"]:::frontend
                UpdatePopup["UpdateModelPopup.tsx"]:::frontend
                DetailsPopup["ModelDetailsPopup.tsx"]:::frontend
                DeletePopup["ConfirmDeletePopup.tsx"]:::frontend
            end
            BottomNav["BottomNav.tsx"]:::frontend
        end
        StaticHost -->|loads bundle| Main
        Main --> App
        App --> APIConfig
        App --> Types
        App --> ArContainer
        App --> Login
        App --> Scan
        App --> ManageDash
        App --> BottomNav
        ArContainer --> ArScene
        ArScene --> Model3D
    end

    %% Layer 4: Back-end services
    subgraph "External Services (via API Gateway)" 
        direction TB
        Gateway["API Gateway"]:::cloud
        AuthService["Auth Service"]:::cloud
        ModelService["Model Management Service"]:::cloud
        ARService["AR/Scan Processing Service"]:::cloud
        APIConfig --> Gateway
        Gateway -->|auth calls| AuthService
        Gateway -->|model calls| ModelService
        Gateway -->|scan/ar calls| ARService
    end

    %% Layer 5: Data persistence & artifacts
    subgraph "Data Stores & Asset Storage"
        direction TB
        UserDB["User DB"]:::db
        ModelDB["Model DB"]:::db
        AssetStore["3D Asset Storage"]:::db
        AuthService --> UserDB
        ModelService --> ModelDB
        ModelService --> AssetStore
        ARService --> AssetStore
    end

    %% Click Events
    click Main "https://github.com/tuando169/ar-scan-fe/blob/main/src/main.tsx"
    click App "https://github.com/tuando169/ar-scan-fe/blob/main/src/App.tsx"
    click APIConfig "https://github.com/tuando169/ar-scan-fe/blob/main/src/apiEndpoints.ts"
    click Types "https://github.com/tuando169/ar-scan-fe/blob/main/src/types.tsx"
    click ArContainer "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/ar/ArSpaceContainer.tsx"
    click ArScene "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/ar/components/ArSpace.tsx"
    click Model3D "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/ar/components/Model.tsx"
    click Login "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/auth/LoginPopup.tsx"
    click Register "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/auth/RegisterPopup.tsx"
    click Scan "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/scan/Scan.tsx"
    click ManageDash "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/manage/Manage.tsx"
    click CreatePopup "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/manage/popups/CreateModelPopup.tsx"
    click UpdatePopup "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/manage/popups/UpdateModelPopup.tsx"
    click DetailsPopup "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/manage/popups/ModelDetailsPopup.tsx"
    click DeletePopup "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/manage/popups/ConfirmDeletePopup.tsx"
    click BottomNav "https://github.com/tuando169/ar-scan-fe/blob/main/src/components/layouts/BottomNav.tsx"
    click StaticHost "https://github.com/tuando169/ar-scan-fe/blob/main/index.html"
    click Model3D "https://github.com/tuando169/ar-scan-fe/blob/main/public/assets/druid.gltf"
    click Vite "https://github.com/tuando169/ar-scan-fe/blob/main/vite.config.ts"
    click Dist "https://github.com/tuando169/ar-scan-fe/tree/main/dist"
    click UserDB "https://github.com/tuando169/ar-scan-fe/tree/main/User DB"
    click ModelDB "https://github.com/tuando169/ar-scan-fe/tree/main/Model DB"
    click AssetStore "https://github.com/tuando169/ar-scan-fe/tree/main/3D Asset Storage"

    %% Styles
    classDef user fill:#D0E6FF,stroke:#2A65CC,color:#2A65CC
    classDef build fill:#FFE6C2,stroke:#E69500,color:#E69500
    classDef artifact fill:#FFF0B3,stroke:#E0A800,color:#A66B00
    classDef frontend fill:#D6E4FF,stroke:#4A90E2,color:#174EA6
    classDef cloud fill:#F0F0F0,stroke:#A0A0A0,color:#606060
    classDef db fill:#DFFFE0,stroke:#57A000,color:#2E5C00
```
