# business8281/citylifes_management_app architecture

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

- Interactive diagram: https://gitdiagram.com/business8281/citylifes_management_app
- Repository: https://github.com/business8281/citylifes_management_app

## Overview

This is a hostel and property management product with an Expo mobile/web client, a Firestore-backed Node API, and Firebase Functions. Owners configure properties and hostels, manage rooms, tenants, operations, and reports; tenants can find and join a hostel/property and use tenant workflows. The client also supports authentication, KYC, subscriptions and payments, agreements, and notifications. Source excerpts establish some wiring, while several product areas are represented by their exact tree directories because their screen implementations were not sampled.

Main entry points: [`backend-node/server.js`](https://github.com/business8281/citylifes_management_app/blob/main/backend-node/server.js) (HTTP server and routing), [`frontend/contexts/AuthContext.tsx`](https://github.com/business8281/citylifes_management_app/blob/main/frontend/contexts/AuthContext.tsx) (Session and identity), [`frontend/lib/firebase.ts`](https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/firebase.ts) (Hostel data access), [`frontend/app/(tabs)`](https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(tabs)) (Management workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client workflows"]
  node_auth_ui["Sign-in and roles"]
  node_owner_setup["Owner setup and billing"]
  node_tenant_flow["Tenant search and checkout"]
  node_workspace["Management workspace"]
  node_tenant_views["Tenant dashboards"]
end

subgraph group_client_core["Client foundations"]
  node_auth_context["Session and identity<br/>[AuthContext.tsx]"]
  node_firebase_client["Hostel data access<br/>[firebase.ts]"]
  node_property_data["Property data access<br/>[propertyDb.ts]"]
  node_notifications_client["Client notifications<br/>[notifications.ts]"]
  node_storage["Local storage<br/>[storage.ts]"]
  node_agreement_pdf["Agreement PDF<br/>[pdfGenerator.ts]"]
  node_screen_wrapper["Screen layout<br/>[ScreenWrapper.tsx]"]
  node_skeleton["Loading skeleton<br/>[Skeleton.tsx]"]
  node_theme["Responsive theme<br/>[theme.ts]"]
end

subgraph group_node_api["Node API"]
  node_node_server["HTTP server and routing<br/>[server.js]"]
  node_node_hostels["Hostel routes<br/>[hostels.js]"]
  node_node_rooms["Room routes<br/>[rooms.js]"]
  node_node_tenants["Tenant routes<br/>[tenants.js]"]
  node_node_operations["Operations routes<br/>[operations.js]"]
  node_node_reports["Report routes<br/>[reports.js]"]
  node_scheduler["Scheduled jobs<br/>[cron.js]"]
end

subgraph group_firebase["Firebase services"]
  node_functions_api["Functions API router<br/>[api.ts]"]
  node_functions_entry["Function entry points<br/>[index.ts]"]
  node_functions_notifications["Notification services<br/>[notifications.ts]"]
  node_fcm_sender["FCM delivery"]
  node_function_rooms["Room routes<br/>[rooms.js]"]
  node_function_operations["Operations routes<br/>[operations.js]"]
  node_function_data_routes["Other domain routes"]
end

subgraph group_shared_data["Property data"]
  node_firestore[("Firebase Firestore")]
end

node_actors(("Owners and tenants"))

node_actors -->|"sign in"| node_auth_ui
node_actors -.->|"configure account"| node_owner_setup
node_actors -.->|"find and join"| node_tenant_flow
node_actors -.->|"manage lodging"| node_workspace
node_auth_ui -->|"uses identity"| node_auth_context
node_owner_setup -->|"uses session"| node_auth_context
node_tenant_flow -->|"searches hostels"| node_firebase_client
node_tenant_flow -->|"reads properties"| node_property_data
node_workspace -->|"loads tenant data"| node_firebase_client
node_workspace -->|"accesses property data"| node_property_data
node_workspace -->|"uses notifications"| node_notifications_client
node_workspace -->|"generates documents"| node_agreement_pdf
node_auth_context -->|"syncs profiles"| node_firebase_client
node_auth_context -->|"loads assignments"| node_property_data
node_auth_context -->|"uses storage"| node_storage
node_auth_context -->|"uses notifications"| node_notifications_client
node_property_data -->|"uses Firestore client"| node_firebase_client
node_firebase_client -->|"reads and writes"| node_firestore
node_property_data -->|"reads and writes"| node_firestore
node_notifications_client -->|"uses data client"| node_firebase_client
node_screen_wrapper -->|"uses colors"| node_theme
node_skeleton -->|"uses theme"| node_theme
node_tenant_views -->|"renders loading"| node_skeleton
node_node_server -->|"mounts routes"| node_node_hostels
node_node_server -->|"mounts routes"| node_node_rooms
node_node_server -->|"mounts routes"| node_node_tenants
node_node_server -->|"mounts routes"| node_node_operations
node_node_server -->|"mounts routes"| node_node_reports
node_node_server -->|"starts scheduler"| node_scheduler
node_functions_entry -->|"registers API"| node_functions_api
node_functions_entry -->|"imports services"| node_functions_notifications
node_functions_entry -->|"imports sender"| node_fcm_sender
node_functions_api -->|"mounts routes"| node_function_rooms
node_functions_api -->|"mounts routes"| node_function_operations
node_functions_api -->|"mounts routes"| node_function_data_routes
node_functions_notifications -.->|"uses data store"| node_firestore
node_fcm_sender -.->|"uses messaging data"| node_firestore

click node_auth_ui "https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(auth)"
click node_owner_setup "https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(owner)"
click node_tenant_flow "https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(tenant)"
click node_workspace "https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(tabs)"
click node_tenant_views "https://github.com/business8281/citylifes_management_app/tree/main/frontend/components/tenant"
click node_auth_context "https://github.com/business8281/citylifes_management_app/blob/main/frontend/contexts/AuthContext.tsx"
click node_firebase_client "https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/firebase.ts"
click node_property_data "https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/propertyDb.ts"
click node_notifications_client "https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/notifications.ts"
click node_storage "https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/storage.ts"
click node_agreement_pdf "https://github.com/business8281/citylifes_management_app/blob/main/frontend/utils/pdfGenerator.ts"
click node_screen_wrapper "https://github.com/business8281/citylifes_management_app/blob/main/frontend/components/layout/ScreenWrapper.tsx"
click node_skeleton "https://github.com/business8281/citylifes_management_app/blob/main/frontend/components/common/Skeleton.tsx"
click node_theme "https://github.com/business8281/citylifes_management_app/blob/main/frontend/utils/theme.ts"
click node_node_server "https://github.com/business8281/citylifes_management_app/blob/main/backend-node/server.js"
click node_node_hostels "https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/hostels.js"
click node_node_rooms "https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/rooms.js"
click node_node_tenants "https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/tenants.js"
click node_node_operations "https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/operations.js"
click node_node_reports "https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/reports.js"
click node_scheduler "https://github.com/business8281/citylifes_management_app/blob/main/backend-node/cron.js"
click node_functions_api "https://github.com/business8281/citylifes_management_app/blob/main/functions/src/api.ts"
click node_functions_entry "https://github.com/business8281/citylifes_management_app/blob/main/functions/src/index.ts"
click node_functions_notifications "https://github.com/business8281/citylifes_management_app/blob/main/functions/src/notifications.ts"
click node_fcm_sender "https://github.com/business8281/citylifes_management_app/blob/main/functions/src/sendFCMNotification.ts"
click node_function_rooms "https://github.com/business8281/citylifes_management_app/blob/main/functions/src/routes/rooms.js"
click node_function_operations "https://github.com/business8281/citylifes_management_app/blob/main/functions/src/routes/operations.js"
click node_function_data_routes "https://github.com/business8281/citylifes_management_app/tree/main/functions/src/routes"

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_ui,node_owner_setup,node_tenant_flow,node_workspace,node_tenant_views toneBlue
class node_auth_context,node_firebase_client,node_property_data,node_notifications_client,node_storage,node_agreement_pdf,node_screen_wrapper,node_skeleton,node_theme toneAmber
class node_node_server,node_node_hostels,node_node_rooms,node_node_tenants,node_node_operations,node_node_reports,node_scheduler toneMint
class node_functions_api,node_functions_entry,node_functions_notifications,node_fcm_sender,node_function_rooms,node_function_operations,node_function_data_routes toneRose
class node_firestore,node_actors toneIndigo
```

## Components

### Client workflows

- [Sign-in and roles](https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(auth)): `frontend/app/(auth)`
- [Owner setup and billing](https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(owner)): `frontend/app/(owner)`
- [Tenant search and checkout](https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(tenant)): `frontend/app/(tenant)`
- [Management workspace](https://github.com/business8281/citylifes_management_app/tree/main/frontend/app/(tabs)): `frontend/app/(tabs)`
- [Tenant dashboards](https://github.com/business8281/citylifes_management_app/tree/main/frontend/components/tenant): `frontend/components/tenant`

### Client foundations

- [Session and identity](https://github.com/business8281/citylifes_management_app/blob/main/frontend/contexts/AuthContext.tsx): `frontend/contexts/AuthContext.tsx`
- [Hostel data access](https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/firebase.ts): `frontend/lib/firebase.ts`
- [Property data access](https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/propertyDb.ts): `frontend/lib/propertyDb.ts`
- [Client notifications](https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/notifications.ts): `frontend/lib/notifications.ts`
- [Local storage](https://github.com/business8281/citylifes_management_app/blob/main/frontend/lib/storage.ts): `frontend/lib/storage.ts`
- [Agreement PDF](https://github.com/business8281/citylifes_management_app/blob/main/frontend/utils/pdfGenerator.ts): `frontend/utils/pdfGenerator.ts`
- [Screen layout](https://github.com/business8281/citylifes_management_app/blob/main/frontend/components/layout/ScreenWrapper.tsx): `frontend/components/layout/ScreenWrapper.tsx`
- [Loading skeleton](https://github.com/business8281/citylifes_management_app/blob/main/frontend/components/common/Skeleton.tsx): `frontend/components/common/Skeleton.tsx`
- [Responsive theme](https://github.com/business8281/citylifes_management_app/blob/main/frontend/utils/theme.ts): `frontend/utils/theme.ts`

### Node API

- [HTTP server and routing](https://github.com/business8281/citylifes_management_app/blob/main/backend-node/server.js): `backend-node/server.js`
- [Hostel routes](https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/hostels.js): `backend-node/routes/owner/hostels.js`
- [Room routes](https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/rooms.js): `backend-node/routes/owner/rooms.js`
- [Tenant routes](https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/tenants.js): `backend-node/routes/owner/tenants.js`
- [Operations routes](https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/operations.js): `backend-node/routes/owner/operations.js`
- [Report routes](https://github.com/business8281/citylifes_management_app/blob/main/backend-node/routes/owner/reports.js): `backend-node/routes/owner/reports.js`
- [Scheduled jobs](https://github.com/business8281/citylifes_management_app/blob/main/backend-node/cron.js): `backend-node/cron.js`

### Firebase services

- [Functions API router](https://github.com/business8281/citylifes_management_app/blob/main/functions/src/api.ts): `functions/src/api.ts`
- [Function entry points](https://github.com/business8281/citylifes_management_app/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [Notification services](https://github.com/business8281/citylifes_management_app/blob/main/functions/src/notifications.ts): `functions/src/notifications.ts`
- [FCM delivery](https://github.com/business8281/citylifes_management_app/blob/main/functions/src/sendFCMNotification.ts): `functions/src/sendFCMNotification.ts`
- [Room routes](https://github.com/business8281/citylifes_management_app/blob/main/functions/src/routes/rooms.js): `functions/src/routes/rooms.js`
- [Operations routes](https://github.com/business8281/citylifes_management_app/blob/main/functions/src/routes/operations.js): `functions/src/routes/operations.js`
- [Other domain routes](https://github.com/business8281/citylifes_management_app/tree/main/functions/src/routes): `functions/src/routes`

### Property data

- **Firebase Firestore**

### Other components

- **Owners and tenants**

## Connections

- Owners and tenants → Sign-in and roles: sign in
- Owners and tenants → Owner setup and billing: configure account
- Owners and tenants → Tenant search and checkout: find and join
- Owners and tenants → Management workspace: manage lodging
- Sign-in and roles → Session and identity: uses identity (evidence: `frontend/app/(auth)/index.tsx`)
- Owner setup and billing → Session and identity: uses session (evidence: `frontend/app/(owner)/managers.tsx`)
- Tenant search and checkout → Hostel data access: searches hostels (evidence: `frontend/app/(tenant)/hostel-search.tsx`)
- Tenant search and checkout → Property data access: reads properties (evidence: `frontend/app/(tenant)/hostel-search.tsx`)
- Management workspace → Hostel data access: loads tenant data (evidence: `frontend/app/(tabs)/tenants.tsx`)
- Management workspace → Property data access: accesses property data (evidence: `frontend/app/(tabs)/tenants.tsx`)
- Management workspace → Client notifications: uses notifications (evidence: `frontend/app/(tabs)/tenants.tsx`)
- Management workspace → Agreement PDF: generates documents (evidence: `frontend/app/(tabs)/tenants.tsx`)
- Session and identity → Hostel data access: syncs profiles (evidence: `frontend/contexts/AuthContext.tsx`)
- Session and identity → Property data access: loads assignments (evidence: `frontend/contexts/AuthContext.tsx`)
- Session and identity → Local storage: uses storage (evidence: `frontend/contexts/AuthContext.tsx`)
- Session and identity → Client notifications: uses notifications (evidence: `frontend/contexts/AuthContext.tsx`)
- Property data access → Hostel data access: uses Firestore client (evidence: `frontend/lib/propertyDb.ts`)
- Hostel data access → Firebase Firestore: reads and writes (evidence: `frontend/lib/firebase.ts`)
- Property data access → Firebase Firestore: reads and writes (evidence: `frontend/lib/propertyDb.ts`)
- Client notifications → Hostel data access: uses data client (evidence: `frontend/lib/notifications.ts`)
- Screen layout → Responsive theme: uses colors (evidence: `frontend/components/layout/ScreenWrapper.tsx`)
- Loading skeleton → Responsive theme: uses theme (evidence: `frontend/components/common/Skeleton.tsx`)
- Tenant dashboards → Loading skeleton: renders loading (evidence: `frontend/components/tenant/HostelTenantDashboard.tsx`)
- HTTP server and routing → Hostel routes: mounts routes (evidence: `backend-node/server.js`)
- HTTP server and routing → Room routes: mounts routes (evidence: `backend-node/server.js`)
- HTTP server and routing → Tenant routes: mounts routes (evidence: `backend-node/server.js`)
- HTTP server and routing → Operations routes: mounts routes (evidence: `backend-node/server.js`)
- HTTP server and routing → Report routes: mounts routes (evidence: `backend-node/server.js`)
- HTTP server and routing → Scheduled jobs: starts scheduler (evidence: `backend-node/server.js`)
- Function entry points → Functions API router: registers API (evidence: `functions/src/index.ts`)
- Function entry points → Notification services: imports services (evidence: `functions/src/index.ts`)
- Function entry points → FCM delivery: imports sender (evidence: `functions/src/index.ts`)
- Functions API router → Room routes: mounts routes (evidence: `functions/src/api.ts`)
- Functions API router → Operations routes: mounts routes (evidence: `functions/src/api.ts`)
- Functions API router → Other domain routes: mounts routes (evidence: `functions/src/api.ts`)
- Notification services → Firebase Firestore: uses data store
- FCM delivery → Firebase Firestore: uses messaging data
