How rohanpudari/smarthostel works
SmartHostel is a hostel-operations platform: students authenticate, view meals and mark attendance, check facility availability and book or cancel slots, and submit complaints; staff/admins manage complaints and inventory. The React pages call a JWT-enabled API client, while FastAPI routes requests into domain handlers and PostgreSQL or MongoDB-backed data. Facility capacity and inventory stock are important correctness concerns documented in the README. The graph retains the documented feature branches; unsampled route internals are represented only where the index or README supports the relationship.
Main entry points: main.py FastAPI application · App.jsx App routing · auth.py Auth endpoints · client.js JWT API client
Components 24
React frontend
- App routing
frontend/src/App.jsx - Auth state
frontend/src/context/AuthContext.jsx - JWT API client
frontend/src/api/client.js - Meal attendance
frontend/src/pages/Meals.jsx - Facility bookings
frontend/src/pages/Facilities.jsx - Complaints UI
frontend/src/pages/Complaints.jsx - Inventory UI
frontend/src/pages/Inventory.jsx
FastAPI API
- Request schemas
backend/app/schemas - FastAPI application
backend/app/main.py
Identity and access
- Auth endpoints
backend/app/routers/auth.py - JWT authorization
backend/app/auth/dependencies.py - Token handling
backend/app/auth/jwt.py - Password security
backend/app/auth/security.py
Operations domains
- Meal attendance API
backend/app/routers/meals.py - Facility availability
backend/app/routers/facilities.py - Booking API
backend/app/routers/bookings.py - Complaint API
backend/app/routers/complaints.py - Inventory API
backend/app/routers/inventory.py
Persistence
- Relational models
backend/app/models - SQLAlchemy session
backend/app/database.py - PostgreSQL
- MongoDB connection
backend/app/mongo.py - MongoDB
Other components
- Students and staff
Connections 40
- Students and staff → App routing: use app
README.md - App routing → Auth state: provides auth
frontend/src/main.jsx - App routing → Meal attendance: routes to
frontend/src/App.jsx - App routing → Facility bookings: routes to
frontend/src/App.jsx - App routing → Complaints UI: routes to
frontend/src/App.jsx - App routing → Inventory UI: routes to
frontend/src/App.jsx - Auth state → JWT API client: calls API
frontend/src/context/AuthContext.jsx - Meal attendance → JWT API client: calls API
frontend/src/pages/Meals.jsx - Facility bookings → JWT API client: calls API
frontend/src/pages/Facilities.jsx - Complaints UI → JWT API client: calls API
frontend/src/pages/Complaints.jsx - Inventory UI → JWT API client: calls API
frontend/src/pages/Inventory.jsx - JWT API client → FastAPI application: sends REST requests
README.md - FastAPI application → Auth endpoints: registers routes
backend/app/main.py - FastAPI application → Meal attendance API: registers routes
backend/app/main.py - FastAPI application → Facility availability: registers routes
backend/app/main.py - FastAPI application → Booking API: registers routes
backend/app/main.py - FastAPI application → Complaint API: registers routes
backend/app/main.py - FastAPI application → Inventory API: registers routes
backend/app/main.py - Auth endpoints → Password security: hashes passwords
backend/app/routers/auth.py - Auth endpoints → Token handling: issues tokens
backend/app/routers/auth.py - JWT authorization → Token handling: decodes tokens
backend/app/auth/dependencies.py - Auth endpoints → JWT authorization: checks identity
backend/app/routers/auth.py - Meal attendance API → Relational models: reads and writes
backend/app/routers/meals.py - Facility availability → Relational models: reads and writes
backend/app/routers/facilities.py - Booking API → Relational models: creates bookings
backend/app/routers/bookings.py - Inventory API → Relational models: updates stock
backend/app/routers/inventory.py - Complaint API → MongoDB: stores complaints
README.md - FastAPI application → MongoDB connection: provides connection
backend/app/main.py - MongoDB connection → MongoDB: connects to
README.md - Auth endpoints → SQLAlchemy session: uses session
backend/app/routers/auth.py - Meal attendance API → SQLAlchemy session: uses session
backend/app/routers/meals.py - Facility availability → SQLAlchemy session: uses session
backend/app/routers/facilities.py - Booking API → SQLAlchemy session: uses session
backend/app/routers/bookings.py - Inventory API → SQLAlchemy session: uses session
backend/app/routers/inventory.py - SQLAlchemy session → PostgreSQL: persists relational data
README.md - Auth endpoints → Request schemas: validates payloads
backend/app/routers/auth.py - Meal attendance API → Request schemas: uses schemas
backend/app/routers/meals.py - Facility availability → Request schemas: uses schemas
backend/app/routers/facilities.py - Booking API → Request schemas: uses schemas
backend/app/routers/bookings.py - Inventory API → Request schemas: uses schemas
backend/app/routers/inventory.py