Skip to content

Sudhanshu-SRS/smart-hostel-management-system

Repository files navigation

🏨 Smart Hostel Management System (SHMS)

A comprehensive web application for managing hostel operations, built with the MERN stack.

SHMS Banner

✨ Features

πŸŽ“ Student Features

  • User Registration & Authentication - Multi-step registration with email verification
  • Room Management - Browse, book, and manage room allocations
  • Payment Integration - Secure online payments via Razorpay
  • Complaint System - Submit and track maintenance requests
  • Visitor Management - Register and manage visitor entries
  • Real-time Notifications - Get instant updates via Socket.io

πŸ‘¨β€πŸ’Ό Admin Features

  • Comprehensive Dashboard - Real-time analytics and insights
  • User Management - Manage students, wardens, and admin accounts
  • Room Administration - Create, update, and monitor room availability
  • Payment Tracking - Monitor all transactions and pending payments
  • Complaint Resolution - Assign, track, and resolve maintenance issues
  • Visitor Oversight - Approve/reject visitor requests
  • Email Notifications - Automated welcome emails and updates

πŸ›‘οΈ Security Features

  • JWT Authentication - Secure token-based authentication
  • Role-based Access Control - Admin, Warden, and Student roles
  • Password Hashing - Bcrypt encryption for passwords
  • Input Validation - Comprehensive form validation
  • File Upload Security - Secure image uploads via Cloudinary

πŸš€ Tech Stack

Frontend

  • React 18 - Modern React with hooks
  • Material-UI (MUI) - Professional UI components
  • Framer Motion - Smooth animations
  • Axios - HTTP client for API calls
  • React Router - Client-side routing
  • Socket.io Client - Real-time communication

Backend

  • Node.js - JavaScript runtime
  • Express.js - Web framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling
  • Socket.io - Real-time communication
  • JWT - JSON Web Tokens for authentication
  • Nodemailer - Email sending
  • Multer - File upload handling
  • Cloudinary - Image storage and management

Admin Panel

  • React Admin Panel - Separate admin interface
  • Advanced Analytics - Dashboard with charts and statistics
  • Hardcoded Admin Access - Secure admin authentication

πŸ“ Project Structure

smart-hostel-management/
β”œβ”€β”€ frontend/                 # React frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ context/        # React context providers
β”‚   β”‚   β”œβ”€β”€ services/       # API services
β”‚   β”‚   └── utils/          # Utility functions
β”‚   └── package.json
β”œβ”€β”€ backend/                 # Node.js backend API
β”‚   β”œβ”€β”€ routes/             # API routes
β”‚   β”œβ”€β”€ models/             # Database models
β”‚   β”œβ”€β”€ middleware/         # Custom middleware
β”‚   β”œβ”€β”€ services/           # Business logic services
β”‚   β”œβ”€β”€ config/             # Configuration files
β”‚   └── package.json
β”œβ”€β”€ admin/                  # Admin panel application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # Admin components
β”‚   β”‚   β”œβ”€β”€ pages/          # Admin pages
β”‚   β”‚   └── services/       # Admin API services
β”‚   └── package.json
└── README.md

πŸ› οΈ Installation & Setup

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (local or cloud)
  • Git

1. Clone the Repository

git clone https://github.com/yourusername/smart-hostel-management.git
cd smart-hostel-management

2. Backend Setup

cd backend
npm install
cp .env.example .env
# Edit .env with your configuration
npm run dev

3. Frontend Setup

cd frontend
npm install
npm run dev

4. Admin Panel Setup

cd admin
npm install
npm run dev

βš™οΈ Environment Configuration

Backend Environment Variables

Create a .env file in the backend directory:

NODE_ENV=development
PORT=5000
MONGODB_URI=mongodb://localhost:27017/shms
JWT_SECRET=your_jwt_secret_key
CLIENT_URL=http://localhost:3000
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret
RAZORPAY_KEY_ID=your_razorpay_key
RAZORPAY_KEY_SECRET=your_razorpay_secret
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
EMAIL_FROM=noreply@smarthostel.com

πŸš€ Usage

Default Admin Credentials

Default Warden Credentials

Student Registration

Students can register through the frontend application with:

  • Personal information
  • Emergency contact details
  • Address information
  • Profile picture upload

πŸ“Š API Documentation

Authentication Endpoints

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/me - Get current user
  • POST /api/auth/forgot-password - Password reset request

User Management

  • GET /api/users - Get all users (Admin/Warden)
  • GET /api/users/:id - Get specific user
  • PUT /api/users/:id - Update user profile
  • DELETE /api/users/:id - Delete user (Admin)

Room Management

  • GET /api/rooms - Get all rooms
  • POST /api/rooms - Create room (Admin)
  • PUT /api/rooms/:id - Update room
  • POST /api/rooms/:id/book - Book room

Payment System

  • GET /api/payments - Get payments
  • POST /api/payments - Create payment
  • POST /api/payments/verify - Verify Razorpay payment

Complaint Management

  • GET /api/complaints - Get complaints
  • POST /api/complaints - Create complaint
  • PUT /api/complaints/:id - Update complaint
  • POST /api/complaints/:id/resolve - Resolve complaint

πŸ”§ Development

Running in Development Mode

# Backend
cd backend && npm run dev

# Frontend
cd frontend && npm run dev

# Admin Panel
cd admin && npm run dev

Building for Production

# Frontend
cd frontend && npm run build

# Admin Panel
cd admin && npm run build

🎨 Features Showcase

Dashboard Analytics

  • Real-time occupancy tracking
  • Payment status monitoring
  • Complaint resolution metrics
  • User activity insights

Email System

  • Welcome emails for new users
  • Password reset notifications
  • Complaint status updates
  • Payment reminders

File Upload

  • Profile picture uploads
  • Document storage
  • Cloudinary integration
  • Secure file handling

πŸ“Έ Screenshots

Student Dashboard

Student Dashboard

Admin Panel

Admin Panel

User Management

User Management

Common Login

Admin Warden Login Page

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Authors

  • Sudhanshu Ravindra Sakhare - Initial work - YourGitHub

πŸ™ Acknowledgments

  • Material-UI for the beautiful components
  • MongoDB for the robust database
  • Cloudinary for image management
  • Razorpay for payment processing
  • Socket.io for real-time features

πŸ“ž Support

For support, email sudhanshusakhare808@gmail.com or create an issue in this repository.

πŸ”— Links


⭐ If you found this project helpful, please give it a star!

About

A comprehensive MERN stack application for managing hostel operations with admin panel, payment integration, and real-time features

Topics

Resources

License

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages