HotelHub is a modern, scalable hotel management system built with Django, featuring real-time chat capabilities, comprehensive booking management, and robust user authentication. Designed for both small boutique hotels and large hotel chains, HotelHub provides a complete solution for managing accommodations, bookings, and guest communications.
- JWT-based Authentication
- Secure token-based authentication
- Refresh token mechanism
- Token blacklisting for security
- User Management
- Custom user model with extended fields
- Profile management with avatar support
- Role-based access control (Admin, Staff, Guest)
- Security Features
- Password validation and hashing
- Rate limiting for API endpoints
- CSRF protection
- Hotel Operations
- Comprehensive hotel listing with detailed information
- Room type management and pricing
- Amenities and facilities tracking
- Location-based search with geocoding
- Room Management
- Dynamic room availability system
- Room type categorization
- Pricing and seasonal rates
- Room status tracking
- Reservation Management
- Real-time availability checking
- Multi-room booking support
- Booking modification and cancellation
- Automated confirmation emails
- Payment Integration
- Secure payment processing (coming soon)
- Multiple payment method support
- Refund management
- Invoice generation
- Communication Features
- WebSocket-based chat rooms
- Real-time messaging
- File sharing capabilities
- Message history
- Room Management
- Private and group chat rooms
- Room moderation tools
- User presence indicators
- Message notifications
- User Preferences
- Save favorite hotels
- Custom lists and categories
- Quick access to preferred accommodations
- Price alerts for saved hotels
- OpenAI API
- Fetch hotel and room details
- Generate descriptions from data
- Features
- Real-time AI content
- Enhanced data retrieval
- Implementation
- Secure API key storage
- Rate limiting for requests
- Redis caching
- Error handling
- Framework & Libraries
- Django 5.1.8 - Web framework
- Django REST Framework - API development
- Django Channels - WebSocket support
- Celery - Task queue management
- Celery Beat - Periodically check, Automatically set
- Redis - Caching and message broker
- Elasticsearch - Search functionality
- DRF Spectacular - API documentation
- Development: SQLite
- Production: PostgreSQL
- Search: Elasticsearch
- Cache: Redis
- Docker
- Docker Compose
- Nginx (planned)
- Python 3.12+
- Docker and Docker Compose
- Redis 6.0+
- Elasticsearch 8.0+
- PostgreSQL 15+ (for production)
The API documentation is available at:
- Swagger UI:
http://localhost:8000/api/schema/swagger-ui/ - ReDoc:
http://localhost:8000/api/schema/redoc/
-- Authentication
-
POST /api/v1/auth/register/- User registration -
POST /api/v1/auth/login/- User login -
POST /api/v1/auth/refresh/- Refresh token -
POST /api/v1/auth/logout/- User logout -
Hotels
GET /api/v1/hotels/- List hotelsPOST /api/v1/hotels/- Create hotelGET /api/v1/hotels/{id}/- Hotel detailsPUT /api/v1/hotels/{id}/- Update hotelDELETE /api/v1/hotels/{id}/- Delete hotelGET /api/v1/hotels/{id}/photos/- List hotel photosPOST /api/v1/hotels/{id}/photos/- Create hotel photoDELETE /api/v1/hotels/{id}/photos/{photo_id}/- Delete hotel photo
-
Rooms
GET /api/v1/rooms/- List roomsPOST /api/v1/room/create/- Create roomGET /api/v1/room/{id}/- Room detailsGET /api/v1/rooms/{id}/hotel/- List rooms for hotelGET /api/v1/rooms/search/- Search roomsGET /api/v1/room/photos/{id}/- List room photos
-
Bookings
GET /api/v1/bookings/- List bookingsPOST /api/v1/bookings/- Create bookingGET /api/v1/bookings/{id}/- Booking detailsPUT /api/v1/bookings/{id}/- Update bookingDELETE /api/v1/bookings/{id}/- Cancel booking
-
Favorites
GET /api/v1/favorites/- List favoritesGET /api/v1/favorite/{id}/- Favorite detailsPOST /api/v1/favorite/room/{id}/create/- Create favorite for roomPOST /api/v1/favorite/hotel/{id}/create/- Create favorite for hotel
-
Cities
GET /api/v1/cities/- List citiesGET /api/v1/cities/{pk}/- City details
-
Ai
POST /api/v1/support/request/<int:room_id>/- Ai support requestGET /api/v1/support/response/<int:room_id>/- Ai support response
# Run all tests
python manage.py test
# Run specific app tests
python manage.py test accounts
python manage.py test hotels
python manage.py test bookings
# Run with coverage
coverage run --source='.' manage.py test
coverage report- Unit Tests
- API Tests
- Integration Tests
- WebSocket Tests
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow PEP 8 style guide
- Write meaningful commit messages
- Include tests for new features
- Update documentation as needed
- Ensure all tests pass
This project is licensed under the MIT License - see the LICENSE file for details.
- Django team for the amazing framework
- All contributors who have helped shape this project
- Open source community for their invaluable tools and libraries
For support, email [email protected] or join our Slack channel.
hotelhub/
βββ accounts/ # User authentication and profile management
βββ bookings/ # Booking system and reservation management
βββ chat/ # Real-time chat functionality
βββ favorites/ # User favorites and saved items
βββ hotels/ # Hotel management and operations
βββ rooms/ # Room management and availability
βββ utils/ # Utility functions and helpers
βββ logging/ # Logging configuration and handlers
βββ hotelhub/ # Project configuration
β βββ settings.py # Django settings
β βββ urls.py # Main URL routing
β βββ asgi.py # ASGI configuration
β βββ celery.py # Celery configuration
β βββ wsgi.py # WSGI configuration
β βββ middlewares/ # Custom middleware
βββ docs/ # Documentation
βββ manage.py # Django management script
βββ requirements.txt # Python dependencies
βββ Pipfile # Pipenv dependencies
βββ Dockerfile # Docker configuration
βββ docker-compose.yml # Docker services configuration
βββ Makefile # Common commands
βββ .dockerignore # Docker ignore rules
- accounts/: Handles user authentication, registration, and profile management
- bookings/: Manages room reservations, availability, and booking operations
- chat/: Implements real-time messaging using WebSockets
- favorites/: Manages user's saved hotels and rooms
- hotels/: Core hotel management functionality
- rooms/: Room type management and availability system
- utils/: Shared utilities and helper functions
- logging/: Centralized logging configuration
- hotelhub/: Project configuration and settings
- Build and start containers
docker-compose up --build- Run migrations
docker-compose exec web python manage.py migrate- Create superuser
docker-compose exec web python manage.py createsuperuser-
Django 5.1.8
- Django REST Framework for API development
- Django Channels for WebSocket support
- Django Celery Beat for scheduled tasks
- Django Debug Toolbar for development
- Django CORS Headers for cross-origin requests
-
Database
- PostgreSQL 15+ for production
- SQLite for development
- Redis for caching and message broker
- Elasticsearch for advanced search functionality
-
Task Queue
- Celery for asynchronous tasks
- Redis as message broker
- Flower for monitoring Celery tasks
-
Search
- Elasticsearch 8.0+ for full-text search
- Django Elasticsearch DSL for integration
-
Code Quality
- Black for code formatting
- Flake8 for linting
- isort for import sorting
- mypy for type checking
-
Testing
- pytest for testing framework
- pytest-django for Django integration
- coverage for code coverage
- factory-boy for test factories
-
Documentation
- DRF Spectacular for API documentation
- Sphinx for project documentation
- Swagger/OpenAPI for API specification
- Structured logging with JSON format
- Different log levels for development and production
- Log rotation and file management
- Integration with monitoring services
- Django Debug Toolbar for development
- Prometheus metrics
- Grafana dashboards
- Error tracking with Sentry
- JWT-based authentication
- Rate limiting for API endpoints
- CORS protection
- CSRF protection
- Password hashing with Argon2
- Secure session management
- Input validation and sanitization
- SQL injection protection
- XSS protection