# samyuero/room-scout architecture

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

- Interactive diagram: https://gitdiagram.com/samyuero/room-scout
- Repository: https://github.com/samyuero/room-scout

## Overview

RoomScout is an Android-first dorm-finder app. Renters sign in, complete account setup, discover and compare listings, inspect a dorm, then use rental/reservation flows; owners manage listings and booking requests, while admins moderate accounts and approval evidence. The graph preserves README-documented capabilities even where their implementation was not sampled. Edges cite shown imports/calls or README statements; unsampled feature links are omitted where no relationship is evidenced.

Main entry points: [`app/(tabs)/search.tsx`](https://github.com/samyuero/room-scout/blob/main/app/(tabs)/search.tsx) (Search and discovery), [`app/index.tsx`](https://github.com/samyuero/room-scout/blob/main/app/index.tsx) (Session routing), [`src/context/discovery-context.tsx`](https://github.com/samyuero/room-scout/blob/main/src/context/discovery-context.tsx) (Discovery state), [`src/lib/supabase.ts`](https://github.com/samyuero/room-scout/blob/main/src/lib/supabase.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and accounts"]
  node_entry["Session routing<br/>[index.tsx]"]
  node_auth["Sign-in and signup<br/>[sign-in.tsx]"]
  node_registration["Profile setup<br/>[setup-username.tsx]"]
  node_profile["Account profile<br/>[account-profile.ts]"]
end

subgraph group_discovery["Listing discovery"]
  node_discovery_ui["Search and discovery<br/>[search.tsx]"]
  node_search_sheet["Search controls"]
  node_discovery_state["Discovery state"]
  node_ranking["Filter and ranking<br/>[dorm-discovery.ts]"]
  node_map["Map and price analytics"]
  node_detail["Dorm details and reviews<br/>[&#91;dormId&#93;.tsx]"]
  node_compare["Dorm comparison<br/>[compare.tsx]"]
  node_assistant["AI dorm assistant<br/>[index.ts]"]
end

subgraph group_rental["Rental and support"]
  node_rental["Reservation workflow<br/>[rental-workflow.ts]"]
  node_history["Booking and tenant history"]
  node_support["Support conversations<br/>[chat.tsx]"]
end

subgraph group_operations["Owner and admin operations"]
  node_owner_panel["Owner listing and requests<br/>[owner-panel.tsx]"]
  node_admin_panel["Admin moderation<br/>[admin.tsx]"]
end

subgraph group_platform["Shared platform"]
  node_image_upload["Image and document upload<br/>[imageUpload.ts]"]
  node_auth_hook["Auth session hook<br/>[useAuth.ts]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
end

node_renter(("Renter"))
node_owner(("Dorm owner"))
node_admin(("Administrator"))
node_supabase[("Supabase services")]
node_osm["OpenStreetMap tiles"]
node_gemini["Gemini model service"]

node_renter -->|"opens app"| node_entry
node_entry -->|"reads session"| node_auth_hook
node_entry -->|"checks registration"| node_profile
node_entry -->|"routes signed out"| node_auth
node_entry -->|"routes incomplete"| node_registration
node_auth_hook -->|"reads auth state"| node_supabase_client
node_registration -->|"updates account"| node_profile
node_discovery_ui -->|"renders controls"| node_search_sheet
node_discovery_ui -->|"uses shared state"| node_discovery_state
node_discovery_ui -->|"ranks alternatives"| node_ranking
node_discovery_state -->|"normalizes listings"| node_ranking
node_discovery_state -->|"loads listings"| node_supabase_client
node_discovery_state -->|"refreshes listings"| node_supabase
node_discovery_ui -->|"opens listing"| node_detail
node_renter -->|"searches dorms"| node_discovery_ui
node_map -->|"loads map tiles"| node_osm
node_detail -->|"starts reservation"| node_rental
node_detail -->|"uploads review photos"| node_image_upload
node_image_upload -->|"stores files"| node_supabase_client
node_rental -->|"submits transaction"| node_supabase
node_owner -->|"manages listings"| node_owner_panel
node_owner_panel -->|"handles requests"| node_rental
node_owner_panel -->|"uploads evidence"| node_image_upload
node_admin -->|"moderates accounts"| node_admin_panel
node_assistant -->|"requests ranking"| node_gemini
node_discovery_ui -.->|"requests AI alternatives"| node_assistant
node_supabase_client -->|"connects backend"| node_supabase
node_renter -->|"compares listings"| node_compare
node_renter -->|"views rental history"| node_history
node_renter -->|"contacts support"| node_support

click node_entry "https://github.com/samyuero/room-scout/blob/main/app/index.tsx"
click node_auth "https://github.com/samyuero/room-scout/blob/main/app/(auth)/sign-in.tsx"
click node_registration "https://github.com/samyuero/room-scout/blob/main/app/(auth)/setup-username.tsx"
click node_profile "https://github.com/samyuero/room-scout/blob/main/src/lib/account-profile.ts"
click node_discovery_ui "https://github.com/samyuero/room-scout/blob/main/app/(tabs)/search.tsx"
click node_search_sheet "https://github.com/samyuero/room-scout/blob/main/src/components/discovery-search.tsx"
click node_discovery_state "https://github.com/samyuero/room-scout/blob/main/src/context/discovery-context.tsx"
click node_ranking "https://github.com/samyuero/room-scout/blob/main/src/lib/dorm-discovery.ts"
click node_map "https://github.com/samyuero/room-scout/blob/main/src/components/leaflet-map-view.tsx"
click node_detail "https://github.com/samyuero/room-scout/blob/main/app/(tabs)/%5BdormId%5D.tsx"
click node_compare "https://github.com/samyuero/room-scout/blob/main/app/(tabs)/compare.tsx"
click node_assistant "https://github.com/samyuero/room-scout/blob/main/supabase/functions/dorm-assistant/index.ts"
click node_rental "https://github.com/samyuero/room-scout/blob/main/src/lib/rental-workflow.ts"
click node_history "https://github.com/samyuero/room-scout/blob/main/app/booking-history.tsx"
click node_support "https://github.com/samyuero/room-scout/blob/main/app/chat.tsx"
click node_owner_panel "https://github.com/samyuero/room-scout/blob/main/app/owner-panel.tsx"
click node_admin_panel "https://github.com/samyuero/room-scout/blob/main/app/admin.tsx"
click node_image_upload "https://github.com/samyuero/room-scout/blob/main/src/utils/imageUpload.ts"
click node_auth_hook "https://github.com/samyuero/room-scout/blob/main/src/hooks/useAuth.ts"
click node_supabase_client "https://github.com/samyuero/room-scout/blob/main/src/lib/supabase.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_entry,node_auth,node_registration,node_profile toneBlue
class node_discovery_ui,node_search_sheet,node_discovery_state,node_ranking,node_map,node_detail,node_compare,node_assistant,node_supabase toneAmber
class node_rental,node_history,node_support toneMint
class node_owner_panel,node_admin_panel toneRose
class node_image_upload,node_auth_hook,node_supabase_client,node_renter,node_owner,node_admin,node_osm,node_gemini toneIndigo
```

## Components

### Identity and accounts

- [Session routing](https://github.com/samyuero/room-scout/blob/main/app/index.tsx): `app/index.tsx`
- [Sign-in and signup](https://github.com/samyuero/room-scout/blob/main/app/(auth)/sign-in.tsx): `app/(auth)/sign-in.tsx`
- [Profile setup](https://github.com/samyuero/room-scout/blob/main/app/(auth)/setup-username.tsx): `app/(auth)/setup-username.tsx`
- [Account profile](https://github.com/samyuero/room-scout/blob/main/src/lib/account-profile.ts): `src/lib/account-profile.ts`

### Listing discovery

- [Search and discovery](https://github.com/samyuero/room-scout/blob/main/app/(tabs)/search.tsx): `app/(tabs)/search.tsx`
- [Search controls](https://github.com/samyuero/room-scout/blob/main/src/components/discovery-search.tsx): `src/components/discovery-search.tsx`
- [Discovery state](https://github.com/samyuero/room-scout/blob/main/src/context/discovery-context.tsx): `src/context/discovery-context.tsx`
- [Filter and ranking](https://github.com/samyuero/room-scout/blob/main/src/lib/dorm-discovery.ts): `src/lib/dorm-discovery.ts`
- [Map and price analytics](https://github.com/samyuero/room-scout/blob/main/src/components/leaflet-map-view.tsx): `src/components/leaflet-map-view.tsx`
- [Dorm details and reviews](https://github.com/samyuero/room-scout/blob/main/app/(tabs)/%5BdormId%5D.tsx): `app/(tabs)/[dormId].tsx`
- [Dorm comparison](https://github.com/samyuero/room-scout/blob/main/app/(tabs)/compare.tsx): `app/(tabs)/compare.tsx`
- [AI dorm assistant](https://github.com/samyuero/room-scout/blob/main/supabase/functions/dorm-assistant/index.ts): `supabase/functions/dorm-assistant/index.ts`

### Rental and support

- [Reservation workflow](https://github.com/samyuero/room-scout/blob/main/src/lib/rental-workflow.ts): `src/lib/rental-workflow.ts`
- [Booking and tenant history](https://github.com/samyuero/room-scout/blob/main/app/booking-history.tsx): `app/booking-history.tsx`
- [Support conversations](https://github.com/samyuero/room-scout/blob/main/app/chat.tsx): `app/chat.tsx`

### Owner and admin operations

- [Owner listing and requests](https://github.com/samyuero/room-scout/blob/main/app/owner-panel.tsx): `app/owner-panel.tsx`
- [Admin moderation](https://github.com/samyuero/room-scout/blob/main/app/admin.tsx): `app/admin.tsx`

### Shared platform

- [Image and document upload](https://github.com/samyuero/room-scout/blob/main/src/utils/imageUpload.ts): `src/utils/imageUpload.ts`
- [Auth session hook](https://github.com/samyuero/room-scout/blob/main/src/hooks/useAuth.ts): `src/hooks/useAuth.ts`
- [Supabase client](https://github.com/samyuero/room-scout/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **Renter**
- **Dorm owner**
- **Administrator**
- **Supabase services**
- **OpenStreetMap tiles**
- **Gemini model service**

## Connections

- Renter → Session routing: opens app (evidence: `app/index.tsx`)
- Session routing → Auth session hook: reads session (evidence: `app/index.tsx`)
- Session routing → Account profile: checks registration (evidence: `app/index.tsx`)
- Session routing → Sign-in and signup: routes signed out (evidence: `app/index.tsx`)
- Session routing → Profile setup: routes incomplete (evidence: `app/index.tsx`)
- Auth session hook → Supabase client: reads auth state (evidence: `src/hooks/useAuth.ts`)
- Profile setup → Account profile: updates account (evidence: `app/(auth)/setup-username.tsx`)
- Search and discovery → Search controls: renders controls (evidence: `app/(tabs)/search.tsx`)
- Search and discovery → Discovery state: uses shared state (evidence: `app/(tabs)/search.tsx`)
- Search and discovery → Filter and ranking: ranks alternatives (evidence: `app/(tabs)/search.tsx`)
- Discovery state → Filter and ranking: normalizes listings (evidence: `src/context/discovery-context.tsx`)
- Discovery state → Supabase client: loads listings (evidence: `src/context/discovery-context.tsx`)
- Discovery state → Supabase services: refreshes listings (evidence: `README.md`)
- Search and discovery → Dorm details and reviews: opens listing (evidence: `app/(tabs)/search.tsx`)
- Renter → Search and discovery: searches dorms (evidence: `README.md`)
- Map and price analytics → OpenStreetMap tiles: loads map tiles (evidence: `README.md`)
- Dorm details and reviews → Reservation workflow: starts reservation (evidence: `app/(tabs)/[dormId].tsx`)
- Dorm details and reviews → Image and document upload: uploads review photos (evidence: `app/(tabs)/[dormId].tsx`)
- Image and document upload → Supabase client: stores files (evidence: `src/utils/imageUpload.ts`)
- Reservation workflow → Supabase services: submits transaction (evidence: `README.md`)
- Dorm owner → Owner listing and requests: manages listings (evidence: `README.md`)
- Owner listing and requests → Reservation workflow: handles requests (evidence: `app/owner-panel.tsx`)
- Owner listing and requests → Image and document upload: uploads evidence (evidence: `app/owner-panel.tsx`)
- Administrator → Admin moderation: moderates accounts (evidence: `README.md`)
- AI dorm assistant → Gemini model service: requests ranking (evidence: `README.md`)
- Search and discovery → AI dorm assistant: requests AI alternatives (evidence: `README.md`)
- Supabase client → Supabase services: connects backend (evidence: `src/lib/supabase.ts`)
- Renter → Dorm comparison: compares listings (evidence: `README.md`)
- Renter → Booking and tenant history: views rental history (evidence: `README.md`)
- Renter → Support conversations: contacts support (evidence: `README.md`)
