# xinyiloh027-arch/campus-loop architecture

> Architecture diagram of the GitHub repository xinyiloh027-arch/campus-loop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xinyiloh027-arch/campus-loop
- Repository: https://github.com/xinyiloh027-arch/campus-loop

## Overview

CampusLoop combines a UTM-focused campus marketplace with a virtual-pet experience. The main user flow is navigating marketplace sections, creating or browsing listings, and submitting purchase or rental requests; account and marketplace state are managed through services backed by Firebase with local fallback behavior. Pet World is a substantial separate capability for caring for, customizing, and interacting with a virtual pet. Several feature modules are represented from the source index rather than inspected excerpts, so their internal interactions are not expanded.

Main entry points: [`src/App.tsx`](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/App.tsx) (App coordinator), [`src/components/PetWorldView.tsx`](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/PetWorldView.tsx) (Pet World hub), [`src/components/petworld/CustomPetStudio.tsx`](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/CustomPetStudio.tsx) (Pet customization), [`src/components/petworld/PetShopModal.tsx`](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetShopModal.tsx) (Pet shop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_market["Marketplace"]
  node_app["App coordinator<br/>[App.tsx]"]
  node_navigation["Navigation<br/>[Navbar.tsx]"]
  node_home["Home listings<br/>[HomeView.tsx]"]
  node_mall["Marketplace browse<br/>[MallView.tsx]"]
  node_listing["Listing details"]
  node_create["Create listing"]
  node_cart["Cart and requests<br/>[CartView.tsx]"]
  node_rentals["Rental listings<br/>[RentView.tsx]"]
  node_chat["Campus chat<br/>[ChatView.tsx]"]
  node_profile["Account hub<br/>[MeView.tsx]"]
end

subgraph group_account["Accounts"]
  node_authmodal["UTM sign-in<br/>[UtmAuthModal.tsx]"]
  node_faculty["Faculty selection<br/>[FacultySelect.tsx]"]
  node_auth["Authentication<br/>[authService.ts]"]
end

subgraph group_pet["Pet World"]
  node_petview["Pet World hub<br/>[PetWorldView.tsx]"]
  node_studio["Pet customization"]
  node_visual["Pet renderer<br/>[PetVisual.tsx]"]
  node_petservices["Pet state service<br/>[petWorldService.ts]"]
  node_petroom["Pet room<br/>[PetRoom.tsx]"]
  node_games["Mini-games<br/>[MiniGames.tsx]"]
  node_petchat["Pet chat<br/>[PetChatDrawer.tsx]"]
  node_shop["Pet shop<br/>[PetShopModal.tsx]"]
  node_sound["Pet sounds<br/>[soundService.ts]"]
  node_scenes["Scene definitions<br/>[petScenes.ts]"]
  node_sceneconfig["Scene customization"]
end

subgraph group_data["Services and data"]
  node_storage["Marketplace storage<br/>[storageService.ts]"]
  node_firebase[("Firebase<br/>[firebase.ts]")]
  node_mock["Seed data<br/>[mockData.ts]"]
  node_image[("Image storage")]
end

node_student(("UTM student"))

node_student -->|"uses"| node_app
node_app -->|"renders"| node_navigation
node_app -->|"renders"| node_home
node_app -->|"renders"| node_mall
node_app -->|"renders"| node_cart
node_app -->|"renders"| node_rentals
node_app -->|"renders"| node_chat
node_app -->|"renders"| node_profile
node_app -->|"opens"| node_create
node_app -->|"creates listings"| node_storage
node_app -->|"checks account"| node_auth
node_app -->|"opens"| node_authmodal
node_authmodal -->|"authenticates"| node_auth
node_authmodal -->|"uses selection"| node_faculty
node_auth -->|"uses Firebase auth"| node_firebase
node_storage -->|"reads and writes"| node_firebase
node_create -->|"uploads images"| node_image
node_home -->|"opens details"| node_listing
node_mall -->|"opens details"| node_listing
node_cart -->|"uses initial data"| node_mock
node_profile -->|"renders selection"| node_faculty
node_profile -->|"opens"| node_petview
node_petview -->|"updates pet"| node_petservices
node_petview -->|"renders"| node_petroom
node_petview -->|"renders"| node_visual
node_petview -->|"opens"| node_studio
node_petview -->|"renders"| node_games
node_petview -->|"opens"| node_petchat
node_petview -->|"opens"| node_shop
node_petview -->|"plays sounds"| node_sound
node_studio -->|"previews"| node_visual
node_studio -->|"saves customization"| node_petservices
node_studio -->|"stores images"| node_image
node_shop -->|"updates pet"| node_petservices
node_shop -->|"renders preview"| node_visual
node_shop -->|"plays sounds"| node_sound
node_petview -->|"uses definitions"| node_scenes
node_sceneconfig -->|"uses scene types"| node_scenes

click node_app "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/App.tsx"
click node_navigation "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/Navbar.tsx"
click node_home "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/HomeView.tsx"
click node_mall "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/MallView.tsx"
click node_listing "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/ListingDetailModal.tsx"
click node_create "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/CreateListingModal.tsx"
click node_cart "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/CartView.tsx"
click node_rentals "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/RentView.tsx"
click node_chat "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/ChatView.tsx"
click node_profile "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/MeView.tsx"
click node_authmodal "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/UtmAuthModal.tsx"
click node_faculty "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/FacultySelect.tsx"
click node_auth "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/authService.ts"
click node_storage "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/storageService.ts"
click node_firebase "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/firebase.ts"
click node_mock "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/data/mockData.ts"
click node_image "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/imageStorageService.ts"
click node_petview "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/PetWorldView.tsx"
click node_studio "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/CustomPetStudio.tsx"
click node_visual "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetVisual.tsx"
click node_petservices "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/petWorldService.ts"
click node_petroom "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetRoom.tsx"
click node_games "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/MiniGames.tsx"
click node_petchat "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetChatDrawer.tsx"
click node_shop "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetShopModal.tsx"
click node_sound "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/soundService.ts"
click node_scenes "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/types/petScenes.ts"
click node_sceneconfig "https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/sceneCustomizationService.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_navigation,node_home,node_mall,node_listing,node_create,node_cart,node_rentals,node_chat,node_profile toneBlue
class node_authmodal,node_faculty,node_auth toneAmber
class node_petview,node_studio,node_visual,node_petservices,node_petroom,node_games,node_petchat,node_shop,node_sound,node_scenes,node_sceneconfig toneMint
class node_storage,node_firebase,node_mock,node_image toneRose
class node_student toneIndigo
```

## Components

### Marketplace

- [App coordinator](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/App.tsx): `src/App.tsx`
- [Navigation](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`
- [Home listings](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/HomeView.tsx): `src/components/HomeView.tsx`
- [Marketplace browse](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/MallView.tsx): `src/components/MallView.tsx`
- [Listing details](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/ListingDetailModal.tsx): `src/components/ListingDetailModal.tsx`
- [Create listing](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/CreateListingModal.tsx): `src/components/CreateListingModal.tsx`
- [Cart and requests](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/CartView.tsx): `src/components/CartView.tsx`
- [Rental listings](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/RentView.tsx): `src/components/RentView.tsx`
- [Campus chat](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/ChatView.tsx): `src/components/ChatView.tsx`
- [Account hub](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/MeView.tsx): `src/components/MeView.tsx`

### Accounts

- [UTM sign-in](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/UtmAuthModal.tsx): `src/components/UtmAuthModal.tsx`
- [Faculty selection](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/FacultySelect.tsx): `src/components/FacultySelect.tsx`
- [Authentication](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/authService.ts): `src/services/authService.ts`

### Pet World

- [Pet World hub](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/PetWorldView.tsx): `src/components/PetWorldView.tsx`
- [Pet customization](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/CustomPetStudio.tsx): `src/components/petworld/CustomPetStudio.tsx`
- [Pet renderer](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetVisual.tsx): `src/components/petworld/PetVisual.tsx`
- [Pet state service](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/petWorldService.ts): `src/services/petWorldService.ts`
- [Pet room](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetRoom.tsx): `src/components/petworld/PetRoom.tsx`
- [Mini-games](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/MiniGames.tsx): `src/components/petworld/MiniGames.tsx`
- [Pet chat](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetChatDrawer.tsx): `src/components/petworld/PetChatDrawer.tsx`
- [Pet shop](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/components/petworld/PetShopModal.tsx): `src/components/petworld/PetShopModal.tsx`
- [Pet sounds](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/soundService.ts): `src/services/soundService.ts`
- [Scene definitions](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/types/petScenes.ts): `src/types/petScenes.ts`
- [Scene customization](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/sceneCustomizationService.ts): `src/services/sceneCustomizationService.ts`

### Services and data

- [Marketplace storage](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/storageService.ts): `src/services/storageService.ts`
- [Firebase](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/firebase.ts): `src/services/firebase.ts`
- [Seed data](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/data/mockData.ts): `src/data/mockData.ts`
- [Image storage](https://github.com/xinyiloh027-arch/campus-loop/blob/main/src/services/imageStorageService.ts): `src/services/imageStorageService.ts`

### Other components

- **UTM student**

## Connections

- UTM student → App coordinator: uses (evidence: `src/App.tsx`)
- App coordinator → Navigation: renders (evidence: `src/App.tsx`)
- App coordinator → Home listings: renders (evidence: `src/App.tsx`)
- App coordinator → Marketplace browse: renders (evidence: `src/App.tsx`)
- App coordinator → Cart and requests: renders (evidence: `src/App.tsx`)
- App coordinator → Rental listings: renders (evidence: `src/App.tsx`)
- App coordinator → Campus chat: renders (evidence: `src/App.tsx`)
- App coordinator → Account hub: renders (evidence: `src/App.tsx`)
- App coordinator → Create listing: opens (evidence: `src/App.tsx`)
- App coordinator → Marketplace storage: creates listings (evidence: `src/App.tsx`)
- App coordinator → Authentication: checks account (evidence: `src/App.tsx`)
- App coordinator → UTM sign-in: opens (evidence: `src/App.tsx`)
- UTM sign-in → Authentication: authenticates (evidence: `src/components/UtmAuthModal.tsx`)
- UTM sign-in → Faculty selection: uses selection (evidence: `src/components/UtmAuthModal.tsx`)
- Authentication → Firebase: uses Firebase auth (evidence: `src/services/authService.ts`)
- Marketplace storage → Firebase: reads and writes (evidence: `src/services/storageService.ts`)
- Create listing → Image storage: uploads images (evidence: `src/components/CreateListingModal.tsx`)
- Home listings → Listing details: opens details (evidence: `src/components/HomeView.tsx`)
- Marketplace browse → Listing details: opens details (evidence: `src/components/MallView.tsx`)
- Cart and requests → Seed data: uses initial data (evidence: `src/components/CartView.tsx`)
- Account hub → Faculty selection: renders selection (evidence: `src/components/MeView.tsx`)
- Account hub → Pet World hub: opens (evidence: `src/components/MeView.tsx`)
- Pet World hub → Pet state service: updates pet (evidence: `src/components/PetWorldView.tsx`)
- Pet World hub → Pet room: renders (evidence: `src/components/PetWorldView.tsx`)
- Pet World hub → Pet renderer: renders (evidence: `src/components/PetWorldView.tsx`)
- Pet World hub → Pet customization: opens (evidence: `src/components/PetWorldView.tsx`)
- Pet World hub → Mini-games: renders (evidence: `src/components/PetWorldView.tsx`)
- Pet World hub → Pet chat: opens (evidence: `src/components/PetWorldView.tsx`)
- Pet World hub → Pet shop: opens (evidence: `src/components/PetWorldView.tsx`)
- Pet World hub → Pet sounds: plays sounds (evidence: `src/components/PetWorldView.tsx`)
- Pet customization → Pet renderer: previews (evidence: `src/components/petworld/CustomPetStudio.tsx`)
- Pet customization → Pet state service: saves customization (evidence: `src/components/petworld/CustomPetStudio.tsx`)
- Pet customization → Image storage: stores images (evidence: `src/components/petworld/CustomPetStudio.tsx`)
- Pet shop → Pet state service: updates pet (evidence: `src/components/petworld/PetShopModal.tsx`)
- Pet shop → Pet renderer: renders preview (evidence: `src/components/petworld/PetShopModal.tsx`)
- Pet shop → Pet sounds: plays sounds (evidence: `src/components/petworld/PetShopModal.tsx`)
- Pet World hub → Scene definitions: uses definitions (evidence: `src/components/PetWorldView.tsx`)
- Scene customization → Scene definitions: uses scene types (evidence: `src/services/sceneCustomizationService.ts`)
