# warissecode/hopegestionv2 architecture

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

- Interactive diagram: https://gitdiagram.com/warissecode/hopegestionv2
- Repository: https://github.com/warissecode/hopegestionv2

## Overview

HopeGestionV2 is a web-based property-management product: managers and property owners maintain properties, tenants, leases and financial records, while tenants have role-specific access. The main workflow runs from the React application through backend API routes to PostgreSQL, with authentication and tenant protections shaping access. The README documents the broad client/server flow; sampled code confirms the app’s route protection, authentication-service calls and database access. Many feature routes are present in the tree but were not sampled, so their internal call wiring is not inferred.

Main entry points: [`backend/db/database.ts`](https://github.com/warissecode/hopegestionv2/blob/main/backend/db/database.ts) (PostgreSQL), [`frontend/src/App.tsx`](https://github.com/warissecode/hopegestionv2/blob/main/frontend/src/App.tsx) (Web application), [`backend/routes/edlRoutes.ts`](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/edlRoutes.ts) (Move-in/out inspections), [`frontend/src/components/LoginForm.tsx`](https://github.com/warissecode/hopegestionv2/blob/main/frontend/src/components/LoginForm.tsx) (Login and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and accounts"]
  node_web["Web application<br/>[App.tsx]"]
  node_authui["Login and signup<br/>[LoginForm.tsx]"]
  node_authapi["Authentication API<br/>[authRoutes.ts]"]
  node_authservice["Authentication service<br/>[AuthService.ts]"]
  node_accesscontrol["Access middleware<br/>[authMiddleware.ts]"]
  node_database[("PostgreSQL<br/>[database.ts]")]
end

subgraph group_property["Property and tenancy"]
  node_properties["Properties and lots<br/>[bienRoutes.ts]"]
  node_tenants["Tenant records<br/>[locataireRoutes.ts]"]
  node_leases["Leases and rentals<br/>[leaseRoutes.ts]"]
  node_reservations["Reservations"]
  node_inspections["Move-in/out inspections<br/>[edlRoutes.ts]"]
end

subgraph group_money["Payments and finance"]
  node_rentpayments["Rent payments"]
  node_receipts["Receipts<br/>[ReceiptService.ts]"]
  node_finance["Finance and expenses<br/>[financeRoutes.ts]"]
  node_mobilemoney["Mobile money"]
end

subgraph group_operations["Operations and insight"]
  node_dashboard["Dashboard and reports"]
  node_documents["Documents and templates<br/>[documentRoutes.ts]"]
  node_tasks["Tasks and calendar<br/>[taskRoutes.ts]"]
  node_notifications["Alerts and notifications"]
  node_audit["Audit history<br/>[AuditService.ts]"]
  node_server["API server<br/>[index.ts]"]
end

node_manager(("Manager / owner"))
node_tenant(("Tenant"))

node_manager -->|"uses"| node_web
node_tenant -->|"uses"| node_web
node_web -->|"presents login"| node_authui
node_authui -->|"submits credentials"| node_authapi
node_authapi -->|"delegates auth"| node_authservice
node_authservice -->|"reads and writes tokens"| node_database
node_web -->|"sends API requests"| node_server
node_server -->|"protects routes"| node_accesscontrol
node_properties -->|"reads and writes"| node_database
node_tenants -->|"reads and writes"| node_database
node_leases -->|"reads and writes"| node_database
node_reservations -->|"reads and writes"| node_database
node_inspections -->|"tenant-scoped queries"| node_database
node_inspections -->|"generates PDF"| node_documents
node_rentpayments -->|"reads and writes"| node_database
node_receipts -->|"accesses records"| node_database
node_finance -->|"reads and writes"| node_database
node_mobilemoney -->|"payment records"| node_database
node_dashboard -->|"reads metrics"| node_database
node_documents -->|"accesses records"| node_database
node_tasks -->|"accesses records"| node_database
node_notifications -->|"accesses records"| node_database
node_audit -->|"accesses records"| node_database

click node_web "https://github.com/warissecode/hopegestionv2/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/warissecode/hopegestionv2/blob/main/frontend/src/components/LoginForm.tsx"
click node_authapi "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/authRoutes.ts"
click node_authservice "https://github.com/warissecode/hopegestionv2/blob/main/backend/services/AuthService.ts"
click node_accesscontrol "https://github.com/warissecode/hopegestionv2/blob/main/backend/middleware/authMiddleware.ts"
click node_database "https://github.com/warissecode/hopegestionv2/blob/main/backend/db/database.ts"
click node_properties "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/bienRoutes.ts"
click node_tenants "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/locataireRoutes.ts"
click node_leases "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/leaseRoutes.ts"
click node_reservations "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/reservationRoutes.ts"
click node_inspections "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/edlRoutes.ts"
click node_rentpayments "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/rentPaymentRoutes.ts"
click node_receipts "https://github.com/warissecode/hopegestionv2/blob/main/backend/services/ReceiptService.ts"
click node_finance "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/financeRoutes.ts"
click node_mobilemoney "https://github.com/warissecode/hopegestionv2/blob/main/backend/services/mobileMoneyService.ts"
click node_dashboard "https://github.com/warissecode/hopegestionv2/blob/main/backend/services/DashboardService.ts"
click node_documents "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/documentRoutes.ts"
click node_tasks "https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/taskRoutes.ts"
click node_notifications "https://github.com/warissecode/hopegestionv2/blob/main/backend/services/notificationService.ts"
click node_audit "https://github.com/warissecode/hopegestionv2/blob/main/backend/services/AuditService.ts"
click node_server "https://github.com/warissecode/hopegestionv2/blob/main/backend/index.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_web,node_authui,node_authapi,node_authservice,node_accesscontrol,node_database toneBlue
class node_properties,node_tenants,node_leases,node_reservations,node_inspections toneAmber
class node_rentpayments,node_receipts,node_finance,node_mobilemoney toneMint
class node_dashboard,node_documents,node_tasks,node_notifications,node_audit,node_server toneRose
class node_manager,node_tenant toneIndigo
```

## Components

### Access and accounts

- [Web application](https://github.com/warissecode/hopegestionv2/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login and signup](https://github.com/warissecode/hopegestionv2/blob/main/frontend/src/components/LoginForm.tsx): `frontend/src/components/LoginForm.tsx`
- [Authentication API](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/authRoutes.ts): `backend/routes/authRoutes.ts`
- [Authentication service](https://github.com/warissecode/hopegestionv2/blob/main/backend/services/AuthService.ts): `backend/services/AuthService.ts`
- [Access middleware](https://github.com/warissecode/hopegestionv2/blob/main/backend/middleware/authMiddleware.ts): `backend/middleware/authMiddleware.ts`
- [PostgreSQL](https://github.com/warissecode/hopegestionv2/blob/main/backend/db/database.ts): `backend/db/database.ts`

### Property and tenancy

- [Properties and lots](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/bienRoutes.ts): `backend/routes/bienRoutes.ts`
- [Tenant records](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/locataireRoutes.ts): `backend/routes/locataireRoutes.ts`
- [Leases and rentals](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/leaseRoutes.ts): `backend/routes/leaseRoutes.ts`
- [Reservations](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/reservationRoutes.ts): `backend/routes/reservationRoutes.ts`
- [Move-in/out inspections](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/edlRoutes.ts): `backend/routes/edlRoutes.ts`

### Payments and finance

- [Rent payments](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/rentPaymentRoutes.ts): `backend/routes/rentPaymentRoutes.ts`
- [Receipts](https://github.com/warissecode/hopegestionv2/blob/main/backend/services/ReceiptService.ts): `backend/services/ReceiptService.ts`
- [Finance and expenses](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/financeRoutes.ts): `backend/routes/financeRoutes.ts`
- [Mobile money](https://github.com/warissecode/hopegestionv2/blob/main/backend/services/mobileMoneyService.ts): `backend/services/mobileMoneyService.ts`

### Operations and insight

- [Dashboard and reports](https://github.com/warissecode/hopegestionv2/blob/main/backend/services/DashboardService.ts): `backend/services/DashboardService.ts`
- [Documents and templates](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/documentRoutes.ts): `backend/routes/documentRoutes.ts`
- [Tasks and calendar](https://github.com/warissecode/hopegestionv2/blob/main/backend/routes/taskRoutes.ts): `backend/routes/taskRoutes.ts`
- [Alerts and notifications](https://github.com/warissecode/hopegestionv2/blob/main/backend/services/notificationService.ts): `backend/services/notificationService.ts`
- [Audit history](https://github.com/warissecode/hopegestionv2/blob/main/backend/services/AuditService.ts): `backend/services/AuditService.ts`
- [API server](https://github.com/warissecode/hopegestionv2/blob/main/backend/index.ts): `backend/index.ts`

### Other components

- **Manager / owner**
- **Tenant**

## Connections

- Manager / owner → Web application: uses
- Tenant → Web application: uses
- Web application → Login and signup: presents login
- Login and signup → Authentication API: submits credentials
- Authentication API → Authentication service: delegates auth
- Authentication service → PostgreSQL: reads and writes tokens
- Web application → API server: sends API requests
- API server → Access middleware: protects routes
- Properties and lots → PostgreSQL: reads and writes
- Tenant records → PostgreSQL: reads and writes
- Leases and rentals → PostgreSQL: reads and writes
- Reservations → PostgreSQL: reads and writes
- Move-in/out inspections → PostgreSQL: tenant-scoped queries
- Move-in/out inspections → Documents and templates: generates PDF
- Rent payments → PostgreSQL: reads and writes
- Receipts → PostgreSQL: accesses records
- Finance and expenses → PostgreSQL: reads and writes
- Mobile money → PostgreSQL: payment records
- Dashboard and reports → PostgreSQL: reads metrics
- Documents and templates → PostgreSQL: accesses records
- Tasks and calendar → PostgreSQL: accesses records
- Alerts and notifications → PostgreSQL: accesses records
- Audit history → PostgreSQL: accesses records
