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.