# mohithac8109/bunkmates-v2 architecture

> Architecture diagram of the GitHub repository mohithac8109/bunkmates-v2, 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/mohithac8109/bunkmates-v2
- Repository: https://github.com/mohithac8109/bunkmates-v2

## Overview

BunkMates is an Expo/React Native app for social connections, messaging and calls, shared trips, and local discovery. Users sign in, reach the tabbed home experience, and use feature screens to browse or update shared content; trip details and calls have distinct planning and real-time communication stages. Firebase provides authentication and app data, while weather uses OpenWeather. The tree and excerpts support the major feature areas, but many routes were not sampled, so their internal interactions are intentionally left unspecified.

Main entry points: [`src/lib/firebase.ts`](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/firebase.ts) (Firebase services), [`src/app/trips/TripDetails.tsx`](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/trips/TripDetails.tsx) (Trip details), [`src/app/(tabs)/home.tsx`](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/home.tsx) (Home dashboard), [`src/contexts/CallContext.tsx`](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/contexts/CallContext.tsx) (Call coordination)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and Navigation"]
  node_authscreens["Sign in and signup<br/>[login.tsx]"]
  node_usercontext["User session<br/>[UserContext.tsx]"]
  node_firebase[("Firebase services<br/>[firebase.ts]")]
  node_home["Home dashboard<br/>[home.tsx]"]
  node_profile["Profile and settings<br/>[profile.tsx]"]
end

subgraph group_social["Social and Messaging"]
  node_search["Universal search<br/>[search.tsx]"]
  node_searchhook["Search queries<br/>[useSearch.ts]"]
  node_chats["Direct messaging<br/>[&#91;friendId&#93;.tsx]"]
  node_chatlist["Chat list<br/>[chats.tsx]"]
  node_groupchat["Group chat"]
  node_nativechat["Group chat service<br/>[firebaseService.ts]"]
  node_notifications["Notifications"]
end

subgraph group_trips["Trip Planning"]
  node_triplist["Trip listing<br/>[trips.tsx]"]
  node_tripdetails["Trip details<br/>[TripDetails.tsx]"]
  node_tripcreate["Trip creation"]
  node_tripdrawers["Trip planning drawers"]
  node_budget["Trip budget<br/>[BudgetDrawer.tsx]"]
  node_ai["AI trip assistance<br/>[useGroqAI.ts]"]
end

subgraph group_discovery["Discovery and Weather"]
  node_weatherui["Weather and AQI"]
  node_aqi["AQI details"]
  node_weather["Weather service<br/>[WeatherService.ts]"]
  node_places["Place details<br/>[place-details.tsx]"]
end

subgraph group_calls["Voice and Video"]
  node_callcontext["Call coordination<br/>[CallContext.tsx]"]
  node_callscreen["Call screen<br/>[CallScreen.tsx]"]
  node_rtc["WebRTC signaling<br/>[webrtcManager.ts]"]
  node_callaudio["Audio routing<br/>[incallManager.ts]"]
  node_callnotify["Call notifications"]
end

node_user(("App user"))
node_openweather[("OpenWeather API")]

node_user -.->|"signs in"| node_authscreens
node_authscreens -.->|"authenticates"| node_firebase
node_usercontext -->|"reads session and profile"| node_firebase
node_home -->|"uses profile"| node_usercontext
node_home -->|"reads dashboard data"| node_firebase
node_user -.->|"opens dashboard"| node_home
node_search -.->|"searches content"| node_searchhook
node_searchhook -->|"queries records"| node_firebase
node_chats -.->|"exchanges messages"| node_firebase
node_chatlist -.->|"loads conversations"| node_firebase
node_groupchat -.->|"uses chat service"| node_nativechat
node_nativechat -->|"reads and writes"| node_firebase
node_notifications -->|"reads notifications"| node_firebase
node_triplist -.->|"opens trip"| node_tripdetails
node_tripcreate -.->|"creates trips"| node_firebase
node_tripdetails -->|"updates trip records"| node_firebase
node_tripdetails -->|"opens planning tools"| node_tripdrawers
node_tripdetails -->|"uses budget view"| node_budget
node_tripdetails -->|"requests trip suggestions"| node_ai
node_home -->|"opens weather details"| node_weatherui
node_home -->|"opens air quality"| node_aqi
node_weatherui -->|"loads forecast"| node_weather
node_weather -->|"fetches conditions"| node_openweather
node_user -.->|"browses places"| node_places
node_callscreen -->|"controls call"| node_callcontext
node_callcontext -->|"starts signaling"| node_rtc
node_rtc -->|"exchanges signaling data"| node_firebase
node_callcontext -->|"manages call audio"| node_callaudio
node_callcontext -->|"sends call notifications"| node_callnotify

click node_authscreens "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(auth)/login.tsx"
click node_usercontext "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/contexts/UserContext.tsx"
click node_firebase "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/firebase.ts"
click node_home "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/home.tsx"
click node_profile "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/profile.tsx"
click node_search "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/search.tsx"
click node_searchhook "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/hooks/useSearch.ts"
click node_chats "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/chat/%5BfriendId%5D.tsx"
click node_chatlist "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/chats.tsx"
click node_groupchat "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/group_chat/GroupChatScreen.tsx"
click node_nativechat "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/native-chats/firebaseService.ts"
click node_notifications "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/hooks/useNotifications.ts"
click node_triplist "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/trips.tsx"
click node_tripdetails "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/trips/TripDetails.tsx"
click node_tripcreate "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/trips/CreateTripSheet.tsx"
click node_tripdrawers "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/trip_components/ChecklistDrawer.tsx"
click node_budget "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/trip_components/BudgetDrawer.tsx"
click node_ai "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/hooks/useGroqAI.ts"
click node_weatherui "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/Weather/WeatherDetailsSheet.tsx"
click node_aqi "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/Weather/AQIDetailsSheet.tsx"
click node_weather "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/WeatherService.ts"
click node_places "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/place-details.tsx"
click node_callcontext "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/contexts/CallContext.tsx"
click node_callscreen "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/call/CallScreen.tsx"
click node_rtc "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/webrtcManager.ts"
click node_callaudio "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/incallManager.ts"
click node_callnotify "https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/callNotifications.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_authscreens,node_usercontext,node_firebase,node_home,node_profile,node_user toneBlue
class node_search,node_searchhook,node_chats,node_chatlist,node_groupchat,node_nativechat,node_notifications,node_openweather toneAmber
class node_triplist,node_tripdetails,node_tripcreate,node_tripdrawers,node_budget,node_ai toneMint
class node_weatherui,node_aqi,node_weather,node_places toneRose
class node_callcontext,node_callscreen,node_rtc,node_callaudio,node_callnotify toneIndigo
```

## Components

### Identity and Navigation

- [Sign in and signup](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(auth)/login.tsx): `src/app/(auth)/login.tsx`
- [User session](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/contexts/UserContext.tsx): `src/contexts/UserContext.tsx`
- [Firebase services](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Home dashboard](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/home.tsx): `src/app/(tabs)/home.tsx`
- [Profile and settings](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/profile.tsx): `src/app/profile.tsx`

### Social and Messaging

- [Universal search](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/search.tsx): `src/app/search.tsx`
- [Search queries](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/hooks/useSearch.ts): `src/hooks/useSearch.ts`
- [Direct messaging](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/chat/%5BfriendId%5D.tsx): `src/app/chat/[friendId].tsx`
- [Chat list](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/chats.tsx): `src/app/(tabs)/chats.tsx`
- [Group chat](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/group_chat/GroupChatScreen.tsx): `src/components/group_chat/GroupChatScreen.tsx`
- [Group chat service](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/native-chats/firebaseService.ts): `src/lib/native-chats/firebaseService.ts`
- [Notifications](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/hooks/useNotifications.ts): `src/hooks/useNotifications.ts`

### Trip Planning

- [Trip listing](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/trips.tsx): `src/app/(tabs)/trips.tsx`
- [Trip details](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/trips/TripDetails.tsx): `src/app/trips/TripDetails.tsx`
- [Trip creation](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/trips/CreateTripSheet.tsx): `src/components/trips/CreateTripSheet.tsx`
- [Trip planning drawers](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/trip_components/ChecklistDrawer.tsx): `src/components/trip_components/ChecklistDrawer.tsx`
- [Trip budget](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/trip_components/BudgetDrawer.tsx): `src/components/trip_components/BudgetDrawer.tsx`
- [AI trip assistance](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/hooks/useGroqAI.ts): `src/hooks/useGroqAI.ts`

### Discovery and Weather

- [Weather and AQI](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/Weather/WeatherDetailsSheet.tsx): `src/app/(tabs)/Weather/WeatherDetailsSheet.tsx`
- [AQI details](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/Weather/AQIDetailsSheet.tsx): `src/app/(tabs)/Weather/AQIDetailsSheet.tsx`
- [Weather service](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/WeatherService.ts): `src/lib/WeatherService.ts`
- [Place details](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/app/(tabs)/place-details.tsx): `src/app/(tabs)/place-details.tsx`

### Voice and Video

- [Call coordination](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/contexts/CallContext.tsx): `src/contexts/CallContext.tsx`
- [Call screen](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/components/call/CallScreen.tsx): `src/components/call/CallScreen.tsx`
- [WebRTC signaling](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/webrtcManager.ts): `src/lib/webrtcManager.ts`
- [Audio routing](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/incallManager.ts): `src/lib/incallManager.ts`
- [Call notifications](https://github.com/mohithac8109/bunkmates-v2/blob/main/src/lib/callNotifications.ts): `src/lib/callNotifications.ts`

### Other components

- **App user**
- **OpenWeather API**

## Connections

- App user → Sign in and signup: signs in
- Sign in and signup → Firebase services: authenticates
- User session → Firebase services: reads session and profile (evidence: `src/contexts/UserContext.tsx`)
- Home dashboard → User session: uses profile (evidence: `src/app/(tabs)/home.tsx`)
- Home dashboard → Firebase services: reads dashboard data (evidence: `src/app/(tabs)/home.tsx`)
- App user → Home dashboard: opens dashboard
- Universal search → Search queries: searches content
- Search queries → Firebase services: queries records (evidence: `src/hooks/useSearch.ts`)
- Direct messaging → Firebase services: exchanges messages
- Chat list → Firebase services: loads conversations
- Group chat → Group chat service: uses chat service
- Group chat service → Firebase services: reads and writes (evidence: `src/lib/native-chats/firebaseService.ts`)
- Notifications → Firebase services: reads notifications (evidence: `src/hooks/useNotifications.ts`)
- Trip listing → Trip details: opens trip
- Trip creation → Firebase services: creates trips
- Trip details → Firebase services: updates trip records (evidence: `src/app/trips/TripDetails.tsx`)
- Trip details → Trip planning drawers: opens planning tools (evidence: `src/app/trips/TripDetails.tsx`)
- Trip details → Trip budget: uses budget view (evidence: `src/app/trips/TripDetails.tsx`)
- Trip details → AI trip assistance: requests trip suggestions (evidence: `src/app/trips/TripDetails.tsx`)
- Home dashboard → Weather and AQI: opens weather details (evidence: `src/app/(tabs)/home.tsx`)
- Home dashboard → AQI details: opens air quality (evidence: `src/app/(tabs)/home.tsx`)
- Weather and AQI → Weather service: loads forecast (evidence: `src/app/(tabs)/Weather/WeatherDetailsSheet.tsx`)
- Weather service → OpenWeather API: fetches conditions (evidence: `src/lib/WeatherService.ts`)
- App user → Place details: browses places
- Call screen → Call coordination: controls call (evidence: `src/components/call/CallScreen.tsx`)
- Call coordination → WebRTC signaling: starts signaling (evidence: `src/contexts/CallContext.tsx`)
- WebRTC signaling → Firebase services: exchanges signaling data (evidence: `src/lib/webrtcManager.ts`)
- Call coordination → Audio routing: manages call audio (evidence: `src/contexts/CallContext.tsx`)
- Call coordination → Call notifications: sends call notifications (evidence: `src/contexts/CallContext.tsx`)
