Skip to content

Raghs3/hostelManagementSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hostel Management System

A comprehensive hostel management system with MySQL backend and modern frontend.

Features

  • Student Management: Add, edit, delete student records
  • Room Management: Track room capacity and occupancy
  • Room Allotment: Assign students to rooms with automatic capacity checking
  • Mess Management: Track attendance and calculate fees
  • Fee Management: Handle hostel and mess fee payments
  • Complaint System: Track and resolve student complaints
  • Notifications: Automatic notifications for fees and updates
  • Dashboard: Overview statistics and recent activities
  • Authentication: Secure login system

Prerequisites

  • Node.js (v14 or higher)
  • MySQL Server
  • Your HostelDB database (already created with tables and triggers)

Installation

  1. Clone/Download the project files

  2. Install Node.js dependencies

    npm install
  3. Configure Database Connection

    • Update the .env file with your MySQL credentials:
      DB_HOST=localhost
      DB_USER=root
      DB_PASSWORD=your_mysql_password
      DB_NAME=HostelDB
      
  4. Start the server

    npm start

    For development with auto-restart:

    npm run dev
  5. Access the application

    • Open your browser and go to: http://localhost:3000
    • Default login credentials:
      • Username: admin
      • Password: admin123

Project Structure

hostel-management-system/
├── server.js              # Backend API server
├── package.json           # Node.js dependencies
├── .env                   # Environment variables
├── README.md             # Setup instructions
└── public/               # Frontend files
    ├── index.html        # Main HTML file
    ├── login.html        # Login page
    ├── style.css         # Styles
    └── app.js           # Frontend JavaScript

API Endpoints

Authentication

  • POST /api/login - User login

Students

  • GET /api/students - Get all students
  • POST /api/students - Add new student
  • PUT /api/students/:id - Update student
  • DELETE /api/students/:id - Delete student

Rooms

  • GET /api/rooms - Get all rooms with occupancy
  • POST /api/rooms - Add new room

Allotments

  • GET /api/allotments - Get current allotments
  • POST /api/allotments - Create new allotment
  • PUT /api/allotments/:id/end - End allotment

Mess

  • GET /api/mess-attendance - Get attendance records
  • POST /api/mess-attendance - Mark attendance
  • GET /api/mess-pricing - Get meal prices
  • PUT /api/mess-pricing/:meal_type - Update meal price

Fees

  • GET /api/fees - Get all fees
  • PUT /api/fees/:id/pay - Mark fee as paid

Complaints

  • GET /api/complaints - Get all complaints
  • POST /api/complaints - Add new complaint
  • PUT /api/complaints/:id/resolve - Resolve complaint

Dashboard

  • GET /api/dashboard - Get dashboard statistics

Database Integration

The system connects to your existing HostelDB MySQL database with all tables and triggers. The triggers automatically:

  • Prevent double room allotments
  • Enforce room capacity limits
  • Update room status based on occupancy
  • Calculate mess fees from attendance
  • Generate notifications for pending fees

Security Features

  • JWT-based authentication
  • Password protection for admin access
  • SQL injection prevention with parameterized queries
  • CORS enabled for cross-origin requests

Customization

Changing Login Credentials

Edit the login logic in server.js:

if (username === 'your_username' && password === 'your_password') {
    // Login logic
}

Adding New Features

  • Add new API routes in server.js
  • Update frontend in public/app.js
  • Modify styles in public/style.css

Troubleshooting

  1. Database Connection Issues

    • Verify MySQL is running
    • Check credentials in .env file
    • Ensure HostelDB database exists
  2. Port Already in Use

    • Change PORT in .env file
    • Kill existing processes using the port
  3. Module Not Found Errors

    • Run npm install to install dependencies
    • Check Node.js version compatibility

Support

For issues or questions, check the console logs for detailed error messages.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published