HostelGatePassForm is a comprehensive hostel management system that automates the gate pass request and approval workflow for educational institution hostels.
The system provides role-based access control for Students, Floor-in-Charge staff, and Administrators, enabling efficient management of hostel operations and gate pass requests.
- Student Registration & Profile Management: Complete student information with room assignments
- Floor-in-Charge Management: Staff administration for floor supervision
- Admin Dashboard: System-wide oversight and user management
- Role-based Access Control: Secure authentication with JWT tokens
- Gate Pass Requests: Students can submit leave requests with dates and reasons
- Approval Workflow: Floor-in-Charge can approve/reject gate pass requests
- Status Tracking: Real-time status updates (PENDING, APPROVED, REJECTED)
- HOD Letter Upload: Upload approval letters for verification
- Room Management: Room allocation and capacity management
- Floor Type Configuration: Different floor types and blocks
- Student-Room Assignment: Automated room assignment system
- JWT Authentication with refresh tokens
- Password Recovery: OTP-based password reset via email
- Image Upload: Secure student profile image management
- HTTP-Only Cookies: Enhanced token security
- Framework: Spring Boot 3.2.5
- Security: Spring Security + JWT (0.11.5)
- Database: MySQL (Production) / H2 (Testing)
- ORM: Spring Data JPA
- Email: Spring Mail for OTP delivery
- Validation: Bean Validation
- Build Tool: Maven
- Java: 17 / 21
- Framework: React 19.1.0
- Build Tool: Vite 7.0.0
- Routing: React Router DOM 7.6.3
- UI Components: React Icons 5.5.0
- Notifications: React Toastify 11.0.5
- Authentication: JWT Decode 4.0.0
- Frontend Layer: React SPA with component-based architecture
- API Layer: RESTful controllers with role-based endpoints
- Security Layer: JWT authentication and authorization
- Service Layer: Business logic implementation
- Data Layer: JPA repositories with MySQL database
- Java: JDK 17+
- Node.js: v16+
- MySQL: v8.0+
- Maven: Installed or use wrapper
git clone https://github.com/rgl456/HostelGatePassForm.git
cd HostelGatePassFormCreate a MySQL database and note the JDBC URL, username, and password.
Configure environment variables (recommended via OS env or
.env/application.propertiesas you prefer).
Backend (examples):
# application.properties (Spring Boot)
spring.datasource.url=${DB_URL}
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
jwt.secret=${SECRET_KEY}
jwt.expiration=${JWT_EXPIRATION}
jwt.refresh.expiration=${JWT_REFRESH_EXPIRATION}
spring.mail.host=${MAIL_HOST}
spring.mail.port=${MAIL_PORT}
spring.mail.username=${MAIL_USERNAME}
spring.mail.password=${MAIL_PASSWORD}
app.otp.expired-seconds=${OTP_EXPIRED_SECONDS}Required Variables:
DB_URL– MySQL JDBC URLDB_USERNAME– DB userDB_PASSWORD– DB passwordSECRET_KEY– JWT secretJWT_EXPIRATION– Access token TTL (ms)JWT_REFRESH_EXPIRATION– Refresh token TTL (ms)MAIL_HOST,MAIL_PORT,MAIL_USERNAME,MAIL_PASSWORD– SMTP configOTP_EXPIRED_SECONDS– OTP expiry seconds
# Using Maven wrapper (recommended)
./mvnw clean install
./mvnw spring-boot:run
# Or using installed Maven
mvn clean install
mvn spring-boot:runDefault API base URL: http://localhost:8080
cd client
npm install
npm run devDefault dev URL: http://localhost:5173
Base path:
/api/v1
POST /login– User authenticationPOST /refresh-token– Token refreshPOST /logout– User logoutPOST /register/students– Student registrationPOST /register/floor-in-charges– Floor-in-Charge registrationPOST /register/admins– Admin registration
PUT /students/{studentId}/profile– Update own profilePUT /students/{studentId}/profile/update– Admin/FIC profile updateGET /students/me/profile– Get current student profileGET /students/{studentId}– Get student by IDGET /students/room/{roomNo}– Get students by room noGET /students– Get all studentsPOST /students/me/upload-image– Upload imageGET /students/{studentId}/profile-image– View profile image
POST /gate-passes– Create gate pass requestGET /gate-passes– Get all (Admin only)PUT /gate-passes/{id}– Update gate pass requestGET /gate-passes/floor-in-charge– By FICGET /gate-passes/student– By studentGET /gate-passes/filter-by-status– Filter by statusPUT /gate-passes/{id}/update-status– Update status
PUT /floor-in-charges/me/profile– Update FIC profileGET /floor-in-charges/me/students– Assigned studentsGET /floor-in-charges/{id}/students– Students for a FICGET /floor-in-charges/me/profile– Current FIC profileGET /floor-in-charges/{id}– Get FIC by IDGET /floor-in-charges– Get allDELETE /floor-in-charges/{id}– Delete FIC
POST /rooms– Create roomPOST /rooms/bulk-add– Add multiple roomsGET /rooms/{roomNo}– Get room by numberGET /rooms– Get all roomsPUT /rooms/{roomNo}– Update roomDELETE /rooms/{roomNo}– Delete room
POST /floor-types– Create floor typeGET /floor-types– Get allPUT /floor-types/{id}/assign-floor-in-charge– Assign FICDELETE /floor-types/{id}– Delete floor typeGET /floor-types/all/block– Get all blocksGET /floor-types/all/floor– Get all floors
POST /forgot-password/{email}– Verify email & send OTPPOST /forgot-password/verify-otp/{otp}/{email}– Verify OTPPOST /forgot-password/reset/{email}– Reset password
src/main/java/com/project/HostelGatePassForm/
├── config/ # Configuration classes
├── controller/ # REST controllers
├── dto/ # Data Transfer Objects
├── exceptions/ # Custom exceptions
├── jwt/ # JWT utilities
├── mapper/ # Entity-DTO mappers
├── model/ # Entity classes and enums
├── repository/ # JPA repositories
├── security/ # Security configuration
├── service/ # Business logic services
└── HostelGatePassFormApplication.java
client/src/
├── auth/ # Authentication components
├── components/ # Reusable UI components
├── data/ # Static data and constants
├── pages/ # Page components
├── styles/ # CSS styles
├── App.jsx # Main application component
└── main.jsx # Application entry point
- Users log in with email/password
- Server issues JWT access & refresh tokens in HTTP-only cookies
- Access token used for protected endpoints
- Refresh token provides extended sessions
| Role | Permissions |
|---|---|
STUDENT |
Create/update own gate passes, manage own profile |
FLOOR_IN_CHARGE |
Approve/reject gate passes, manage assigned students |
ADMIN |
Full access: user management, rooms & floor types, system configuration |
- Register and complete profile (with room assignment)
- Upload profile image
- Submit gate pass requests (dates, reasons)
- Track request status
- Log in with FIC credentials
- View assigned students
- Review & approve/reject gate pass requests
- Manage floor operations
- Access admin dashboard
- Manage users (students, FIC, admins)
- Configure rooms & floor types
- Monitor system-wide activity
# Backend
./mvnw clean package
# Frontend
cd client
npm run build# Backend tests
./mvnw test
# Frontend (lint)
cd client
npm run lint- File uploads are stored in:
E:/uploads/ - Database schema is auto-updated via Hibernate DDL
- Email service requires valid SMTP configuration for OTP delivery
- JWT tokens are stored in secure HTTP-only cookies
- Fork the repository
- Create a feature branch (
feat/your-feature) - Make your changes + add tests if applicable
- Submit a Pull Request 🚀
This project is licensed under the Apache License 2.0.
You are free to use, modify, and distribute this project under the terms of the license.
However, you must preserve copyright notices and include a copy of the license in any redistribution.
👉 See the LICENSE file for full details.
Note: This is a Spring Boot application with a React frontend. Ensure all environment variables are properly configured before running the application.