# bin0106/phantriduc24ct1-cnpm architecture

> Architecture diagram of the GitHub repository bin0106/phantriduc24ct1-cnpm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bin0106/phantriduc24ct1-cnpm
- Repository: https://github.com/bin0106/phantriduc24ct1-cnpm

## Overview

UniLife is a student-life discovery and community SPA: users browse housing, food, second-hand goods, entertainment and study resources, then use account, favorites, contact/chat and profile features; owners can submit listings and admins moderate them. The main `src/App.jsx` owns navigation and application state, with views and modal components providing the user-facing stages and browser LocalStorage providing persistence. The README also describes a separate demo app and role-based administration. The tree contains no database files, so the documented MySQL design is not represented as a runtime component. Some view and service links are documented or indexed rather than verified in full source.

Main entry points: [`src/App.jsx`](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/App.jsx) (Application shell), [`src/views/HomeView.jsx`](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/HomeView.jsx) (Home discovery), [`unilife-demo/src/App.jsx`](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/App.jsx) (Demo app shell), [`src/components/cards/PlaceCard.jsx`](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/PlaceCard.jsx) (Listing cards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Main application"]
  node_mainapp["Application shell<br/>[App.jsx]"]
end

subgraph group_discovery["Discovery views"]
  node_home["Home discovery<br/>[HomeView.jsx]"]
  node_housing["Housing listings<br/>[HousingView.jsx]"]
  node_food["Food listings<br/>[FoodView.jsx]"]
  node_market["Marketplace<br/>[MarketView.jsx]"]
  node_entertainment["Entertainment"]
  node_study["Study resources<br/>[StudyView.jsx]"]
  node_favorites["Saved listings<br/>[FavoritesView.jsx]"]
  node_profile["User profile<br/>[ProfileView.jsx]"]
  node_admin["Admin moderation<br/>[AdminView.jsx]"]
end

subgraph group_interactions["User interactions"]
  node_listingcards["Listing cards<br/>[PlaceCard.jsx]"]
  node_foodcard["Food card<br/>[FoodCard.jsx]"]
  node_productcard["Product card<br/>[ProductCard.jsx]"]
  node_entcard["Entertainment card<br/>[EntCard.jsx]"]
  node_auth["Authentication<br/>[AuthModal.jsx]"]
  node_detail["Listing details<br/>[DetailModal.jsx]"]
  node_chat["Messaging<br/>[ChatModal.jsx]"]
  node_contact["Contact details<br/>[ContactModal.jsx]"]
  node_submit["Listing submission"]
  node_submitmarket["Market submission<br/>[AddMarketModal.jsx]"]
  node_notifications["Notifications"]
end

subgraph group_foundation["Data and persistence"]
  node_initialdata["Initial content<br/>[initialData.js]"]
  node_theme["Categories and theme<br/>[theme.js]"]
  node_persistent["Persistent state"]
  node_localstorage[("Browser storage")]
  node_authservice["Auth business logic<br/>[authService.js]"]
  node_postservice["Post moderation logic<br/>[postService.js]"]
  node_userservice["User account logic<br/>[userService.js]"]
end

subgraph group_demo["Demo application"]
  node_demoapp["Demo app shell<br/>[App.jsx]"]
  node_demodata["Demo content<br/>[mockData.js]"]
  node_demoadmin["Demo administration<br/>[AdminView.jsx]"]
  node_demolisting["Demo listing form"]
end

node_student(("Student or owner"))

node_student -->|"uses"| node_mainapp
node_mainapp -->|"routes to"| node_home
node_mainapp -->|"routes to"| node_housing
node_mainapp -->|"routes to"| node_food
node_mainapp -->|"routes to"| node_market
node_mainapp -->|"routes to"| node_entertainment
node_mainapp -->|"routes to"| node_study
node_mainapp -->|"routes to"| node_favorites
node_mainapp -->|"routes to"| node_profile
node_mainapp -->|"routes to"| node_admin
node_mainapp -->|"loads and saves"| node_persistent
node_persistent -->|"reads and writes"| node_localstorage
node_mainapp -->|"initializes listings"| node_initialdata
node_mainapp -->|"renders"| node_auth
node_mainapp -->|"renders"| node_chat
node_mainapp -->|"renders"| node_notifications
node_home -->|"renders"| node_listingcards
node_home -->|"renders"| node_foodcard
node_home -->|"renders"| node_productcard
node_housing -->|"renders"| node_listingcards
node_listingcards -.->|"opens"| node_detail
node_mainapp -->|"renders"| node_detail
node_mainapp -->|"renders"| node_contact
node_mainapp -->|"renders"| node_submit
node_mainapp -->|"renders"| node_submitmarket
node_student -.->|"uses"| node_demoapp
node_demoapp -->|"loads"| node_demodata
node_demoapp -->|"renders"| node_demoadmin
node_demoapp -->|"renders"| node_demolisting

click node_mainapp "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/App.jsx"
click node_home "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/HomeView.jsx"
click node_housing "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/HousingView.jsx"
click node_food "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/FoodView.jsx"
click node_market "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/MarketView.jsx"
click node_entertainment "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/EntertainmentView.jsx"
click node_study "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/StudyView.jsx"
click node_favorites "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/FavoritesView.jsx"
click node_profile "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/ProfileView.jsx"
click node_admin "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/AdminView.jsx"
click node_listingcards "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/PlaceCard.jsx"
click node_foodcard "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/FoodCard.jsx"
click node_productcard "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/ProductCard.jsx"
click node_entcard "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/EntCard.jsx"
click node_auth "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/AuthModal.jsx"
click node_detail "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/DetailModal.jsx"
click node_chat "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/ChatModal.jsx"
click node_contact "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/ContactModal.jsx"
click node_submit "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/AddHousingModal.jsx"
click node_submitmarket "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/AddMarketModal.jsx"
click node_notifications "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/NotificationModal.jsx"
click node_initialdata "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/data/initialData.js"
click node_theme "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/data/theme.js"
click node_persistent "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/hooks/usePersistentState.js"
click node_authservice "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/services/authService.js"
click node_postservice "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/services/postService.js"
click node_userservice "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/services/userService.js"
click node_demoapp "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/App.jsx"
click node_demodata "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/data/mockData.js"
click node_demoadmin "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/components/AdminView.jsx"
click node_demolisting "https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/components/AddLocationModal.jsx"

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_mainapp toneBlue
class node_home,node_housing,node_food,node_market,node_entertainment,node_study,node_favorites,node_profile,node_admin toneAmber
class node_listingcards,node_foodcard,node_productcard,node_entcard,node_auth,node_detail,node_chat,node_contact,node_submit,node_submitmarket,node_notifications toneMint
class node_initialdata,node_theme,node_persistent,node_localstorage,node_authservice,node_postservice,node_userservice toneRose
class node_demoapp,node_demodata,node_demoadmin,node_demolisting,node_student toneIndigo
```

## Components

### Main application

- [Application shell](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/App.jsx): `src/App.jsx`

### Discovery views

- [Home discovery](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/HomeView.jsx): `src/views/HomeView.jsx`
- [Housing listings](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/HousingView.jsx): `src/views/HousingView.jsx`
- [Food listings](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/FoodView.jsx): `src/views/FoodView.jsx`
- [Marketplace](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/MarketView.jsx): `src/views/MarketView.jsx`
- [Entertainment](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/EntertainmentView.jsx): `src/views/EntertainmentView.jsx`
- [Study resources](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/StudyView.jsx): `src/views/StudyView.jsx`
- [Saved listings](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/FavoritesView.jsx): `src/views/FavoritesView.jsx`
- [User profile](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/ProfileView.jsx): `src/views/ProfileView.jsx`
- [Admin moderation](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/views/AdminView.jsx): `src/views/AdminView.jsx`

### User interactions

- [Listing cards](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/PlaceCard.jsx): `src/components/cards/PlaceCard.jsx`
- [Food card](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/FoodCard.jsx): `src/components/cards/FoodCard.jsx`
- [Product card](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/ProductCard.jsx): `src/components/cards/ProductCard.jsx`
- [Entertainment card](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/cards/EntCard.jsx): `src/components/cards/EntCard.jsx`
- [Authentication](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/AuthModal.jsx): `src/components/modals/AuthModal.jsx`
- [Listing details](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/DetailModal.jsx): `src/components/modals/DetailModal.jsx`
- [Messaging](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/ChatModal.jsx): `src/components/modals/ChatModal.jsx`
- [Contact details](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/ContactModal.jsx): `src/components/modals/ContactModal.jsx`
- [Listing submission](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/AddHousingModal.jsx): `src/components/modals/AddHousingModal.jsx`
- [Market submission](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/AddMarketModal.jsx): `src/components/modals/AddMarketModal.jsx`
- [Notifications](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/components/modals/NotificationModal.jsx): `src/components/modals/NotificationModal.jsx`

### Data and persistence

- [Initial content](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/data/initialData.js): `src/data/initialData.js`
- [Categories and theme](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/data/theme.js): `src/data/theme.js`
- [Persistent state](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/hooks/usePersistentState.js): `src/hooks/usePersistentState.js`
- **Browser storage**
- [Auth business logic](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/services/authService.js): `src/services/authService.js`
- [Post moderation logic](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/services/postService.js): `src/services/postService.js`
- [User account logic](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/src/services/userService.js): `src/services/userService.js`

### Demo application

- [Demo app shell](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/App.jsx): `unilife-demo/src/App.jsx`
- [Demo content](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/data/mockData.js): `unilife-demo/src/data/mockData.js`
- [Demo administration](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/components/AdminView.jsx): `unilife-demo/src/components/AdminView.jsx`
- [Demo listing form](https://github.com/bin0106/phantriduc24ct1-cnpm/blob/main/unilife-demo/src/components/AddLocationModal.jsx): `unilife-demo/src/components/AddLocationModal.jsx`

### Other components

- **Student or owner**

## Connections

- Student or owner → Application shell: uses
- Application shell → Home discovery: routes to (evidence: `src/App.jsx`)
- Application shell → Housing listings: routes to (evidence: `src/App.jsx`)
- Application shell → Food listings: routes to (evidence: `src/App.jsx`)
- Application shell → Marketplace: routes to (evidence: `src/App.jsx`)
- Application shell → Entertainment: routes to (evidence: `src/App.jsx`)
- Application shell → Study resources: routes to (evidence: `src/App.jsx`)
- Application shell → Saved listings: routes to (evidence: `src/App.jsx`)
- Application shell → User profile: routes to (evidence: `src/App.jsx`)
- Application shell → Admin moderation: routes to (evidence: `src/App.jsx`)
- Application shell → Persistent state: loads and saves (evidence: `src/App.jsx`)
- Persistent state → Browser storage: reads and writes (evidence: `src/hooks/usePersistentState.js`)
- Application shell → Initial content: initializes listings (evidence: `src/App.jsx`)
- Application shell → Authentication: renders (evidence: `src/App.jsx`)
- Application shell → Messaging: renders (evidence: `src/App.jsx`)
- Application shell → Notifications: renders (evidence: `src/App.jsx`)
- Home discovery → Listing cards: renders (evidence: `src/views/HomeView.jsx`)
- Home discovery → Food card: renders (evidence: `src/views/HomeView.jsx`)
- Home discovery → Product card: renders (evidence: `src/views/HomeView.jsx`)
- Housing listings → Listing cards: renders (evidence: `src/views/HousingView.jsx`)
- Listing cards → Listing details: opens
- Application shell → Listing details: renders (evidence: `src/App.jsx`)
- Application shell → Contact details: renders (evidence: `src/App.jsx`)
- Application shell → Listing submission: renders (evidence: `src/App.jsx`)
- Application shell → Market submission: renders (evidence: `src/App.jsx`)
- Student or owner → Demo app shell: uses
- Demo app shell → Demo content: loads (evidence: `unilife-demo/src/App.jsx`)
- Demo app shell → Demo administration: renders (evidence: `unilife-demo/src/App.jsx`)
- Demo app shell → Demo listing form: renders (evidence: `unilife-demo/src/App.jsx`)
