# smitsavaliya-ctrl/pgproject architecture

> Architecture diagram of the GitHub repository smitsavaliya-ctrl/pgproject, 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/smitsavaliya-ctrl/pgproject
- Repository: https://github.com/smitsavaliya-ctrl/pgproject

## Overview

StayNest helps students and working professionals discover PGs and hostels: visitors search by city and locality, filter listings, inspect property details, and compare or save options. The frontend also exposes authentication, student/owner dashboards, and a standalone admin experience. The Django REST backend documents property discovery and recommendations alongside booking, inquiry, review, complaint, authentication, and admin-statistics endpoints. The README describes a SQLite-backed full-stack setup, but sampled source does not establish how the frontend API module connects to the backend; that wiring is therefore left out.

Main entry points: [`frontend/js/main.js`](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/main.js) (App router), [`frontend/js/appState.js`](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/appState.js) (Client state), [`frontend/js/pages/adminDashboard.js`](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/adminDashboard.js) (Admin dashboard), [`frontend/js/pages/city.js`](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/city.js) (City results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Discovery frontend"]
  node_main["App router<br/>[main.js]"]
  node_home["Home discovery<br/>[home.js]"]
  node_searchbar["Search filters<br/>[searchBar.js]"]
  node_city["City results<br/>[city.js]"]
  node_details["Property details<br/>[details.js]"]
  node_compare["Compare stays<br/>[compare.js]"]
  node_wishlist["Saved stays<br/>[wishlist.js]"]
  node_map["India map<br/>[IndiaMap.js]"]
  node_catalog["Property catalog<br/>[dataset.js]"]
  node_state["Client state<br/>[appState.js]"]
end

subgraph group_accounts["Accounts and management"]
  node_auth["Login and registration<br/>[auth.js]"]
  node_student["Student dashboard"]
  node_owner["Owner dashboard<br/>[ownerDashboard.js]"]
  node_admin["Admin dashboard<br/>[adminDashboard.js]"]
  node_adminlist["Listing management"]
  node_adminlocations["Location management"]
  node_adminmedia["Media management<br/>[adminMediaView.js]"]
end

subgraph group_backend["REST backend"]
  node_django["Django API views<br/>[views.py]"]
  node_serializers["API serializers<br/>[serializers.py]"]
  node_models["Domain models<br/>[models.py]"]
  node_mongoapi["Mongo listings API<br/>[server.js]"]
  node_booking["Booking records<br/>[models.py]"]
  node_inquiries["Inquiry and feedback<br/>[models.py]"]
end

subgraph group_storage["Persistence"]
  node_sqlite[("SQLite database<br/>[settings.py]")]
  node_mongodb[("MongoDB Atlas")]
end

node_visitor(("Student or renter"))

node_visitor -->|"opens app"| node_main
node_main -->|"routes to"| node_home
node_main -->|"routes to"| node_city
node_main -->|"routes to"| node_details
node_main -->|"routes to"| node_compare
node_main -->|"routes to"| node_auth
node_main -->|"routes to"| node_student
node_main -->|"routes to"| node_owner
node_main -->|"routes to"| node_admin
node_home -->|"renders"| node_searchbar
node_searchbar -->|"updates query"| node_state
node_city -->|"displays listings"| node_catalog
node_city -->|"reads query"| node_state
node_details -->|"reads selection"| node_state
node_compare -->|"reads saved choices"| node_state
node_wishlist -->|"reads wishlist"| node_state
node_map -->|"supports discovery"| node_city
node_state -->|"loads catalog"| node_catalog
node_admin -->|"renders listings"| node_adminlist
node_admin -->|"renders locations"| node_adminlocations
node_admin -->|"renders media"| node_adminmedia
node_adminlist -->|"normalizes listings"| node_state
node_django -->|"queries and updates"| node_models
node_django -->|"serializes responses"| node_serializers
node_models -->|"persists records"| node_sqlite
node_mongoapi -->|"reads listings"| node_mongodb
node_booking -->|"defined in"| node_models
node_inquiries -->|"defined in"| node_models

click node_main "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/main.js"
click node_home "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/home.js"
click node_searchbar "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/components/searchBar.js"
click node_city "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/city.js"
click node_details "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/details.js"
click node_compare "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/compare.js"
click node_wishlist "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/wishlist.js"
click node_map "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/components/IndiaMap.js"
click node_catalog "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/dataset.js"
click node_state "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/appState.js"
click node_auth "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/auth.js"
click node_student "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/studentDashboard.js"
click node_owner "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/ownerDashboard.js"
click node_admin "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/adminDashboard.js"
click node_adminlist "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/admin/views/adminListingsView.js"
click node_adminlocations "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/admin/views/adminLocationsView.js"
click node_adminmedia "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/admin/views/adminMediaView.js"
click node_django "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/views.py"
click node_serializers "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/serializers.py"
click node_models "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/models.py"
click node_sqlite "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/staynest_backend/settings.py"
click node_mongoapi "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/server.js"
click node_booking "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/models.py"
click node_inquiries "https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/models.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_main,node_home,node_searchbar,node_city,node_details,node_compare,node_wishlist,node_map,node_catalog,node_state toneBlue
class node_auth,node_student,node_owner,node_admin,node_adminlist,node_adminlocations,node_adminmedia toneAmber
class node_django,node_serializers,node_models,node_mongoapi,node_booking,node_inquiries toneMint
class node_sqlite,node_mongodb toneRose
class node_visitor toneIndigo
```

## Components

### Discovery frontend

- [App router](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/main.js): `frontend/js/main.js`
- [Home discovery](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/home.js): `frontend/js/pages/home.js`
- [Search filters](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/components/searchBar.js): `frontend/js/components/searchBar.js`
- [City results](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/city.js): `frontend/js/pages/city.js`
- [Property details](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/details.js): `frontend/js/pages/details.js`
- [Compare stays](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/compare.js): `frontend/js/pages/compare.js`
- [Saved stays](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/wishlist.js): `frontend/js/pages/wishlist.js`
- [India map](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/components/IndiaMap.js): `frontend/js/components/IndiaMap.js`
- [Property catalog](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/dataset.js): `frontend/js/dataset.js`
- [Client state](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/appState.js): `frontend/js/appState.js`

### Accounts and management

- [Login and registration](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/auth.js): `frontend/js/pages/auth.js`
- [Student dashboard](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/studentDashboard.js): `frontend/js/pages/studentDashboard.js`
- [Owner dashboard](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/ownerDashboard.js): `frontend/js/pages/ownerDashboard.js`
- [Admin dashboard](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/pages/adminDashboard.js): `frontend/js/pages/adminDashboard.js`
- [Listing management](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/admin/views/adminListingsView.js): `frontend/js/admin/views/adminListingsView.js`
- [Location management](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/admin/views/adminLocationsView.js): `frontend/js/admin/views/adminLocationsView.js`
- [Media management](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/frontend/js/admin/views/adminMediaView.js): `frontend/js/admin/views/adminMediaView.js`

### REST backend

- [Django API views](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/views.py): `backend/api/views.py`
- [API serializers](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/serializers.py): `backend/api/serializers.py`
- [Domain models](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/models.py): `backend/api/models.py`
- [Mongo listings API](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/server.js): `backend/server.js`
- [Booking records](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/models.py): `backend/api/models.py`
- [Inquiry and feedback](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/api/models.py): `backend/api/models.py`

### Persistence

- [SQLite database](https://github.com/smitsavaliya-ctrl/pgproject/blob/master/backend/staynest_backend/settings.py): `backend/staynest_backend/settings.py`
- **MongoDB Atlas**

### Other components

- **Student or renter**

## Connections

- Student or renter → App router: opens app
- App router → Home discovery: routes to
- App router → City results: routes to
- App router → Property details: routes to
- App router → Compare stays: routes to
- App router → Login and registration: routes to
- App router → Student dashboard: routes to
- App router → Owner dashboard: routes to
- App router → Admin dashboard: routes to
- Home discovery → Search filters: renders
- Search filters → Client state: updates query
- City results → Property catalog: displays listings
- City results → Client state: reads query
- Property details → Client state: reads selection
- Compare stays → Client state: reads saved choices
- Saved stays → Client state: reads wishlist
- India map → City results: supports discovery
- Client state → Property catalog: loads catalog
- Admin dashboard → Listing management: renders listings
- Admin dashboard → Location management: renders locations
- Admin dashboard → Media management: renders media
- Listing management → Client state: normalizes listings
- Django API views → Domain models: queries and updates
- Django API views → API serializers: serializes responses
- Domain models → SQLite database: persists records
- Mongo listings API → MongoDB Atlas: reads listings
- Booking records → Domain models: defined in
- Inquiry and feedback → Domain models: defined in
