# kanreez/hackathon architecture

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

- Interactive diagram: https://gitdiagram.com/kanreez/hackathon
- Repository: https://github.com/kanreez/hackathon

## Overview

GarageGo is a two-sided hourly garage-rental app: renters find a listing, choose a time, pay, manage an active booking, and review their stay; hosts list and manage garages and pair door devices. The Expo client calls the Express server, which owns booking, payment, and door authorization and uses Supabase for persistence. The map also covers documented AI search, geocoding, photo uploads, and the ESP32 command loop. Relationships for unsampled modules are included only where the README documents them.

Main entry points: [`server/server.js`](https://github.com/kanreez/hackathon/blob/main/server/server.js) (Express API), [`src/services/garages.ts`](https://github.com/kanreez/hackathon/blob/main/src/services/garages.ts) (Garage API client), [`src/app/host/new.tsx`](https://github.com/kanreez/hackathon/blob/main/src/app/host/new.tsx) (Create listing), [`src/app/garage/[id].tsx`](https://github.com/kanreez/hackathon/blob/main/src/app/garage/%5Bid%5D.tsx) (Garage details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Expo client"]
  node_auth["Sign in<br/>[login.tsx]"]
  node_account["Profile and settings<br/>[settings.tsx]"]
  node_garageapi["Garage API client<br/>[garages.ts]"]
  node_paymentclient["Payment API client<br/>[payments.ts]"]
end

subgraph group_rental["Rental workflow"]
  node_search["Find garages<br/>[index.tsx]"]
  node_garage["Garage details<br/>[&#91;id&#93;.tsx]"]
  node_booking["Bookings and door<br/>[bookings.tsx]"]
  node_review["Review stay<br/>[ReviewBox.tsx]"]
end

subgraph group_hosting["Host management"]
  node_hostlist["Your garages<br/>[index.tsx]"]
  node_listing["Create listing<br/>[new.tsx]"]
end

subgraph group_server["Server services"]
  node_server["Express API<br/>[server.js]"]
  node_rules["Search and garage rules<br/>[garages.js]"]
  node_pricing["Pricing and checkout<br/>[pricing.js]"]
  node_provider["Payment provider<br/>[provider.js]"]
  node_repository["Data repository<br/>[repo.js]"]
  node_geocoding["Address geocoding<br/>[geocode.js]"]
  node_photos["Garage photos<br/>[photos.js]"]
  node_usernames["Username management<br/>[usernames.js]"]
end

subgraph group_integrations["External systems"]
  node_supabase[("Supabase")]
  node_ai["AI search providers<br/>[anthropic.js]"]
  node_nominatim["Nominatim"]
  node_esp["ESP32 door"]
end

node_renter(("Renter"))
node_host(("Garage host"))

node_renter -->|"signs in"| node_auth
node_renter -->|"searches"| node_search
node_search -->|"requests results"| node_garageapi
node_garageapi -->|"calls API"| node_server
node_server -->|"handles search"| node_rules
node_rules -->|"parses query"| node_ai
node_renter -->|"selects listing"| node_garage
node_garage -->|"creates booking"| node_garageapi
node_garage -->|"starts checkout"| node_paymentclient
node_paymentclient -->|"calls API"| node_server
node_server -->|"calculates price"| node_pricing
node_server -->|"confirms payment"| node_provider
node_server -->|"reads and writes"| node_repository
node_repository -->|"persists data"| node_supabase
node_renter -->|"manages stay"| node_booking
node_booking -->|"requests door action"| node_garageapi
node_server -->|"queues commands"| node_esp
node_esp -->|"polls and acknowledges"| node_server
node_booking -->|"reviews stay"| node_review
node_review -->|"saves review"| node_garageapi
node_host -->|"manages listings"| node_hostlist
node_host -->|"creates listing"| node_listing
node_hostlist -->|"updates listings"| node_garageapi
node_listing -->|"submits listing"| node_garageapi
node_listing -->|"finds address"| node_geocoding
node_geocoding -->|"queries addresses"| node_nominatim
node_listing -->|"uploads photos"| node_photos
node_photos -->|"stores images"| node_supabase
node_hostlist -->|"pairs door device"| node_server
node_account -->|"changes username"| node_usernames
node_server -->|"handles usernames"| node_usernames
node_server -->|"uses auth and storage"| node_supabase

click node_auth "https://github.com/kanreez/hackathon/blob/main/src/app/(auth)/login.tsx"
click node_search "https://github.com/kanreez/hackathon/blob/main/src/app/(tabs)/index.tsx"
click node_garage "https://github.com/kanreez/hackathon/blob/main/src/app/garage/%5Bid%5D.tsx"
click node_booking "https://github.com/kanreez/hackathon/blob/main/src/app/(tabs)/bookings.tsx"
click node_review "https://github.com/kanreez/hackathon/blob/main/src/components/ReviewBox.tsx"
click node_hostlist "https://github.com/kanreez/hackathon/blob/main/src/app/host/index.tsx"
click node_listing "https://github.com/kanreez/hackathon/blob/main/src/app/host/new.tsx"
click node_account "https://github.com/kanreez/hackathon/blob/main/src/app/settings.tsx"
click node_garageapi "https://github.com/kanreez/hackathon/blob/main/src/services/garages.ts"
click node_paymentclient "https://github.com/kanreez/hackathon/blob/main/src/services/payments.ts"
click node_server "https://github.com/kanreez/hackathon/blob/main/server/server.js"
click node_rules "https://github.com/kanreez/hackathon/blob/main/server/garages.js"
click node_pricing "https://github.com/kanreez/hackathon/blob/main/server/payments/pricing.js"
click node_provider "https://github.com/kanreez/hackathon/blob/main/server/payments/provider.js"
click node_repository "https://github.com/kanreez/hackathon/blob/main/server/repo.js"
click node_geocoding "https://github.com/kanreez/hackathon/blob/main/server/geocode.js"
click node_photos "https://github.com/kanreez/hackathon/blob/main/server/photos.js"
click node_usernames "https://github.com/kanreez/hackathon/blob/main/server/usernames.js"
click node_ai "https://github.com/kanreez/hackathon/blob/main/server/anthropic.js"

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_auth,node_account,node_garageapi,node_paymentclient toneBlue
class node_search,node_garage,node_booking,node_review toneAmber
class node_hostlist,node_listing toneMint
class node_server,node_rules,node_pricing,node_provider,node_repository,node_geocoding,node_photos,node_usernames toneRose
class node_supabase,node_ai,node_nominatim,node_esp,node_renter,node_host toneIndigo
```

## Components

### Expo client

- [Sign in](https://github.com/kanreez/hackathon/blob/main/src/app/(auth)/login.tsx): `src/app/(auth)/login.tsx`
- [Profile and settings](https://github.com/kanreez/hackathon/blob/main/src/app/settings.tsx): `src/app/settings.tsx`
- [Garage API client](https://github.com/kanreez/hackathon/blob/main/src/services/garages.ts): `src/services/garages.ts`
- [Payment API client](https://github.com/kanreez/hackathon/blob/main/src/services/payments.ts): `src/services/payments.ts`

### Rental workflow

- [Find garages](https://github.com/kanreez/hackathon/blob/main/src/app/(tabs)/index.tsx): `src/app/(tabs)/index.tsx`
- [Garage details](https://github.com/kanreez/hackathon/blob/main/src/app/garage/%5Bid%5D.tsx): `src/app/garage/[id].tsx`
- [Bookings and door](https://github.com/kanreez/hackathon/blob/main/src/app/(tabs)/bookings.tsx): `src/app/(tabs)/bookings.tsx`
- [Review stay](https://github.com/kanreez/hackathon/blob/main/src/components/ReviewBox.tsx): `src/components/ReviewBox.tsx`

### Host management

- [Your garages](https://github.com/kanreez/hackathon/blob/main/src/app/host/index.tsx): `src/app/host/index.tsx`
- [Create listing](https://github.com/kanreez/hackathon/blob/main/src/app/host/new.tsx): `src/app/host/new.tsx`

### Server services

- [Express API](https://github.com/kanreez/hackathon/blob/main/server/server.js): `server/server.js`
- [Search and garage rules](https://github.com/kanreez/hackathon/blob/main/server/garages.js): `server/garages.js`
- [Pricing and checkout](https://github.com/kanreez/hackathon/blob/main/server/payments/pricing.js): `server/payments/pricing.js`
- [Payment provider](https://github.com/kanreez/hackathon/blob/main/server/payments/provider.js): `server/payments/provider.js`
- [Data repository](https://github.com/kanreez/hackathon/blob/main/server/repo.js): `server/repo.js`
- [Address geocoding](https://github.com/kanreez/hackathon/blob/main/server/geocode.js): `server/geocode.js`
- [Garage photos](https://github.com/kanreez/hackathon/blob/main/server/photos.js): `server/photos.js`
- [Username management](https://github.com/kanreez/hackathon/blob/main/server/usernames.js): `server/usernames.js`

### External systems

- **Supabase**
- [AI search providers](https://github.com/kanreez/hackathon/blob/main/server/anthropic.js): `server/anthropic.js`
- **Nominatim**
- **ESP32 door**

### Other components

- **Renter**
- **Garage host**

## Connections

- Renter → Sign in: signs in (evidence: `README.md`)
- Renter → Find garages: searches (evidence: `README.md`)
- Find garages → Garage API client: requests results (evidence: `src/app/(tabs)/index.tsx`)
- Garage API client → Express API: calls API (evidence: `src/services/garages.ts`)
- Express API → Search and garage rules: handles search (evidence: `server/server.js`)
- Search and garage rules → AI search providers: parses query (evidence: `README.md`)
- Renter → Garage details: selects listing (evidence: `README.md`)
- Garage details → Garage API client: creates booking (evidence: `README.md`)
- Garage details → Payment API client: starts checkout (evidence: `README.md`)
- Payment API client → Express API: calls API (evidence: `README.md`)
- Express API → Pricing and checkout: calculates price (evidence: `server/server.js`)
- Express API → Payment provider: confirms payment (evidence: `server/server.js`)
- Express API → Data repository: reads and writes (evidence: `server/server.js`)
- Data repository → Supabase: persists data (evidence: `README.md`)
- Renter → Bookings and door: manages stay (evidence: `README.md`)
- Bookings and door → Garage API client: requests door action (evidence: `README.md`)
- Express API → ESP32 door: queues commands (evidence: `README.md`)
- ESP32 door → Express API: polls and acknowledges (evidence: `README.md`)
- Bookings and door → Review stay: reviews stay (evidence: `README.md`)
- Review stay → Garage API client: saves review (evidence: `src/components/ReviewBox.tsx`)
- Garage host → Your garages: manages listings (evidence: `README.md`)
- Garage host → Create listing: creates listing (evidence: `README.md`)
- Your garages → Garage API client: updates listings (evidence: `src/app/host/index.tsx`)
- Create listing → Garage API client: submits listing (evidence: `README.md`)
- Create listing → Address geocoding: finds address (evidence: `README.md`)
- Address geocoding → Nominatim: queries addresses (evidence: `README.md`)
- Create listing → Garage photos: uploads photos (evidence: `README.md`)
- Garage photos → Supabase: stores images (evidence: `README.md`)
- Your garages → Express API: pairs door device (evidence: `README.md`)
- Profile and settings → Username management: changes username (evidence: `README.md`)
- Express API → Username management: handles usernames (evidence: `server/server.js`)
- Express API → Supabase: uses auth and storage (evidence: `README.md`)
