A Travel Companion Platform for IIT Roorkee Students
HopAlong is a comprehensive web application designed to connect IIT Roorkee students for shared travel experiences. The platform enables students to discover travel companions, organize trips, manage join requests, and communicate in real-time through an intuitive and secure interface.
- Overview
- Key Features
- Technology Stack
- Architecture
- Getting Started
- Project Structure
- API Documentation
- Authentication Flow
- Real-time Features
- Security
- Deployment
- Contributing
- License
HopAlong solves the common challenge faced by IITR students who want to travel but lack companions or find it difficult to coordinate group trips. The platform provides a centralized hub where students can:
- Browse available trips posted by fellow students
- Create and manage their own trips
- Request to join trips that match their interests
- Communicate with trip participants through integrated chat
- Track their travel history and manage their profile
The application enforces IITR email authentication to ensure a trusted, campus-only community.
- Secure Registration: IITR email validation with support for departmental subdomains
- JWT Authentication: Token-based authentication with secure password hashing
- Profile Management: Update personal information, branch, year, and bio
- User Statistics: Track trips created and joined
- Trip Creation: Comprehensive trip details including destination, dates, budget, mode, and type
- Advanced Filtering: Filter trips by destination, dates, travel mode, and trip type
- Search Functionality: Quick search across trip titles, descriptions, and destinations
- Seat Management: Automatic participant tracking and capacity limits
- Trip Ownership: Organizers can edit and delete their own trips
- Request Workflow: Send personalized join requests with messages
- Approval System: Trip organizers can approve or reject requests
- Status Tracking: Monitor request status (pending, approved, rejected)
- Duplicate Prevention: System prevents multiple requests to the same trip
- Automatic Updates: Participant counts update automatically upon approval
- Group Chat: Socket.IO powered real-time messaging for trip participants
- Typing Indicators: See when other participants are typing
- Message History: Persistent chat history for each trip
- Participant-Only Access: Chat restricted to approved trip members
- Responsive Design: Optimized for desktop, tablet, and mobile devices
- Modern Aesthetics: Glass-morphism effects and gradient accents
- Smooth Animations: Page transitions and micro-interactions
- Toast Notifications: Real-time feedback for user actions
- Loading States: Professional skeleton loaders and loading indicators
- Framework: React 18 with Vite build tool
- Routing: React Router v6 for navigation
- State Management: Zustand with localStorage persistence
- Styling: TailwindCSS for utility-first styling
- HTTP Client: Axios with request/response interceptors
- Real-time: Socket.IO client for live updates
- Icons: Heroicons for consistent iconography
- Runtime: Node.js with Express.js framework
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- Real-time: Socket.IO server for WebSocket connections
- Security: Helmet, bcryptjs, express-rate-limit
- Validation: express-validator for input sanitization
- Logging: Morgan for request logging
- Authentication: User registers/logs in β Backend validates IITR email β JWT token issued β Token stored in localStorage
- Trip Browsing: Frontend fetches trips β Backend queries MongoDB β Filtered results returned
- Join Request: User sends request β Backend validates β Database updated β Notification sent via Socket.IO
- Real-time Chat: Message sent β Socket.IO broadcasts β All participants receive update instantly
Users Collection
- Personal information (name, email, branch, year, bio)
- Password (hashed with bcrypt)
- References to created trips and joined trips
- Avatar initials auto-generated from name
Trips Collection
- Trip details (title, destination, dates, budget)
- Organizer reference
- Participant references array
- Status tracking (upcoming, ongoing, completed)
Join Requests Collection
- User and trip references
- Request message
- Status (pending, approved, rejected)
- Timestamps
Messages Collection
- Trip and sender references
- Message content
- Read status tracking
- Node.js: Version 14 or higher (recommended v16+)
- MongoDB: Local installation or MongoDB Atlas account
- npm: Package manager (comes with Node.js)
- Git: Version control (for cloning repository)
1. Clone the repository
git clone https://github.com/your-username/HopAlong.git
cd HopAlongNote: Replace with your actual repository URL
2. Backend Setup
cd backend
npm installCreate .env file in backend directory:
PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/hopalong
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRE=30d
FRONTEND_URL=http://localhost:30003. Frontend Setup
cd ../frontend
npm installCreate .env file in frontend directory:
VITE_API_BASE_URL=http://localhost:5000/api4. Seed Database (Optional)
cd ../backend
npm run seedThis creates 6 demo users and 10 sample trips.
5. Start the Application
Open two terminal windows:
Terminal 1 - Backend:
cd backend
npm run devServer starts on http://localhost:5000
Terminal 2 - Frontend:
cd frontend
npm run devApplication opens on http://localhost:3000
HopAlong/
βββ frontend/ # React frontend application
βββ backend/ # Express backend API
βββ README.md # Root documentation (this file)
βββ package.json # Workspace metadata (if using npm workspaces)
frontend/
βββ src/
β βββ api/ # API client and endpoints
β β βββ api.js # API methods
β β βββ client.js # Axios configuration
β β βββ config.js # API settings and token helpers
β β βββ socket.js # Socket.IO client setup
β βββ assets/ # Static assets (images, icons)
β βββ components/ # Reusable UI components
β β βββ Header.jsx
β β βββ Footer.jsx
β β βββ TripCard.jsx
β β βββ TripForm.jsx
β β βββ ChatPanel.jsx
β β βββ FiltersBar.jsx
β β βββ RequestModal.jsx
β β βββ RequestsList.jsx
β β βββ Badge.jsx
β β βββ ErrorBoundary.jsx
β β βββ NotificationToast.jsx
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utility helpers
β βββ routes/ # Page-level components
β β βββ Login.jsx
β β βββ Register.jsx
β β βββ Home.jsx
β β βββ TripDetail.jsx
β β βββ CreateTrip.jsx
β β βββ Dashboard.jsx
β β βββ Profile.jsx
β β βββ NotFound.jsx
β βββ store/ # Zustand state management
β β βββ useStore.js
β βββ App.jsx # Root React component
β βββ index.css # Global styles
β βββ main.jsx # Application entry point
βββ public/ # Static public assets (if any)
βββ package.json
βββ README.md
βββ vite.config.js
backend/
βββ config/
β βββ db.js # MongoDB connection
βββ controllers/ # Request handlers
β βββ authController.js
β βββ messageController.js
β βββ requestController.js
β βββ tripController.js
β βββ userController.js
βββ middleware/ # Custom middleware
β βββ auth.js
β βββ errorHandler.js
β βββ validation.js
βββ models/ # Mongoose schemas
β βββ JoinRequest.js
β βββ Message.js
β βββ Trip.js
β βββ User.js
βββ routes/ # API route definitions
β βββ auth.js
β βββ messages.js
β βββ requests.js
β βββ trips.js
β βββ users.js
βββ seeders/
β βββ seedData.js # Database seeding script
βββ utils/
β βββ emailValidator.js
β βββ generateToken.js
βββ uploads/ # File upload directory (placeholder)
βββ package.json
βββ README.md
βββ server.js # Express server entry point
βββ .env.example # Environment variable template
http://localhost:5000/api
| Method | Endpoint | Description | Access |
|---|---|---|---|
| POST | /auth/register |
Register new user | Public |
| POST | /auth/login |
Login user | Public |
| GET | /auth/me |
Get current user | Private |
| POST | /auth/logout |
Logout user | Private |
| PUT | /auth/updatepassword |
Update password | Private |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /trips |
Get all trips (filtered) | Public |
| GET | /trips/:id |
Get single trip | Public |
| POST | /trips |
Create new trip | Private |
| PUT | /trips/:id |
Update trip | Private (Owner) |
| DELETE | /trips/:id |
Delete trip | Private (Owner) |
Query Parameters for GET /trips:
destination- Filter by destinationstartDate- Filter by start dateendDate- Filter by end datemode- Travel mode (Bus, Train, Car, Flight)type- Trip type (Adventure, Leisure, Cultural, Educational)status- Trip status (upcoming, ongoing, completed)search- Search termpage- Page number (default: 1)limit- Results per page (default: 10)
| Method | Endpoint | Description | Access |
|---|---|---|---|
| POST | /requests |
Send join request | Private |
| GET | /requests/trip/:tripId |
Get trip requests | Private (Owner) |
| GET | /requests/user/:userId |
Get user requests | Private (Self) |
| PUT | /requests/:id/approve |
Approve request | Private (Owner) |
| PUT | /requests/:id/reject |
Reject request | Private (Owner) |
| DELETE | /requests/:id |
Cancel request | Private (Self) |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /messages/trip/:tripId |
Get trip messages | Private (Participant) |
| POST | /messages |
Send message | Private (Participant) |
| DELETE | /messages/:id |
Delete message | Private (Sender) |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /users/:id |
Get user profile | Public |
| PUT | /users/:id |
Update user profile | Private (Self) |
| GET | /users/:id/trips |
Get user's trips | Public |
| GET | /users/:id/participations |
Get joined trips | Public |
| GET | /users/:id/stats |
Get user statistics | Public |
- User submits registration form with IITR email
- Backend validates email format (*.iitr.ac.in)
- Password is hashed using bcrypt (10 salt rounds)
- User document created in MongoDB
- JWT token generated and returned
- Frontend stores token in localStorage
- User automatically logged in
- User submits email and password
- Backend normalizes email (lowercase, trim)
- User retrieved from database with password field
- Password compared using bcrypt
- JWT token generated on successful match
- Token returned and stored in frontend
- Socket.IO connection established
- Frontend checks authentication state before rendering
- Axios interceptor attaches JWT to all requests
- Backend middleware verifies token
- Invalid/expired tokens trigger logout
Client Events
user:join- User connects with their IDtrip:join- Join trip roomtrip:leave- Leave trip roommessage:send- Send messagetyping:start- User starts typingtyping:stop- User stops typing
Server Events
message:new- New message broadcastuser:typing- Typing indicatoruser:joined- User joined tripuser:left- User left triprequest:notification- New join requestrequest:status-update- Request approved/rejected
- Automatic reconnection on disconnect
- User-socket mapping for targeted notifications
- Room-based messaging for trip isolation
Password Security
- Bcrypt hashing with 10 salt rounds
- Passwords never returned in API responses
- Password reset functionality (updatePassword endpoint)
JWT Tokens
- Signed with secret key
- 30-day expiration by default
- Stored in localStorage (consider httpOnly cookies for production)
- Automatic cleanup on logout
Input Validation
- express-validator for all inputs
- IITR email domain enforcement
- XSS prevention through sanitization
- SQL/NoSQL injection prevention via Mongoose
Rate Limiting
- 100 requests per 10 minutes per IP
- Prevents brute force attacks
- Applied to all API endpoints
CORS
- Configured allowed origins
- Credentials support enabled
- Prevents unauthorized access
HTTP Security Headers
- Helmet middleware for security headers
- Content Security Policy
- XSS Protection
- HSTS enabled
Backend
- Set
NODE_ENV=production - Use strong
JWT_SECRET(minimum 32 characters) - Configure MongoDB Atlas or production database
- Enable HTTPS
- Set proper CORS origins
- Configure logging and monitoring
- Use process manager (PM2)
- Set up database backups
Frontend
- Update
VITE_API_BASE_URLto production API - Build optimized production bundle
- Configure CDN for static assets
- Enable HTTPS
- Set up error tracking (e.g., Sentry)
- Configure analytics
Infrastructure
- Use reverse proxy (Nginx)
- Set up SSL certificates
- Configure firewall rules
- Set up monitoring and alerts
- Configure backup strategy
Frontend: Vercel, Netlify, AWS S3 + CloudFront Backend: Heroku, DigitalOcean, AWS EC2, Railway Database: MongoDB Atlas
Authentication
- Register with IITR email (test subdomain support)
- Verify automatic login after registration
- Logout and login with same credentials
- Test invalid email formats
Trip Management
- Create a trip with all required fields
- Edit trip details (owner only)
- Filter trips by various criteria
- Search for trips by keyword
- Delete trip (owner only)
Join Requests
- Send join request with message
- Verify organizer receives notification
- Approve/reject request
- Check participant list updates
- Test duplicate request prevention
Chat
- Join approved trip
- Send messages
- Verify real-time delivery
- Test typing indicators
- Check message persistence
After running npm run seed in the backend directory, use any of these test accounts:
rahul.sharma@iitr.ac.in/password123(CSE, 3rd Year)priya.patel@iitr.ac.in/password123(ECE, 2nd Year)arjun.kumar@iitr.ac.in/password123(Mechanical, 4th Year)sneha.reddy@iitr.ac.in/password123(Civil, 3rd Year)vikram.singh@iitr.ac.in/password123(Chemical, 2nd Year)ananya.gupta@iitr.ac.in/password123(Architecture, 1st Year)
All seeded users share the same password for testing convenience.
- Fork the repository
- Create a feature branch (
git checkout -b feature/YourFeature) - Commit changes (
git commit -m 'Add YourFeature') - Push to branch (
git push origin feature/YourFeature) - Open a Pull Request
MIT License
Built for the IIT Roorkee community


