# sohan1saha/hosteliq architecture

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

- Interactive diagram: https://gitdiagram.com/sohan1saha/hosteliq
- Repository: https://github.com/sohan1saha/hosteliq

## Overview

HostelIQ is a FastAPI hostel resource-monitoring and grievance-analytics application. Its main user-to-result paths are logging water/electricity usage and querying SQL analytics, or submitting and retrieving complaints backed by MongoDB (with an in-memory fallback). The graph also shows student/room registration, the dashboard, validation models, and database configuration. README capabilities include complaint timelines, maintenance assignments, and feedback; the shown implementation seeds and stores those document fields, but does not expose update workflows in the sampled routes.

Main entry points: [`app/main.py`](https://github.com/sohan1saha/hosteliq/blob/main/app/main.py) (FastAPI application), [`app/database/sql_manager.py`](https://github.com/sohan1saha/hosteliq/blob/main/app/database/sql_manager.py) (SQL operations), [`app/routers/resources.py`](https://github.com/sohan1saha/hosteliq/blob/main/app/routers/resources.py) (Resource endpoints), [`app/database/nosql_manager.py`](https://github.com/sohan1saha/hosteliq/blob/main/app/database/nosql_manager.py) (Complaint operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["FastAPI application<br/>[main.py]"]
  node_dashboard["HTML dashboard<br/>[index.html]"]
end

subgraph group_api["API workflows"]
  node_resources["Resource endpoints<br/>[resources.py]"]
  node_complaints["Complaint endpoints<br/>[complaints.py]"]
  node_analytics["Analytics endpoints<br/>[analytics.py]"]
end

subgraph group_domain["Request models"]
  node_student_model["Student validation<br/>[student.py]"]
  node_resource_model["Usage validation<br/>[resource.py]"]
  node_complaint_model["Complaint validation<br/>[complaint.py]"]
end

subgraph group_data["Data and analytics"]
  node_config["Application settings<br/>[config.py]"]
  node_sql_manager["SQL operations<br/>[sql_manager.py]"]
  node_schema["Relational schema<br/>[schema.sql]"]
  node_sql_store[("SQL database")]
  node_nosql_manager["Complaint operations<br/>[nosql_manager.py]"]
  node_mongo_store[("MongoDB complaints")]
end

node_client(("Hostel user"))

node_client -->|"sends requests"| node_app
node_app -->|"renders dashboard"| node_dashboard
node_app -->|"registers router"| node_resources
node_app -->|"registers router"| node_complaints
node_app -->|"registers router"| node_analytics
node_resources -->|"validates payload"| node_student_model
node_resources -->|"validates payload"| node_resource_model
node_resources -->|"writes records"| node_sql_manager
node_complaints -->|"validates payload"| node_complaint_model
node_complaints -->|"creates and reads"| node_nosql_manager
node_analytics -->|"runs SQL queries"| node_sql_manager
node_analytics -->|"runs aggregation"| node_nosql_manager
node_sql_manager -->|"loads settings"| node_config
node_nosql_manager -->|"loads settings"| node_config
node_sql_manager -->|"loads schema"| node_schema
node_sql_manager -->|"queries and writes"| node_sql_store
node_nosql_manager -->|"stores documents"| node_mongo_store

click node_app "https://github.com/sohan1saha/hosteliq/blob/main/app/main.py"
click node_dashboard "https://github.com/sohan1saha/hosteliq/blob/main/app/templates/index.html"
click node_resources "https://github.com/sohan1saha/hosteliq/blob/main/app/routers/resources.py"
click node_complaints "https://github.com/sohan1saha/hosteliq/blob/main/app/routers/complaints.py"
click node_analytics "https://github.com/sohan1saha/hosteliq/blob/main/app/routers/analytics.py"
click node_student_model "https://github.com/sohan1saha/hosteliq/blob/main/app/models/student.py"
click node_resource_model "https://github.com/sohan1saha/hosteliq/blob/main/app/models/resource.py"
click node_complaint_model "https://github.com/sohan1saha/hosteliq/blob/main/app/models/complaint.py"
click node_config "https://github.com/sohan1saha/hosteliq/blob/main/app/config.py"
click node_sql_manager "https://github.com/sohan1saha/hosteliq/blob/main/app/database/sql_manager.py"
click node_schema "https://github.com/sohan1saha/hosteliq/blob/main/database_scripts/schema.sql"
click node_nosql_manager "https://github.com/sohan1saha/hosteliq/blob/main/app/database/nosql_manager.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_dashboard,node_client toneBlue
class node_resources,node_complaints,node_analytics toneAmber
class node_student_model,node_resource_model,node_complaint_model toneMint
class node_config,node_sql_manager,node_schema,node_sql_store,node_nosql_manager,node_mongo_store toneRose
```

## Components

### User interface

- [FastAPI application](https://github.com/sohan1saha/hosteliq/blob/main/app/main.py): `app/main.py`
- [HTML dashboard](https://github.com/sohan1saha/hosteliq/blob/main/app/templates/index.html): `app/templates/index.html`

### API workflows

- [Resource endpoints](https://github.com/sohan1saha/hosteliq/blob/main/app/routers/resources.py): `app/routers/resources.py`
- [Complaint endpoints](https://github.com/sohan1saha/hosteliq/blob/main/app/routers/complaints.py): `app/routers/complaints.py`
- [Analytics endpoints](https://github.com/sohan1saha/hosteliq/blob/main/app/routers/analytics.py): `app/routers/analytics.py`

### Request models

- [Student validation](https://github.com/sohan1saha/hosteliq/blob/main/app/models/student.py): `app/models/student.py`
- [Usage validation](https://github.com/sohan1saha/hosteliq/blob/main/app/models/resource.py): `app/models/resource.py`
- [Complaint validation](https://github.com/sohan1saha/hosteliq/blob/main/app/models/complaint.py): `app/models/complaint.py`

### Data and analytics

- [Application settings](https://github.com/sohan1saha/hosteliq/blob/main/app/config.py): `app/config.py`
- [SQL operations](https://github.com/sohan1saha/hosteliq/blob/main/app/database/sql_manager.py): `app/database/sql_manager.py`
- [Relational schema](https://github.com/sohan1saha/hosteliq/blob/main/database_scripts/schema.sql): `database_scripts/schema.sql`
- **SQL database**
- [Complaint operations](https://github.com/sohan1saha/hosteliq/blob/main/app/database/nosql_manager.py): `app/database/nosql_manager.py`
- **MongoDB complaints**

### Other components

- **Hostel user**

## Connections

- Hostel user → FastAPI application: sends requests (evidence: `README.md`)
- FastAPI application → HTML dashboard: renders dashboard (evidence: `app/main.py`)
- FastAPI application → Resource endpoints: registers router (evidence: `app/main.py`)
- FastAPI application → Complaint endpoints: registers router (evidence: `app/main.py`)
- FastAPI application → Analytics endpoints: registers router (evidence: `app/main.py`)
- Resource endpoints → Student validation: validates payload (evidence: `app/routers/resources.py`)
- Resource endpoints → Usage validation: validates payload (evidence: `app/routers/resources.py`)
- Resource endpoints → SQL operations: writes records (evidence: `app/routers/resources.py`)
- Complaint endpoints → Complaint validation: validates payload (evidence: `app/routers/complaints.py`)
- Complaint endpoints → Complaint operations: creates and reads (evidence: `app/routers/complaints.py`)
- Analytics endpoints → SQL operations: runs SQL queries (evidence: `app/routers/analytics.py`)
- Analytics endpoints → Complaint operations: runs aggregation (evidence: `app/routers/analytics.py`)
- SQL operations → Application settings: loads settings (evidence: `app/database/sql_manager.py`)
- Complaint operations → Application settings: loads settings (evidence: `app/database/nosql_manager.py`)
- SQL operations → Relational schema: loads schema (evidence: `app/database/sql_manager.py`)
- SQL operations → SQL database: queries and writes (evidence: `app/database/sql_manager.py`)
- Complaint operations → MongoDB complaints: stores documents (evidence: `app/database/nosql_manager.py`)
