# rachsindutama/web_camerarent architecture

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

- Interactive diagram: https://gitdiagram.com/rachsindutama/web_camerarent
- Repository: https://github.com/rachsindutama/web_camerarent

## Overview

CameraRent is a multi-branch camera and production-equipment rental web app. The main renter workflow is selecting a branch and gear, checking serial-unit availability, keeping a booking draft through sign-in, then managing bookings and invoices; branch staff handle fulfillment, inspections and finance, while superadmins govern tenants and platform settings. The graph also preserves the documented inventory, membership, logistics and chat capabilities. Feature-to-feature arrows follow the supplied App routing and sampled references; README-described but unsampled behavior is labeled with unverified dashed links.

Main entry points: [`src/lib/firebase.ts`](https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/firebase.ts) (Firebase services), [`src/features/inventory/CatalogPage.tsx`](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inventory/CatalogPage.tsx) (Unified gear catalog), [`src/App.tsx`](https://github.com/rachsindutama/web_camerarent/blob/main/src/App.tsx) (Route dispatcher), [`src/features/bookings/AdminBookingsPage.tsx`](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/bookings/AdminBookingsPage.tsx) (Booking operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Access and tenancy"]
  node_app["Route dispatcher<br/>[App.tsx]"]
  node_auth["Authentication and registration<br/>[AuthContext.tsx]"]
  node_guard["Role and auth guards<br/>[RoleGuard.tsx]"]
  node_tenant["Branch selection<br/>[useTenant.ts]"]
  node_geo["Nearest branch lookup<br/>[geo.ts]"]
end

subgraph group_rental["Rental storefront"]
  node_catalog["Unified gear catalog<br/>[CatalogPage.tsx]"]
  node_availability["Serial availability<br/>[availability.ts]"]
  node_draft[("Booking draft")]
  node_membership["Membership benefits<br/>[membership.ts]"]
  node_mybookings["Renter bookings<br/>[MyBookingsPage.tsx]"]
  node_invoice["Invoice documents<br/>[invoicePdf.ts]"]
end

subgraph group_operations["Branch operations"]
  node_inventory["Inventory and serial units<br/>[InventoryPage.tsx]"]
  node_bundles["Production bundles<br/>[BundlesPage.tsx]"]
  node_adminbookings["Booking operations"]
  node_inspection["Rental inspections"]
  node_logistics["Delivery logistics<br/>[LogisticsPage.tsx]"]
  node_finance["Cash flow ledger<br/>[FinancePage.tsx]"]
  node_chat["Client chat<br/>[ChatPage.tsx]"]
  node_members["Member management<br/>[MembersPage.tsx]"]
  node_staff["Staff management<br/>[StaffPage.tsx]"]
end

subgraph group_governance["Platform governance"]
  node_tenants["Tenant directory and GMV<br/>[TenantsPage.tsx]"]
  node_settings["Global settings<br/>[SettingsPage.tsx]"]
end

subgraph group_foundation["Shared services"]
  node_platform["Platform settings service"]
  node_firebase[("Firebase services<br/>[firebase.ts]")]
  node_language["Bilingual interface<br/>[useI18n.ts]"]
end

node_visitor(("Visitor or renter"))

node_visitor -->|"opens app"| node_app
node_app -->|"routes to"| node_catalog
node_app -->|"checks access"| node_guard
node_app -->|"uses session"| node_auth
node_auth -->|"authenticates and reads profiles"| node_firebase
node_guard -.->|"checks identity"| node_auth
node_catalog -.->|"selects branch"| node_tenant
node_tenant -->|"detects nearby"| node_geo
node_tenant -->|"reads tenants"| node_firebase
node_catalog -->|"checks units"| node_availability
node_availability -->|"reads slots"| node_firebase
node_catalog -->|"saves selections"| node_draft
node_catalog -->|"applies benefits"| node_membership
node_catalog -->|"prompts sign-in"| node_auth
node_app -->|"routes renters"| node_mybookings
node_mybookings -.->|"generates invoice"| node_invoice
node_app -->|"routes operations"| node_adminbookings
node_adminbookings -->|"checks availability"| node_availability
node_adminbookings -->|"generates invoice"| node_invoice
node_adminbookings -.->|"coordinates checks"| node_inspection
node_adminbookings -.->|"coordinates delivery"| node_logistics
node_adminbookings -.->|"records payments"| node_finance
node_inventory -.->|"manages equipment"| node_firebase
node_bundles -.->|"stores bundles"| node_firebase
node_inspection -.->|"records condition"| node_firebase
node_logistics -.->|"updates checkpoints"| node_firebase
node_finance -.->|"reads and writes ledger"| node_firebase
node_chat -->|"syncs messages"| node_firebase
node_members -.->|"manages member records"| node_firebase
node_staff -.->|"manages staff records"| node_firebase
node_tenants -.->|"manages branches"| node_firebase
node_settings -->|"edits settings"| node_platform
node_platform -->|"loads and saves settings"| node_firebase
node_platform -->|"publishes live benefits"| node_membership
node_platform -.->|"applies branch defaults"| node_tenants
node_catalog -.->|"renders translations"| node_language

click node_app "https://github.com/rachsindutama/web_camerarent/blob/main/src/App.tsx"
click node_auth "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/auth/AuthContext.tsx"
click node_guard "https://github.com/rachsindutama/web_camerarent/blob/main/src/components/layout/RoleGuard.tsx"
click node_tenant "https://github.com/rachsindutama/web_camerarent/blob/main/src/hooks/useTenant.ts"
click node_geo "https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/geo.ts"
click node_catalog "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inventory/CatalogPage.tsx"
click node_availability "https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/availability.ts"
click node_draft "https://github.com/rachsindutama/web_camerarent/blob/main/src/store/useBookingDraftStore.ts"
click node_membership "https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/membership.ts"
click node_mybookings "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/bookings/MyBookingsPage.tsx"
click node_invoice "https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/invoicePdf.ts"
click node_inventory "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inventory/InventoryPage.tsx"
click node_bundles "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inventory/BundlesPage.tsx"
click node_adminbookings "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/bookings/AdminBookingsPage.tsx"
click node_inspection "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inspections/InspectionsPage.tsx"
click node_logistics "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/logistics/LogisticsPage.tsx"
click node_finance "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/finance/FinancePage.tsx"
click node_chat "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/chat/ChatPage.tsx"
click node_members "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/members/MembersPage.tsx"
click node_staff "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/staff/StaffPage.tsx"
click node_tenants "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/superadmin/TenantsPage.tsx"
click node_settings "https://github.com/rachsindutama/web_camerarent/blob/main/src/features/superadmin/SettingsPage.tsx"
click node_platform "https://github.com/rachsindutama/web_camerarent/blob/main/src/hooks/usePlatformSettings.ts"
click node_firebase "https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/firebase.ts"
click node_language "https://github.com/rachsindutama/web_camerarent/blob/main/src/hooks/useI18n.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_app,node_auth,node_guard,node_tenant,node_geo toneBlue
class node_catalog,node_availability,node_draft,node_membership,node_mybookings,node_invoice toneAmber
class node_inventory,node_bundles,node_adminbookings,node_inspection,node_logistics,node_finance,node_chat,node_members,node_staff toneMint
class node_tenants,node_settings toneRose
class node_platform,node_firebase,node_language,node_visitor toneIndigo
```

## Components

### Access and tenancy

- [Route dispatcher](https://github.com/rachsindutama/web_camerarent/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication and registration](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/auth/AuthContext.tsx): `src/features/auth/AuthContext.tsx`
- [Role and auth guards](https://github.com/rachsindutama/web_camerarent/blob/main/src/components/layout/RoleGuard.tsx): `src/components/layout/RoleGuard.tsx`
- [Branch selection](https://github.com/rachsindutama/web_camerarent/blob/main/src/hooks/useTenant.ts): `src/hooks/useTenant.ts`
- [Nearest branch lookup](https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/geo.ts): `src/lib/geo.ts`

### Rental storefront

- [Unified gear catalog](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inventory/CatalogPage.tsx): `src/features/inventory/CatalogPage.tsx`
- [Serial availability](https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/availability.ts): `src/lib/availability.ts`
- [Booking draft](https://github.com/rachsindutama/web_camerarent/blob/main/src/store/useBookingDraftStore.ts): `src/store/useBookingDraftStore.ts`
- [Membership benefits](https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/membership.ts): `src/lib/membership.ts`
- [Renter bookings](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/bookings/MyBookingsPage.tsx): `src/features/bookings/MyBookingsPage.tsx`
- [Invoice documents](https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/invoicePdf.ts): `src/lib/invoicePdf.ts`

### Branch operations

- [Inventory and serial units](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inventory/InventoryPage.tsx): `src/features/inventory/InventoryPage.tsx`
- [Production bundles](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inventory/BundlesPage.tsx): `src/features/inventory/BundlesPage.tsx`
- [Booking operations](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/bookings/AdminBookingsPage.tsx): `src/features/bookings/AdminBookingsPage.tsx`
- [Rental inspections](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/inspections/InspectionsPage.tsx): `src/features/inspections/InspectionsPage.tsx`
- [Delivery logistics](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/logistics/LogisticsPage.tsx): `src/features/logistics/LogisticsPage.tsx`
- [Cash flow ledger](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/finance/FinancePage.tsx): `src/features/finance/FinancePage.tsx`
- [Client chat](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/chat/ChatPage.tsx): `src/features/chat/ChatPage.tsx`
- [Member management](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/members/MembersPage.tsx): `src/features/members/MembersPage.tsx`
- [Staff management](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/staff/StaffPage.tsx): `src/features/staff/StaffPage.tsx`

### Platform governance

- [Tenant directory and GMV](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/superadmin/TenantsPage.tsx): `src/features/superadmin/TenantsPage.tsx`
- [Global settings](https://github.com/rachsindutama/web_camerarent/blob/main/src/features/superadmin/SettingsPage.tsx): `src/features/superadmin/SettingsPage.tsx`

### Shared services

- [Platform settings service](https://github.com/rachsindutama/web_camerarent/blob/main/src/hooks/usePlatformSettings.ts): `src/hooks/usePlatformSettings.ts`
- [Firebase services](https://github.com/rachsindutama/web_camerarent/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Bilingual interface](https://github.com/rachsindutama/web_camerarent/blob/main/src/hooks/useI18n.ts): `src/hooks/useI18n.ts`

### Other components

- **Visitor or renter**

## Connections

- Visitor or renter → Route dispatcher: opens app (evidence: `src/App.tsx`)
- Route dispatcher → Unified gear catalog: routes to (evidence: `src/App.tsx`)
- Route dispatcher → Role and auth guards: checks access (evidence: `src/App.tsx`)
- Route dispatcher → Authentication and registration: uses session (evidence: `src/App.tsx`)
- Authentication and registration → Firebase services: authenticates and reads profiles (evidence: `src/features/auth/AuthContext.tsx`)
- Role and auth guards → Authentication and registration: checks identity
- Unified gear catalog → Branch selection: selects branch (evidence: `src/features/inventory/CatalogPage.tsx`)
- Branch selection → Nearest branch lookup: detects nearby (evidence: `src/hooks/useTenant.ts`)
- Branch selection → Firebase services: reads tenants (evidence: `src/hooks/useTenant.ts`)
- Unified gear catalog → Serial availability: checks units (evidence: `src/features/inventory/CatalogPage.tsx`)
- Serial availability → Firebase services: reads slots (evidence: `src/lib/availability.ts`)
- Unified gear catalog → Booking draft: saves selections (evidence: `src/features/inventory/CatalogPage.tsx`)
- Unified gear catalog → Membership benefits: applies benefits (evidence: `src/features/inventory/CatalogPage.tsx`)
- Unified gear catalog → Authentication and registration: prompts sign-in (evidence: `src/features/inventory/CatalogPage.tsx`)
- Route dispatcher → Renter bookings: routes renters (evidence: `src/App.tsx`)
- Renter bookings → Invoice documents: generates invoice
- Route dispatcher → Booking operations: routes operations (evidence: `src/App.tsx`)
- Booking operations → Serial availability: checks availability (evidence: `src/features/bookings/AdminBookingsPage.tsx`)
- Booking operations → Invoice documents: generates invoice (evidence: `src/features/bookings/AdminBookingsPage.tsx`)
- Booking operations → Rental inspections: coordinates checks
- Booking operations → Delivery logistics: coordinates delivery
- Booking operations → Cash flow ledger: records payments
- Inventory and serial units → Firebase services: manages equipment
- Production bundles → Firebase services: stores bundles
- Rental inspections → Firebase services: records condition
- Delivery logistics → Firebase services: updates checkpoints
- Cash flow ledger → Firebase services: reads and writes ledger
- Client chat → Firebase services: syncs messages (evidence: `src/features/chat/ChatPage.tsx`)
- Member management → Firebase services: manages member records
- Staff management → Firebase services: manages staff records
- Tenant directory and GMV → Firebase services: manages branches
- Global settings → Platform settings service: edits settings (evidence: `src/features/superadmin/SettingsPage.tsx`)
- Platform settings service → Firebase services: loads and saves settings (evidence: `src/hooks/usePlatformSettings.ts`)
- Platform settings service → Membership benefits: publishes live benefits (evidence: `src/hooks/usePlatformSettings.ts`)
- Platform settings service → Tenant directory and GMV: applies branch defaults
- Unified gear catalog → Bilingual interface: renders translations (evidence: `src/features/inventory/CatalogPage.tsx`)
