# tharunbalajis/apartment_management_system architecture

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

- Interactive diagram: https://gitdiagram.com/tharunbalajis/apartment_management_system
- Repository: https://github.com/tharunbalajis/apartment_management_system

## Overview

This repository combines an apartment-management web app with a Fastify backend, including a separately aggregated mobile API. The main user workflow is to enter the web app, establish an authenticated and permission-checked session, navigate to a feature, and use its API client to retrieve or change society data. The tree also shows resident, visitor/security, complaint, finance, and administration capabilities. Backend mobile controllers and route registration are represented where sampled evidence supports them; README documentation was not provided, and many feature implementations were not sampled.

Main entry points: [`ams_frontEnd_services-main/apps/web/src/app/App.tsx`](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/App.tsx) (App routes), [`apartment_management_system-main/src/modules/mobile/routes.js`](https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/routes.js) (Mobile route aggregator), [`ams_frontEnd_services-main/apps/web/src/app/api/client.ts`](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/api/client.ts) (API client), [`ams_frontEnd_services-main/apps/web/src/main.tsx`](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/main.tsx) (Web entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webroot["Web entry<br/>[main.tsx]"]
  node_app["App routes<br/>[App.tsx]"]
  node_auth["Session and permissions<br/>[AuthProvider.tsx]"]
  node_scope["Society scope<br/>[ScopeProvider.tsx]"]
  node_api["API client<br/>[client.ts]"]
  node_roles["Roles and users<br/>[RolesPage.tsx]"]
  node_settings["Settings<br/>[SettingsPage.tsx]"]
end

subgraph group_operations["Society operations"]
  node_dash["Dashboards<br/>[DashboardPage.tsx]"]
  node_residents["Resident management"]
  node_units["Units and occupancy"]
  node_finance["Financial management"]
  node_complaints["Complaint handling"]
end

subgraph group_security["Access and security"]
  node_visitors["Visitor management"]
  node_patrol["Guard patrol<br/>[PatrolScanPage.tsx]"]
  node_qr["QR entry"]
  node_attendance["Staff attendance"]
end

subgraph group_backend["Mobile API"]
  node_mobile_routes["Mobile route aggregator<br/>[routes.js]"]
  node_mobile_resident["Resident mobile API<br/>[controller.js]"]
  node_mobile_staff["Staff mobile API<br/>[controller.js]"]
  node_mobile_complaints["Complaint mobile API<br/>[controller.js]"]
  node_mobile_security["Security mobile API<br/>[controller.js]"]
  node_mobile_settings["Settings mobile API<br/>[controller.js]"]
end

node_user(("Society user"))

node_user -->|"opens"| node_webroot
node_webroot -->|"provides context"| node_auth
node_webroot -->|"renders"| node_app
node_app -->|"checks access"| node_auth
node_app -.->|"routes to"| node_dash
node_app -->|"routes to"| node_residents
node_app -->|"routes to"| node_visitors
node_app -->|"routes to"| node_patrol
node_app -.->|"routes to"| node_qr
node_app -->|"routes to"| node_complaints
node_app -->|"routes to"| node_units
node_app -.->|"routes to"| node_finance
node_app -.->|"routes to"| node_attendance
node_app -->|"routes to"| node_roles
node_app -->|"routes to"| node_settings
node_residents -.->|"requests data"| node_api
node_units -.->|"requests data"| node_api
node_visitors -.->|"requests data"| node_api
node_api -.->|"calls backend"| node_mobile_routes
node_mobile_routes -->|"registers routes"| node_mobile_resident
node_mobile_routes -->|"registers routes"| node_mobile_staff
node_mobile_routes -->|"registers routes"| node_mobile_complaints
node_mobile_routes -->|"registers routes"| node_mobile_security
node_mobile_routes -->|"registers routes"| node_mobile_settings

click node_webroot "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/main.tsx"
click node_app "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/App.tsx"
click node_auth "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/auth/AuthProvider.tsx"
click node_scope "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/scope/ScopeProvider.tsx"
click node_api "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/api/client.ts"
click node_dash "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/dashboard/pages/DashboardPage.tsx"
click node_residents "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/residents/pages/ResidentDirectoryPage.tsx"
click node_units "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/residents/pages/UnitManagementPage.tsx"
click node_finance "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/financials/pages/FinanceDashboardPage.tsx"
click node_complaints "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/complaints/pages/ComplaintDashboardPage.tsx"
click node_visitors "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/visitors/pages/GuestPassesPage.tsx"
click node_patrol "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/visitors/pages/PatrolScanPage.tsx"
click node_qr "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/visitors/pages/QREntrySystemPage.tsx"
click node_attendance "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/visitors/pages/StaffAttendancePage.tsx"
click node_roles "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/roles/pages/RolesPage.tsx"
click node_settings "https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/settings/pages/SettingsPage.tsx"
click node_mobile_routes "https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/routes.js"
click node_mobile_resident "https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/resident/controller.js"
click node_mobile_staff "https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/staff/controller.js"
click node_mobile_complaints "https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/complaints/controller.js"
click node_mobile_security "https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/security/controller.js"
click node_mobile_settings "https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/settings/controller.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_webroot,node_app,node_auth,node_scope,node_api,node_roles,node_settings,node_user toneBlue
class node_dash,node_residents,node_units,node_finance,node_complaints toneAmber
class node_visitors,node_patrol,node_qr,node_attendance toneMint
class node_mobile_routes,node_mobile_resident,node_mobile_staff,node_mobile_complaints,node_mobile_security,node_mobile_settings toneRose
```

## Components

### Web application

- [Web entry](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/main.tsx): `ams_frontEnd_services-main/apps/web/src/main.tsx`
- [App routes](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/App.tsx): `ams_frontEnd_services-main/apps/web/src/app/App.tsx`
- [Session and permissions](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/auth/AuthProvider.tsx): `ams_frontEnd_services-main/apps/web/src/app/auth/AuthProvider.tsx`
- [Society scope](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/scope/ScopeProvider.tsx): `ams_frontEnd_services-main/apps/web/src/app/scope/ScopeProvider.tsx`
- [API client](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/app/api/client.ts): `ams_frontEnd_services-main/apps/web/src/app/api/client.ts`
- [Roles and users](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/roles/pages/RolesPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/roles/pages/RolesPage.tsx`
- [Settings](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/settings/pages/SettingsPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/settings/pages/SettingsPage.tsx`

### Society operations

- [Dashboards](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/dashboard/pages/DashboardPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/dashboard/pages/DashboardPage.tsx`
- [Resident management](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/residents/pages/ResidentDirectoryPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/residents/pages/ResidentDirectoryPage.tsx`
- [Units and occupancy](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/residents/pages/UnitManagementPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/residents/pages/UnitManagementPage.tsx`
- [Financial management](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/financials/pages/FinanceDashboardPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/financials/pages/FinanceDashboardPage.tsx`
- [Complaint handling](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/complaints/pages/ComplaintDashboardPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/complaints/pages/ComplaintDashboardPage.tsx`

### Access and security

- [Visitor management](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/visitors/pages/GuestPassesPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/visitors/pages/GuestPassesPage.tsx`
- [Guard patrol](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/visitors/pages/PatrolScanPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/visitors/pages/PatrolScanPage.tsx`
- [QR entry](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/visitors/pages/QREntrySystemPage.tsx): `ams_frontEnd_services-main/apps/web/src/features/visitors/pages/QREntrySystemPage.tsx`
- [Staff attendance](https://github.com/tharunbalajis/apartment_management_system/blob/main/ams_frontEnd_services-main/apps/web/src/features/visitors/pages/StaffAttendancePage.tsx): `ams_frontEnd_services-main/apps/web/src/features/visitors/pages/StaffAttendancePage.tsx`

### Mobile API

- [Mobile route aggregator](https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/routes.js): `apartment_management_system-main/src/modules/mobile/routes.js`
- [Resident mobile API](https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/resident/controller.js): `apartment_management_system-main/src/modules/mobile/resident/controller.js`
- [Staff mobile API](https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/staff/controller.js): `apartment_management_system-main/src/modules/mobile/staff/controller.js`
- [Complaint mobile API](https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/complaints/controller.js): `apartment_management_system-main/src/modules/mobile/complaints/controller.js`
- [Security mobile API](https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/security/controller.js): `apartment_management_system-main/src/modules/mobile/security/controller.js`
- [Settings mobile API](https://github.com/tharunbalajis/apartment_management_system/blob/main/apartment_management_system-main/src/modules/mobile/settings/controller.js): `apartment_management_system-main/src/modules/mobile/settings/controller.js`

### Other components

- **Society user**

## Connections

- Society user → Web entry: opens (evidence: `ams_frontEnd_services-main/apps/web/src/main.tsx`)
- Web entry → Session and permissions: provides context (evidence: `ams_frontEnd_services-main/apps/web/src/main.tsx`)
- Web entry → App routes: renders (evidence: `ams_frontEnd_services-main/apps/web/src/main.tsx`)
- App routes → Session and permissions: checks access (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Dashboards: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Resident management: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Visitor management: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Guard patrol: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → QR entry: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Complaint handling: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Units and occupancy: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Financial management: routes to
- App routes → Staff attendance: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Roles and users: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- App routes → Settings: routes to (evidence: `ams_frontEnd_services-main/apps/web/src/app/App.tsx`)
- Resident management → API client: requests data
- Units and occupancy → API client: requests data
- Visitor management → API client: requests data
- API client → Mobile route aggregator: calls backend
- Mobile route aggregator → Resident mobile API: registers routes (evidence: `apartment_management_system-main/src/modules/mobile/routes.js`)
- Mobile route aggregator → Staff mobile API: registers routes (evidence: `apartment_management_system-main/src/modules/mobile/routes.js`)
- Mobile route aggregator → Complaint mobile API: registers routes (evidence: `apartment_management_system-main/src/modules/mobile/routes.js`)
- Mobile route aggregator → Security mobile API: registers routes (evidence: `apartment_management_system-main/src/modules/mobile/routes.js`)
- Mobile route aggregator → Settings mobile API: registers routes (evidence: `apartment_management_system-main/src/modules/mobile/routes.js`)
