# sufiyanrauf/cpsc362_tuffyflow architecture

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

- Interactive diagram: https://gitdiagram.com/sufiyanrauf/cpsc362_tuffyflow
- Repository: https://github.com/sufiyanrauf/cpsc362_tuffyflow

## Overview

Tuffy Flow is a student-facing campus companion: students sign in or enter a sample-student demo, then use their profile and class schedule to get parking, study-spot, club, and event recommendations. Its React views use a shared campus-data layer that selects bundled sample data or account-specific Firestore data. Ranking is split between a browser-side club ranker and a Python scoring service for parking, spots, and events. Edges follow shown imports/calls or README statements; unsampled integrations are omitted where their wiring is not established.

Main entry points: [`src/App.tsx`](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/App.tsx) (App shell), [`src/lib/recommend.ts`](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/recommend.ts) (Recommendation client), [`src/lib/campusData.ts`](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/campusData.ts) (Campus data access), [`src/components/Dashboard.tsx`](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/Dashboard.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Student experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_login["Login and demo<br/>[LoginView.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_parking["Parking view<br/>[ParkingView.tsx]"]
  node_spots["Campus spots<br/>[SpotsView.tsx]"]
  node_clubs["Club discovery<br/>[ClubsView.tsx]"]
  node_events["Event discovery<br/>[EventsView.tsx]"]
  node_profile["Student profile<br/>[ProfileView.tsx]"]
  node_campusmap["Campus map<br/>[CampusMap.tsx]"]
  node_ui["Shared UI components"]
end

subgraph group_recommendations["Recommendations"]
  node_recommend["Recommendation client<br/>[recommend.ts]"]
  node_clubranking["Club ranker<br/>[clubRanking.ts]"]
end

subgraph group_data["Campus data"]
  node_campusdata["Campus data access<br/>[campusData.ts]"]
  node_campusrows["Bundled campus data<br/>[campusRows.ts]"]
  node_async["Async loading<br/>[useAsync.ts]"]
  node_datahelpers["Data and time helpers"]
end

subgraph group_identity["Identity and persistence"]
  node_session["Session management<br/>[session.ts]"]
  node_firestore["Firestore access<br/>[firestoreData.ts]"]
  node_firebase["Firebase setup<br/>[firebase.ts]"]
end

subgraph group_runtime["Scoring runtime"]
  node_scoringapi["Scoring endpoint<br/>[recommend.py]"]
  node_scoring["Ranking engine<br/>[scoring.py]"]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"shows signed-out view"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_parking
node_app -->|"routes to"| node_spots
node_app -->|"routes to"| node_clubs
node_app -->|"routes to"| node_events
node_app -->|"routes to"| node_profile
node_login -->|"signs in"| node_session
node_dashboard -->|"requests recommendations"| node_recommend
node_parking -->|"requests recommendations"| node_recommend
node_spots -->|"requests recommendations"| node_recommend
node_events -->|"requests recommendations"| node_recommend
node_clubs -->|"ranks clubs"| node_clubranking
node_parking -->|"renders map"| node_campusmap
node_profile -->|"saves profile and classes"| node_campusdata
node_recommend -->|"loads recommendation inputs"| node_campusdata
node_campusdata -->|"uses demo data"| node_campusrows
node_campusdata -->|"loads account data"| node_firestore
node_firestore -->|"uses Firebase setup"| node_firebase
node_session -->|"uses Firebase Auth"| node_firebase
node_recommend -->|"posts ranking inputs"| node_scoringapi
node_scoringapi -->|"delegates scoring"| node_scoring
node_dashboard -->|"loads asynchronously"| node_async
node_async -.->|"uses shared data state"| node_datahelpers

click node_app "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/App.tsx"
click node_login "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/LoginView.tsx"
click node_dashboard "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/Dashboard.tsx"
click node_parking "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/ParkingView.tsx"
click node_spots "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/SpotsView.tsx"
click node_clubs "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/ClubsView.tsx"
click node_events "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/EventsView.tsx"
click node_profile "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/ProfileView.tsx"
click node_campusmap "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/CampusMap.tsx"
click node_ui "https://github.com/sufiyanrauf/cpsc362_tuffyflow/tree/main/src/components"
click node_recommend "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/recommend.ts"
click node_clubranking "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/clubRanking.ts"
click node_campusdata "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/campusData.ts"
click node_campusrows "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/campusRows.ts"
click node_async "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/useAsync.ts"
click node_datahelpers "https://github.com/sufiyanrauf/cpsc362_tuffyflow/tree/main/src/lib"
click node_session "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/session.ts"
click node_firestore "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/firestoreData.ts"
click node_firebase "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/firebase.ts"
click node_scoringapi "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/api/recommend.py"
click node_scoring "https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/api/scoring.py"

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_login,node_dashboard,node_parking,node_spots,node_clubs,node_events,node_profile,node_campusmap,node_ui toneBlue
class node_recommend,node_clubranking toneAmber
class node_campusdata,node_campusrows,node_async,node_datahelpers toneMint
class node_session,node_firestore,node_firebase toneRose
class node_scoringapi,node_scoring,node_student toneIndigo
```

## Components

### Student experience

- [App shell](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/App.tsx): `src/App.tsx`
- [Login and demo](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/LoginView.tsx): `src/components/LoginView.tsx`
- [Dashboard](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [Parking view](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/ParkingView.tsx): `src/components/ParkingView.tsx`
- [Campus spots](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/SpotsView.tsx): `src/components/SpotsView.tsx`
- [Club discovery](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/ClubsView.tsx): `src/components/ClubsView.tsx`
- [Event discovery](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/EventsView.tsx): `src/components/EventsView.tsx`
- [Student profile](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/ProfileView.tsx): `src/components/ProfileView.tsx`
- [Campus map](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/components/CampusMap.tsx): `src/components/CampusMap.tsx`
- [Shared UI components](https://github.com/sufiyanrauf/cpsc362_tuffyflow/tree/main/src/components): `src/components`

### Recommendations

- [Recommendation client](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/recommend.ts): `src/lib/recommend.ts`
- [Club ranker](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/clubRanking.ts): `src/lib/clubRanking.ts`

### Campus data

- [Campus data access](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/campusData.ts): `src/lib/campusData.ts`
- [Bundled campus data](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/campusRows.ts): `src/lib/campusRows.ts`
- [Async loading](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/useAsync.ts): `src/lib/useAsync.ts`
- [Data and time helpers](https://github.com/sufiyanrauf/cpsc362_tuffyflow/tree/main/src/lib): `src/lib`

### Identity and persistence

- [Session management](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/session.ts): `src/lib/session.ts`
- [Firestore access](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/firestoreData.ts): `src/lib/firestoreData.ts`
- [Firebase setup](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`

### Scoring runtime

- [Scoring endpoint](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/api/recommend.py): `api/recommend.py`
- [Ranking engine](https://github.com/sufiyanrauf/cpsc362_tuffyflow/blob/main/api/scoring.py): `api/scoring.py`

### Other components

- **Student**

## Connections

- Student → App shell: uses (evidence: `README.md`)
- App shell → Login and demo: shows signed-out view (evidence: `src/App.tsx`)
- App shell → Dashboard: routes to (evidence: `src/App.tsx`)
- App shell → Parking view: routes to (evidence: `src/App.tsx`)
- App shell → Campus spots: routes to (evidence: `src/App.tsx`)
- App shell → Club discovery: routes to (evidence: `src/App.tsx`)
- App shell → Event discovery: routes to (evidence: `src/App.tsx`)
- App shell → Student profile: routes to (evidence: `src/App.tsx`)
- Login and demo → Session management: signs in (evidence: `src/components/LoginView.tsx`)
- Dashboard → Recommendation client: requests recommendations (evidence: `src/components/Dashboard.tsx`)
- Parking view → Recommendation client: requests recommendations (evidence: `src/components/ParkingView.tsx`)
- Campus spots → Recommendation client: requests recommendations (evidence: `src/components/SpotsView.tsx`)
- Event discovery → Recommendation client: requests recommendations (evidence: `src/components/EventsView.tsx`)
- Club discovery → Club ranker: ranks clubs (evidence: `src/components/ClubsView.tsx`)
- Parking view → Campus map: renders map (evidence: `src/components/ParkingView.tsx`)
- Student profile → Campus data access: saves profile and classes (evidence: `src/components/ProfileView.tsx`)
- Recommendation client → Campus data access: loads recommendation inputs (evidence: `src/lib/recommend.ts`)
- Campus data access → Bundled campus data: uses demo data (evidence: `src/lib/campusData.ts`)
- Campus data access → Firestore access: loads account data (evidence: `src/lib/campusData.ts`)
- Firestore access → Firebase setup: uses Firebase setup (evidence: `src/lib/firestoreData.ts`)
- Session management → Firebase setup: uses Firebase Auth (evidence: `src/lib/session.ts`)
- Recommendation client → Scoring endpoint: posts ranking inputs (evidence: `README.md`)
- Scoring endpoint → Ranking engine: delegates scoring (evidence: `api/recommend.py`)
- Dashboard → Async loading: loads asynchronously (evidence: `src/components/Dashboard.tsx`)
- Async loading → Data and time helpers: uses shared data state
