A mobile platform for day-to-day hostel operations
Built with β€οΈ for Indian Institute of Information Technology, Sonepat featuring QR gate passes, GPS attendance, mess management, emergency SOS & real-time notifications.
- π« Digital Gate Passes - Request, track, and validate passes with QR codes
- π Smart Attendance - Geofence-based attendance marking (7 PM - 8 PM)
- π½οΈ Mess Menu - Weekly menu with ratings and feedback
- π’ Notice Board - Real-time notices from hostel admin
- π οΈ Complaints - Submit and track maintenance requests
- π₯ Visitor Management - Pre-register visitors
- π Push Notifications - Real-time alerts and updates
- π¨βπ©βπ§ Child Monitoring - View linked student activities
- β Gate Pass Approval - Two-tier approval (Parent β Warden)
- π Attendance Tracking - Daily attendance reports
- π¨ Emergency Alerts - Instant notifications
- π· QR Scanner - Validate gate passes quickly
- π Activity Logs - Entry/exit tracking
- π₯ Real-time Dashboard - Current pass status
- π Dashboard - Hostel statistics at a glance
- β Pass Management - Approve/reject gate passes
- π Student Management - View student records
- π’ Notice Creation - Broadcast announcements
- π₯ User Management - Create and manage all user types
- π Parent-Student Linking - Link parent accounts
- βοΈ System Configuration - Geofence, attendance windows
- π Analytics - System-wide insights
Technology Stack:
βββ React Native 0.81.5
βββ Expo SDK 54
βββ Expo Router (File-based routing)
βββ TypeScript 5.9
βββ TanStack Query (State management)
βββ Axios (HTTP client)
βββ Expo Secure Store (Token storage)
Key Features:
βββ QR Code generation/scanning (expo-barcode-scanner)
βββ Geolocation (expo-location)
βββ Push notifications (expo-notifications)
βββ Dark/Light theme toggle
βββ Offline-first with React Query caching
Technology Stack:
βββ Node.js 18+
βββ Express 4.21
βββ MongoDB (Mongoose 8.9)
βββ Redis (ioredis) - Caching
βββ TypeScript 5.9
βββ JWT (jsonwebtoken)
βββ PM2 (Process management)
Security:
βββ Helmet (HTTP headers)
βββ CORS (Origin whitelisting)
βββ Rate limiting (express-rate-limit)
βββ Input sanitization
βββ bcrypt (Password hashing)
βββ Expo Push Notifications
βββ Zod (Schema validation)
HMS-Mobile/
β
βββ Frontend/ # React Native Mobile App
β βββ app/ # Expo Router screens
β β βββ (tabs)/ # Main tab navigation
β β βββ guard/ # Guard-specific screens
β β βββ parent/ # Parent portal
β β βββ warden/ # Warden dashboard
β βββ components/ # Reusable UI components
β βββ lib/ # Core utilities
β β βββ api.ts # Axios instance
β β βββ hooks.ts # React Query hooks
β β βββ services.ts # API service layer
β β βββ types.ts # TypeScript types
β βββ app.json # Expo configuration
β βββ eas.json # EAS Build configuration
β βββ package.json
β
βββ Backend/ # Express API Server
β βββ src/
β β βββ controllers/ # Request handlers (14 files)
β β βββ models/ # MongoDB schemas (15 collections)
β β βββ routes/ # API endpoints
β β βββ middleware/ # Auth, validation, error handling
β β βββ services/ # Business logic (JWT, notifications)
β β βββ utils/ # Helpers (logger, cache, pagination)
β β βββ schemas/ # Zod validation schemas
β β βββ types/ # TypeScript interfaces
β βββ dist/ # Compiled JavaScript (production)
β βββ ecosystem.config.js # PM2 configuration
β βββ .env # Environment variables
β βββ package.json
β
βββ Documentation.md # Detailed project documentation
- Node.js 18+ (Download)
- MongoDB 5+ (Local or MongoDB Atlas)
- Redis 6+ (Optional but recommended)
- Git (Download)
- Expo CLI (will be installed automatically)
# 1. Clone repository
git clone <repository-url>
cd HMS-Mobile/Backend
# 2. Install dependencies
npm install
# 3. Configure environment
cp .env.example .env
# Edit .env with your values:
# - MONGODB_URI (your MongoDB connection)
# - JWT_SECRET (generate with: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))")
# - REDIS_URL (if using Redis)
# 4. Run development server
npm run dev
# Server starts at http://localhost:5000
# Health check: http://localhost:5000/health# 1. Navigate to frontend
cd ../Frontend
# 2. Install dependencies
npm install
# 3. Configure API URL
# Edit .env file:
EXPO_PUBLIC_API_URL=http://YOUR_LOCAL_IP:5000/api
# Note: Use your computer's local IP (not localhost) for physical device testing
# 4. Start Expo
npx expo start
# Options:
# - Press 'a' for Android emulator
# - Press 'i' for iOS simulator (Mac only)
# - Scan QR code with Expo Go app on your phone# Server
PORT=5000
NODE_ENV=development
# MongoDB
MONGODB_URI=mongodb://localhost:27017/hms
# Or MongoDB Atlas: mongodb+srv://username:password@cluster.mongodb.net/database
# JWT
JWT_SECRET=your-super-secret-key-CHANGE-THIS
JWT_EXPIRES_IN=7d
# Redis (optional)
REDIS_URL=redis://localhost:6379
# CORS (production domains)
ALLOWED_ORIGINS=https://yourdomain.com# API Configuration
EXPO_PUBLIC_API_URL=http://192.168.1.33:5000/api
# For production:
# EXPO_PUBLIC_API_URL=https://your-backend-domain.com/api# 1. Install EAS CLI
npm install -g eas-cli
# 2. Login to Expo
eas login
# 3. Build APK
cd Frontend
eas build --platform android --profile preview
# Wait 15-20 minutes -> Download APK -> Share with users# Build for TestFlight
cd Frontend
eas build --platform ios --profile preview
# Submit to App Store
eas submit --platform iosAlready deployed at: https://hostel-management-system-backend-jde3.onrender.com
To deploy your own:
- Create account at render.com
- Connect GitHub repository
- Add environment variables
- Deploy with one click
cd Backend
npm test # Run all tests
npm run test:watch # Watch mode# Health Check
curl https://hostel-management-system-backend-jde3.onrender.com/health
# Login
curl -X POST https://your-backend/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"student@test.com","password":"password123"}'| Component | Files | Lines of Code |
|---|---|---|
| Frontend | ~5,206 lines | React Native, TypeScript |
| Backend | ~5,755 lines | Node.js, Express, TypeScript |
| Total | ~10,961 lines | Production code |
users- All user accounts (students, parents, staff)gatepasses- Gate pass requestsgatepasslogs- Entry/exit activityattendance- Daily attendance recordsnotices- Notice board postscomplaints- Maintenance complaintsmessmenus- Weekly meal schedulesfoodratings- Meal ratingsvisitors- Visitor registrationspayments- Fee trackinglaundries- Laundry serviceemergencies- SOS alertsnotifications- In-app notificationsparentstudents- Parent-child linkssystemconfigs- System settings
β
JWT Authentication - Secure token-based auth
β
Password Hashing - bcrypt with salt rounds
β
Role-Based Access Control - Student, Parent, Guard, Warden, Admin
β
Rate Limiting - Protect against brute force (3 tiers)
β
Input Validation - Zod schemas for all endpoints
β
XSS Protection - Input sanitization middleware
β
CORS Whitelisting - Configurable allowed origins
β
Helmet Security - HTTP headers hardening
β
Geofencing - Location-based attendance verification
β
QR Code Security - Unique codes for gate pass validation
- β Mobile-First Design - Optimized for students on the go
- β Real-Time Updates - Push notifications for instant alerts
- β Offline Support - React Query caching for offline access
- β Dark Mode - System-aware theme switching
- β Production-Ready - PM2 cluster mode, Redis caching, structured logging
- β Type-Safe - Full TypeScript on frontend and backend
- β Scalable Architecture - Supports 1000+ concurrent users
- Documentation.md - Full project breakdown
- Backend API Documentation - API endpoints reference
- Deployment Guide - Production deployment steps
- Build Testing Guide - APK/IPA build instructions
# Terminal 1 - Backend
cd Backend
npm run dev
# Server at http://localhost:5000
# Terminal 2 - Frontend
cd Frontend
npx expo start
# Scan QR with Expo Go app# Backend build check
cd Backend
npm run build
# TypeScript check
npx tsc --noEmit- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
Developed at Indian Institute of Information Technology, Sonepat (IIIT Sonepat)
For issues or questions:
- Check Documentation.md
- Review API docs
- Open an issue on the GitHub repository
- Contact the team at IIIT Sonepat
- WebSocket for live updates
- Analytics dashboard
- SMS notifications for parents
- Biometric authentication
- Offline mode sync
- Multi-language support
- Payment gateway integration
- Medical records module
- Event calendar
- Chat system (Student β Warden)
Built with β€οΈ at IIIT Sonepat for smarter hostel management