Full-stack hostel management: React (Vite) frontend + Node (Express) + MongoDB backend.
- Node.js 18+
- MongoDB Atlas (connection string is configured by default)
Frontend – optional. Create frontend/.env to override API URL:
VITE_API_URL=http://localhost:5001/api
The frontend proxies /api to http://localhost:5001. If only the frontend is running, you may see http proxy error / ECONNREFUSED until the backend is up.
From the project root (ITPM-Project-HostelManagement):
npm install
npm run devStarts the API on 5001 and Vite on 3000.
1. Backend
cd backend
npm install
npm run seed # creates admin@unihostel.com / admin123 and student@unihostel.com / student123
npm run dev # or npm startServer: http://localhost:5001.
2. Frontend
cd frontend
npm install
npm run dev # or npm startApp: http://localhost:3000 (see frontend/vite.config.js).
| Role | Password | |
|---|---|---|
| Admin | admin@unihostel.com | admin123 |
| Student | student@unihostel.com | student123 |
Students can also sign up at /signup; no seed needed for new accounts.
Wardens use /warden/login (Sign in / Register tabs) and land on /warden after success.
| Path | Auth | Description |
|---|---|---|
| POST /api/auth/student-signup | No | Student registration |
| POST /api/auth/student-login | No | Student login |
| POST /api/auth/admin-login | No | Admin login |
| POST /api/auth/warden-signup | No | Warden registration |
| POST /api/auth/warden-login | No | Warden login |
| /api/users | Admin | CRUD users |
| /api/hostels | Yes | List/create hostels |
| /api/bookings | Yes | Bookings |
| /api/payments | Yes | Payments |
| /api/inquiry | Yes | Inquiries (POST /, GET /my student; GET /, PUT /:id/reply admin) |
| /api/latepass | Yes | Late passes |
| /api/complains | Yes | Complaints |
| /api/inventory | Admin | Inventory |
| /api/maintenance | Yes | Maintenance |
Send JWT in header: Authorization: Bearer <token>.