|
| 1 | +# Hostel Management System |
| 2 | + |
| 3 | +This project has been converted from a project management system to a comprehensive hostel management system. The system allows admins and super admins to manage hostels, while users can browse, filter, and review hostels. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### 🏨 Hostel Management |
| 8 | +- **Add Hostels**: Only admins and super admins can add new hostels |
| 9 | +- **Hostel Information**: Complete hostel details including name, description, location (Google Maps link), contact info, and pricing |
| 10 | +- **Image Management**: Support for multiple hostel images with primary image designation |
| 11 | +- **Categories & Filtering**: Dynamic categorization system for amenities, room types, location types, price ranges, and atmosphere |
| 12 | + |
| 13 | +### ⭐ Ratings & Reviews |
| 14 | +- **Rating System**: 5-star rating system with categories (overall, cleanliness, location, value, atmosphere) |
| 15 | +- **Comments**: User reviews with verification system |
| 16 | +- **Average Ratings**: Automatic calculation and display of average ratings |
| 17 | + |
| 18 | +### 🔍 Search & Filtering |
| 19 | +- **Advanced Filtering**: Filter by amenities, room types, location types, price ranges, and atmosphere |
| 20 | +- **Tab Categories**: |
| 21 | + - All Hostels |
| 22 | + - Latest (added in last month) |
| 23 | + - Top Rated (4+ stars) |
| 24 | + - Budget Friendly (under $50) |
| 25 | + - This Week (added in last week) |
| 26 | + - Oldest (chronological order) |
| 27 | + |
| 28 | +### 👥 User Management |
| 29 | +- **Admin System**: Firebase-based authentication with admin and super admin roles |
| 30 | +- **Role-based Access**: Only authorized users can add/edit hostels |
| 31 | +- **User Reviews**: Any authenticated user can rate and review hostels |
| 32 | + |
| 33 | +## Database Schema |
| 34 | + |
| 35 | +### Core Tables |
| 36 | +- **hostels**: Main hostel information |
| 37 | +- **hostel_images**: Image management with primary image support |
| 38 | +- **ratings**: User ratings with multiple categories |
| 39 | +- **comments**: User reviews and feedback |
| 40 | +- **categories**: Dynamic category system |
| 41 | +- **category_option_values**: Options for each category |
| 42 | +- **hostel_options**: Many-to-many relationship between hostels and category options |
| 43 | + |
| 44 | +### Key Features |
| 45 | +- **Soft Delete**: Hostels are marked as inactive rather than deleted |
| 46 | +- **Image Management**: Support for multiple images per hostel |
| 47 | +- **Rating Categories**: Detailed rating system with multiple aspects |
| 48 | +- **Flexible Categories**: Dynamic category system that can be easily extended |
| 49 | + |
| 50 | +## API Endpoints |
| 51 | + |
| 52 | +### Hostels |
| 53 | +- `GET /api/hostels` - Fetch all active hostels with ratings and images |
| 54 | +- `POST /api/hostels` - Create new hostel (admin only) |
| 55 | +- `PUT /api/hostels` - Update hostel (admin only) |
| 56 | +- `DELETE /api/hostels` - Soft delete hostel (admin only) |
| 57 | + |
| 58 | +### Ratings |
| 59 | +- `GET /api/ratings?hostelId=X` - Get ratings for a hostel |
| 60 | +- `POST /api/ratings` - Add new rating |
| 61 | +- `PUT /api/ratings` - Update rating |
| 62 | +- `DELETE /api/ratings?ratingId=X` - Delete rating |
| 63 | + |
| 64 | +### Comments |
| 65 | +- `GET /api/comments?hostelId=X` - Get comments for a hostel |
| 66 | +- `POST /api/comments` - Add new comment |
| 67 | +- `PUT /api/comments` - Update comment |
| 68 | +- `DELETE /api/comments?commentId=X` - Delete comment |
| 69 | + |
| 70 | +### Images |
| 71 | +- `GET /api/hostel-images?hostelId=X` - Get images for a hostel |
| 72 | +- `POST /api/hostel-images` - Add new image |
| 73 | +- `PUT /api/hostel-images` - Update image |
| 74 | +- `DELETE /api/hostel-images?imageId=X` - Delete image |
| 75 | + |
| 76 | +## Setup Instructions |
| 77 | + |
| 78 | +### 1. Database Setup |
| 79 | +```bash |
| 80 | +# Run migrations |
| 81 | +npm run db:migrate |
| 82 | + |
| 83 | +# Seed categories |
| 84 | +npx tsx drizzle/seed-hostel-categories.ts |
| 85 | + |
| 86 | +# Seed sample hostels (optional) |
| 87 | +npx tsx drizzle/seed-hostels.ts |
| 88 | +``` |
| 89 | + |
| 90 | +### 2. Environment Variables |
| 91 | +Ensure your `.env` file includes: |
| 92 | +- Database connection string |
| 93 | +- Firebase configuration |
| 94 | +- Any other required environment variables |
| 95 | + |
| 96 | +### 3. Admin Setup |
| 97 | +1. Set up Firebase authentication |
| 98 | +2. Add admin users through the admin interface |
| 99 | +3. Configure admin roles (admin/superadmin) |
| 100 | + |
| 101 | +## Category System |
| 102 | + |
| 103 | +The system uses a flexible category system with the following default categories: |
| 104 | + |
| 105 | +### Amenities |
| 106 | +- Free WiFi, Kitchen, Laundry, Common Room, Garden/Terrace, Bar, Breakfast Included, Air Conditioning, Heating, Luggage Storage, 24/7 Reception, Security Lockers, Bicycle Rental, Tour Desk, BBQ Area |
| 107 | + |
| 108 | +### Room Types |
| 109 | +- Dormitory, Private Room, Double Room, Twin Room, Single Room, Family Room, Female Only Dorm, Male Only Dorm, Mixed Dorm |
| 110 | + |
| 111 | +### Location Types |
| 112 | +- City Center, Near Train Station, Near Airport, Beachfront, Mountain View, Rural Area, University District, Shopping District, Historic District, Business District |
| 113 | + |
| 114 | +### Price Ranges |
| 115 | +- Budget ($10-25), Economy ($25-50), Mid-range ($50-100), Premium ($100-200), Luxury ($200+) |
| 116 | + |
| 117 | +### Atmosphere |
| 118 | +- Party/Social, Quiet/Relaxed, Family Friendly, Backpacker, Digital Nomad, Student, Eco-friendly, Boutique, Traditional |
| 119 | + |
| 120 | +## Usage |
| 121 | + |
| 122 | +### For Admins |
| 123 | +1. **Add Hostels**: Use the "Add Hostel" button (FAB) to create new hostels |
| 124 | +2. **Manage Categories**: Add/edit categories and options through the admin interface |
| 125 | +3. **Moderate Reviews**: Approve/verify user comments and ratings |
| 126 | +4. **Update Information**: Edit hostel details, images, and contact information |
| 127 | + |
| 128 | +### For Users |
| 129 | +1. **Browse Hostels**: View all hostels with filtering options |
| 130 | +2. **Search & Filter**: Use the filter panel to find specific hostels |
| 131 | +3. **View Details**: Click on hostel cards to see full information |
| 132 | +4. **Rate & Review**: Leave ratings and comments for hostels you've visited |
| 133 | +5. **View on Map**: Click "View on Map" to see hostel location on Google Maps |
| 134 | + |
| 135 | +## Technical Stack |
| 136 | + |
| 137 | +- **Frontend**: Next.js 14, React, TypeScript, Tailwind CSS |
| 138 | +- **Backend**: Next.js API Routes |
| 139 | +- **Database**: PostgreSQL with Drizzle ORM |
| 140 | +- **Authentication**: Firebase Auth |
| 141 | +- **Deployment**: Vercel (recommended) |
| 142 | + |
| 143 | +## Contributing |
| 144 | + |
| 145 | +1. Fork the repository |
| 146 | +2. Create a feature branch |
| 147 | +3. Make your changes |
| 148 | +4. Add tests if applicable |
| 149 | +5. Submit a pull request |
| 150 | + |
| 151 | +## License |
| 152 | + |
| 153 | +This project is licensed under the MIT License. |
| 154 | + |
| 155 | +## Support |
| 156 | + |
| 157 | +For support or questions, please open an issue in the repository or contact the development team. |
0 commit comments