An open API service indexing awesome lists of open source software.

https://github.com/solomonkassa/hotel_reservation

๐Ÿจ Hotel Reservation System A comprehensive, production-ready Django hotel booking application with full reservation management, user authentication, payment processing, and admin dashboard.
https://github.com/solomonkassa/hotel_reservation

api backend django hotel-booking html5 jinja2

Last synced: 3 months ago
JSON representation

๐Ÿจ Hotel Reservation System A comprehensive, production-ready Django hotel booking application with full reservation management, user authentication, payment processing, and admin dashboard.

Awesome Lists containing this project

README

          

# ๐Ÿจ Hotel Reservation System

A comprehensive, production-ready Django hotel booking application with full reservation management, user authentication, payment processing, and admin dashboard.

## โœจ Features

### ๐Ÿจ Hotel Management
- **Hotel Listings**: View hotels with detailed information, amenities, and images
- **Room Types**: Multiple room categories (Single, Double, Suite, Deluxe, Family)
- **Detailed Views**: Hotel descriptions, images, amenities, and star ratings
- **Search & Filters**: Filter by location, amenities, hotel type, and price range
- **Reviews & Ratings**: User reviews and rating system for hotels

### ๐Ÿ“… Booking System
- **Availability Check**: Real-time room availability checking
- **Multi-night Stays**: Flexible date selection with pricing calculation
- **Guest Management**: Capture guest information and special requests
- **Booking Modifications**: View, modify, and cancel reservations
- **Payment Integration**: Secure payment processing with multiple methods

### ๐Ÿ‘ค User Features
- **User Registration & Authentication**: Secure sign-up/login system
- **User Profiles**: Personal information and booking history
- **Dashboard**: View upcoming and past reservations
- **Profile Management**: Edit personal details and preferences

### ๐Ÿ’ฐ Payment Processing
- **Multiple Payment Methods**: Credit/Debit cards, PayPal, bank transfer
- **Secure Transactions**: Payment status tracking and history
- **Tax Calculation**: Automated tax and fee calculations
- **Receipt Generation**: Detailed booking confirmation and invoices

### ๐Ÿ› ๏ธ Admin Features
- **Admin Dashboard**: Complete hotel and booking management
- **Room Management**: Add/remove rooms, update pricing and availability
- **Booking Oversight**: View, confirm, or cancel any reservation
- **User Management**: Manage user accounts and permissions
- **Reporting**: Booking analytics and revenue reports

## ๐Ÿš€ Quick Start

### Prerequisites
- Python 3.8+
- Django 4.x
- pip (Python package manager)
- Virtual environment (recommended)

### Installation

1. **Clone the Repository**
```bash
git clone https://github.com/yourusername/hotel-reservation-system.git
cd hotel-reservation-system
```

2. **Create Virtual Environment**
```bash
# Windows
python -m venv venv
venv\Scripts\activate

# Mac/Linux
python3 -m venv venv
source venv/bin/activate
```

3. **Install Dependencies**
```bash
pip install -r requirements.txt
```

4. **Configure Database**
```bash
python manage.py makemigrations hotel accounts booking
python manage.py migrate
```

5. **Create Superuser**
```bash
python manage.py createsuperuser
```

6. **Collect Static Files**
```bash
python manage.py collectstatic
```

7. **Run Development Server**
```bash
python manage.py runserver
```

8. **Access the Application**
- Main site: http://localhost:8000
- Admin panel: http://localhost:8000/admin

## ๐Ÿ“ Project Structure

```
hotel_reservation/
โ”œโ”€โ”€ accounts/ # User authentication and profiles
โ”œโ”€โ”€ booking/ # Reservation and payment system
โ”œโ”€โ”€ hotel/ # Hotel listings and room management
โ”œโ”€โ”€ media/ # Uploaded images
โ”œโ”€โ”€ static/ # CSS, JavaScript, images
โ”œโ”€โ”€ templates/ # HTML templates
โ”œโ”€โ”€ hotel_reservation/ # Project configuration
โ””โ”€โ”€ manage.py # Django management script
```

## ๐Ÿ—„๏ธ Database Models

### Core Models
- **Hotel**: Hotel information, amenities, and location
- **RoomType**: Room categories with pricing and capacity
- **Reservation**: Booking details, dates, and status
- **Payment**: Transaction records and payment history
- **UserProfile**: Extended user information
- **Review**: Hotel ratings and comments

## ๐Ÿ”ง Configuration

### Environment Variables
Create a `.env` file in the project root:
```env
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
DATABASE_URL=postgres://user:password@localhost/hotel_db
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
```

### Database Configuration
Default SQLite for development. For production, update `settings.py`:
```python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'hotel_db',
'USER': 'db_user',
'PASSWORD': 'db_password',
'HOST': 'localhost',
'PORT': '5432',
}
}
```

### Email Configuration (Production)
```python
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
DEFAULT_FROM_EMAIL = 'noreply@hotelreservation.com'
```

## ๐Ÿงช Testing

Run the test suite:
```bash
# Run all tests
python manage.py test

# Run specific app tests
python manage.py test hotel
python manage.py test booking
python manage.py test accounts

# Run with coverage
coverage run manage.py test
coverage report
coverage html # Generate HTML report
```

## ๐Ÿ”’ Security Features

- **CSRF Protection**: Enabled on all forms
- **XSS Protection**: Built-in Django security
- **SQL Injection Prevention**: Django ORM protection
- **Password Hashing**: PBKDF2 with SHA256
- **Session Security**: Secure session cookies
- **HTTPS Ready**: Configured for production SSL

## ๐Ÿ“ฑ API Endpoints (Optional Extension)

The system can be extended with REST API:
```python
# Example API endpoints
/api/hotels/ # List all hotels
/api/hotels/{id}/ # Hotel details
/api/rooms/available/ # Check availability
/api/bookings/ # Create/view bookings
/api/users/profile/ # User profile
```

## ๐Ÿš€ Deployment

### Using Docker
```dockerfile
# Dockerfile
FROM python:3.9
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
RUN python manage.py collectstatic --noinput
CMD ["gunicorn", "hotel_reservation.wsgi:application", "--bind", "0.0.0.0:8000"]
```

### Deploy to Heroku
```bash
# Create heroku app
heroku create hotel-reservation-app

# Add PostgreSQL
heroku addons:create heroku-postgresql:hobby-dev

# Configure environment
heroku config:set SECRET_KEY=your-secret-key
heroku config:set DEBUG=False

# Deploy
git push heroku main

# Run migrations
heroku run python manage.py migrate
```

### Deploy to AWS (Elastic Beanstalk)
```bash
# Install EB CLI
pip install awsebcli

# Initialize
eb init -p python-3.9 hotel-reservation

# Create environment
eb create hotel-reservation-env

# Deploy
eb deploy
```

## ๐ŸŽจ Customization

### Adding New Features
1. **Add New Hotel Amenities**: Modify `Hotel` model in `hotel/models.py`
2. **New Room Types**: Add to `ROOM_TYPES` choices in `RoomType` model
3. **Additional Payment Methods**: Extend `Payment` model and forms
4. **Email Templates**: Customize templates in `templates/emails/`

### Styling
- Bootstrap 5 for responsive design
- Custom CSS in `static/css/`
- JavaScript enhancements in `static/js/`
- Easy theming with CSS variables

## ๐Ÿ“Š Admin Features

Access the admin panel at `/admin`:
- **Manage Hotels**: Add/update hotel information
- **Room Management**: Control room availability and pricing
- **Booking Oversight**: View and manage all reservations
- **User Management**: Administer user accounts
- **Payment Tracking**: Monitor all transactions

## ๐Ÿ”ง Management Commands

```bash
# Generate sample data
python manage.py generate_sample_data

# Export bookings to CSV
python manage.py export_bookings --format=csv

# Clean up old reservations
python manage.py cleanup_old_reservations

# Send booking reminders
python manage.py send_booking_reminders
```

## ๐Ÿค Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Open a Pull Request

## ๐Ÿ“ Code Style

- Follow PEP 8 guidelines
- Use Django's coding style
- Document functions and classes
- Write tests for new features
- Keep migrations minimal

## ๐Ÿงช Testing Suite

```bash
# Run specific test types
python manage.py test --tag=unit
python manage.py test --tag=integration
python manage.py test --tag=ui

# Generate test coverage
coverage run --source='.' manage.py test
coverage report
```

## ๐Ÿšจ Troubleshooting

### Common Issues

1. **Database Migration Errors**
```bash
# Reset migrations
python manage.py migrate --fake hotel zero
python manage.py migrate hotel
```

2. **Static Files Not Loading**
```bash
# Collect static files
python manage.py collectstatic --clear
```

3. **Media Files Not Showing**
- Check `MEDIA_URL` and `MEDIA_ROOT` in settings
- Ensure `DEBUG=True` or configure proper media serving

### Logs
Check application logs:
```bash
# View Django logs
tail -f logs/django.log

# View error logs
python manage.py check --deploy
```

## ๐Ÿ“ž Support

- **Documentation**: [Read the Docs](https://hotel-reservation.readthedocs.io)
- **Issues**: [GitHub Issues](https://github.com/yourusername/hotel-reservation-system/issues)
- **Email**: support@hotelreservation.com

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- Django Framework
- Bootstrap 5
- Font Awesome Icons
- All contributors and testers

## ๐Ÿ“ˆ Future Enhancements

- [ ] Mobile application (React Native)
- [ ] Real-time chat support
- [ ] AI-powered room recommendations
- [ ] Integration with travel APIs
- [ ] Loyalty program with points
- [ ] Multi-language support
- [ ] Advanced analytics dashboard
- [ ] Voice search capabilities
- [ ] Virtual tour integration
- [ ] Social media login options