# prasanth-634/rent-hub architecture

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

- Interactive diagram: https://gitdiagram.com/prasanth-634/rent-hub
- Repository: https://github.com/prasanth-634/rent-hub

## Overview

Rent Verification is a role-based rental verification product: landlords manage properties, tenants, leases and uploaded rental transactions; the backend supports verification and AI-assisted rent/anomaly analysis, with lender and admin portals, reports, billing and API access. The frontend routes users into role-specific workflows and maintains authentication through the REST API. Backend routes share SQLAlchemy-backed domain data. Several portal and domain capabilities are documented by the file tree and route registration, but their internal calls were not sampled; those relationships are omitted rather than inferred.

Main entry points: [`backend/app/main.py`](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/main.py) (FastAPI entry), [`backend/app/core/database.py`](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/core/database.py) (SQLAlchemy data), [`backend/app/api/admin.py`](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/admin.py) (Admin operations), [`backend/app/api/landlord_portal.py`](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/landlord_portal.py) (Landlord portal API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app["Role routing<br/>[App.tsx]"]
  node_authctx["Session auth<br/>[AuthContext.tsx]"]
  node_api_client["API URL client<br/>[api.ts]"]
  node_role_pages["Role workflows"]
  node_verify_detail["Verification detail"]
end

subgraph group_api["API and access"]
  node_backend["FastAPI entry<br/>[main.py]"]
  node_auth_api["Authentication<br/>[auth.py]"]
  node_access["Identity and roles<br/>[deps.py]"]
  node_admin_api["Admin operations<br/>[admin.py]"]
  node_landlord_api["Landlord portal API<br/>[landlord_portal.py]"]
  node_other_routes["Domain API routes"]
  node_tenant_lender["Tenant and lender<br/>[tenant_portal.py]"]
  node_ai_routes["AI analysis API<br/>[ai.py]"]
end

subgraph group_domain["Rental services"]
  node_verification["Verification service<br/>[verification.py]"]
  node_billing["Billing service<br/>[billing.py]"]
  node_reports["PDF reports<br/>[report_pdf.py]"]
  node_notifications["Notifications<br/>[notification.py]"]
end

subgraph group_platform["Data and AI"]
  node_db[("SQLAlchemy data<br/>[database.py]")]
  node_models["Domain records<br/>[models.py]"]
  node_security["JWT and keys<br/>[security.py]"]
  node_ml_engine["ML orchestration<br/>[engine.py]"]
  node_classifier["Rent classification<br/>[rent_classifier.py]"]
  node_anomaly["Anomaly detection"]
  node_features["Feature engineering"]
  node_model_loader["Model loading<br/>[model_loader.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
  node_db_init["Database initialization<br/>[init_db.py]"]
end

node_user(("Portal user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_role_pages
node_app -->|"uses session"| node_authctx
node_authctx -->|"gets API URL"| node_api_client
node_authctx -->|"requests auth"| node_auth_api
node_role_pages -->|"routes to"| node_verify_detail
node_backend -->|"registers"| node_auth_api
node_backend -->|"registers"| node_landlord_api
node_backend -->|"registers"| node_tenant_lender
node_backend -->|"registers"| node_other_routes
node_backend -->|"registers"| node_admin_api
node_backend -->|"registers"| node_ai_routes
node_backend -->|"initializes on startup"| node_db_init
node_backend -->|"opens startup session"| node_db
node_auth_api -->|"queries via"| node_db
node_auth_api -->|"uses tokens"| node_security
node_admin_api -->|"uses sessions"| node_db
node_admin_api -->|"uses"| node_verification
node_admin_api -->|"uses"| node_model_loader
node_landlord_api -->|"uses sessions"| node_db
node_landlord_api -->|"uses"| node_billing
node_landlord_api -->|"uses"| node_verification
node_access -->|"gets sessions"| node_db
node_access -->|"validates tokens"| node_security
node_db -->|"reads connection config"| node_settings
node_models -->|"uses declarative base"| node_db
node_db_init -->|"uses database"| node_db
node_db_init -->|"initializes records"| node_models
node_security -->|"reads JWT config"| node_settings
node_ai_routes -->|"uses"| node_ml_engine
node_ml_engine -->|"classifies rent"| node_classifier
node_ml_engine -->|"detects anomalies"| node_anomaly
node_ml_engine -->|"uses versions"| node_model_loader
node_anomaly -->|"uses features"| node_features
node_anomaly -->|"uses model"| node_model_loader

click node_app "https://github.com/prasanth-634/rent-hub/blob/main/frontend/src/App.tsx"
click node_authctx "https://github.com/prasanth-634/rent-hub/blob/main/frontend/src/context/AuthContext.tsx"
click node_api_client "https://github.com/prasanth-634/rent-hub/blob/main/frontend/src/services/api.ts"
click node_role_pages "https://github.com/prasanth-634/rent-hub/tree/main/frontend/src/pages"
click node_verify_detail "https://github.com/prasanth-634/rent-hub/blob/main/frontend/src/pages/LandlordVerificationDetail.tsx"
click node_backend "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/main.py"
click node_auth_api "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/auth.py"
click node_access "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/deps.py"
click node_admin_api "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/admin.py"
click node_landlord_api "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/landlord_portal.py"
click node_other_routes "https://github.com/prasanth-634/rent-hub/tree/main/backend/app/api"
click node_tenant_lender "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/tenant_portal.py"
click node_verification "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/verification.py"
click node_billing "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/billing.py"
click node_reports "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/report_pdf.py"
click node_notifications "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/notification.py"
click node_db "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/core/database.py"
click node_models "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/db/models.py"
click node_security "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/core/security.py"
click node_ml_engine "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/ml/engine.py"
click node_ai_routes "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/ai.py"
click node_classifier "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/ai/rent_classifier.py"
click node_anomaly "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/ai/anomaly_detector.py"
click node_features "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/ai/feature_engineering.py"
click node_model_loader "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/ai/model_loader.py"
click node_settings "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/core/config.py"
click node_db_init "https://github.com/prasanth-634/rent-hub/blob/main/backend/app/db/init_db.py"

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_authctx,node_api_client,node_role_pages,node_verify_detail,node_user toneBlue
class node_backend,node_auth_api,node_access,node_admin_api,node_landlord_api,node_other_routes,node_tenant_lender,node_ai_routes toneAmber
class node_verification,node_billing,node_reports,node_notifications toneMint
class node_db,node_models,node_security,node_ml_engine,node_classifier,node_anomaly,node_features,node_model_loader,node_settings,node_db_init toneRose
```

## Components

### Frontend

- [Role routing](https://github.com/prasanth-634/rent-hub/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Session auth](https://github.com/prasanth-634/rent-hub/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [API URL client](https://github.com/prasanth-634/rent-hub/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Role workflows](https://github.com/prasanth-634/rent-hub/tree/main/frontend/src/pages): `frontend/src/pages`
- [Verification detail](https://github.com/prasanth-634/rent-hub/blob/main/frontend/src/pages/LandlordVerificationDetail.tsx): `frontend/src/pages/LandlordVerificationDetail.tsx`

### API and access

- [FastAPI entry](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Identity and roles](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`
- [Admin operations](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/admin.py): `backend/app/api/admin.py`
- [Landlord portal API](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/landlord_portal.py): `backend/app/api/landlord_portal.py`
- [Domain API routes](https://github.com/prasanth-634/rent-hub/tree/main/backend/app/api): `backend/app/api`
- [Tenant and lender](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/tenant_portal.py): `backend/app/api/tenant_portal.py`
- [AI analysis API](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/api/ai.py): `backend/app/api/ai.py`

### Rental services

- [Verification service](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/verification.py): `backend/app/services/verification.py`
- [Billing service](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/billing.py): `backend/app/services/billing.py`
- [PDF reports](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/report_pdf.py): `backend/app/services/report_pdf.py`
- [Notifications](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/notification.py): `backend/app/services/notification.py`

### Data and AI

- [SQLAlchemy data](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Domain records](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/db/models.py): `backend/app/db/models.py`
- [JWT and keys](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [ML orchestration](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/ml/engine.py): `backend/app/ml/engine.py`
- [Rent classification](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/ai/rent_classifier.py): `backend/app/services/ai/rent_classifier.py`
- [Anomaly detection](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/ai/anomaly_detector.py): `backend/app/services/ai/anomaly_detector.py`
- [Feature engineering](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/ai/feature_engineering.py): `backend/app/services/ai/feature_engineering.py`
- [Model loading](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/services/ai/model_loader.py): `backend/app/services/ai/model_loader.py`
- [Runtime settings](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [Database initialization](https://github.com/prasanth-634/rent-hub/blob/main/backend/app/db/init_db.py): `backend/app/db/init_db.py`

### Other components

- **Portal user**

## Connections

- Portal user → Role routing: uses (evidence: `frontend/src/App.tsx`)
- Role routing → Role workflows: routes to (evidence: `frontend/src/App.tsx`)
- Role routing → Session auth: uses session (evidence: `frontend/src/App.tsx`)
- Session auth → API URL client: gets API URL (evidence: `frontend/src/context/AuthContext.tsx`)
- Session auth → Authentication: requests auth (evidence: `frontend/src/context/AuthContext.tsx`)
- Role workflows → Verification detail: routes to (evidence: `frontend/src/App.tsx`)
- FastAPI entry → Authentication: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Landlord portal API: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Tenant and lender: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Domain API routes: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Admin operations: registers (evidence: `backend/app/main.py`)
- FastAPI entry → AI analysis API: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Database initialization: initializes on startup (evidence: `backend/app/main.py`)
- FastAPI entry → SQLAlchemy data: opens startup session (evidence: `backend/app/main.py`)
- Authentication → SQLAlchemy data: queries via (evidence: `backend/app/api/auth.py`)
- Authentication → JWT and keys: uses tokens (evidence: `backend/app/api/auth.py`)
- Admin operations → SQLAlchemy data: uses sessions (evidence: `backend/app/api/admin.py`)
- Admin operations → Verification service: uses (evidence: `backend/app/api/admin.py`)
- Admin operations → Model loading: uses (evidence: `backend/app/api/admin.py`)
- Landlord portal API → SQLAlchemy data: uses sessions (evidence: `backend/app/api/landlord_portal.py`)
- Landlord portal API → Billing service: uses (evidence: `backend/app/api/landlord_portal.py`)
- Landlord portal API → Verification service: uses (evidence: `backend/app/api/landlord_portal.py`)
- Identity and roles → SQLAlchemy data: gets sessions (evidence: `backend/app/api/deps.py`)
- Identity and roles → JWT and keys: validates tokens (evidence: `backend/app/api/deps.py`)
- SQLAlchemy data → Runtime settings: reads connection config (evidence: `backend/app/core/database.py`)
- Domain records → SQLAlchemy data: uses declarative base (evidence: `backend/app/db/models.py`)
- Database initialization → SQLAlchemy data: uses database (evidence: `backend/app/db/init_db.py`)
- Database initialization → Domain records: initializes records (evidence: `backend/app/db/init_db.py`)
- JWT and keys → Runtime settings: reads JWT config (evidence: `backend/app/core/security.py`)
- AI analysis API → ML orchestration: uses (evidence: `backend/app/api/ai.py`)
- ML orchestration → Rent classification: classifies rent (evidence: `backend/app/ml/engine.py`)
- ML orchestration → Anomaly detection: detects anomalies (evidence: `backend/app/ml/engine.py`)
- ML orchestration → Model loading: uses versions (evidence: `backend/app/ml/engine.py`)
- Anomaly detection → Feature engineering: uses features (evidence: `backend/app/services/ai/anomaly_detector.py`)
- Anomaly detection → Model loading: uses model (evidence: `backend/app/services/ai/anomaly_detector.py`)
