Flask Travel Booking System is a web application built with the Flask framework. This system allows users to book bus, train, or flight tickets seamlessly. It is powered by a local MySQL database and features email integration for booking confirmations. Perfect for travelers seeking a user-friendly platform for their booking needs!
- User Signup: Securely register with your username, email, and password.
- Bus, Train, and Flight Booking: Book tickets for your desired travel mode, including all required details such as departure, destination, date, and seating/class type.
- Database Integration: MySQL database to store and manage user information and bookings.
- Email Notifications: Automatic email confirmation of bookings to enhance user experience.
- Backend Framework: Flask (Python)
- Database: MySQL
- Email Integration: SMTP for email notifications
- Frontend: HTML & Jinja2 Templates
- Security: Passwords hashed using Werkzeug's
generate_password_hash
The application uses the following MySQL tables:
| Column Name | Data Type | Description |
|---|---|---|
| id | INT | Primary Key (Auto Increment) |
| username | VARCHAR(50) | Username of the user |
| VARCHAR(100) | User's email (unique) | |
| password | VARCHAR(255) | Hashed password |
| created_at | TIMESTAMP | Timestamp of account creation |
| Column Name | Data Type | Description |
|---|---|---|
| id | INT | Primary Key (Auto Increment) |
| departure | VARCHAR(100) | Departure location |
| destination | VARCHAR(100) | Destination location |
| date | DATE | Travel date |
| seating_type | VARCHAR(50) | Type of seating |
| created_at | TIMESTAMP | Timestamp of booking creation |
| Column Name | Data Type | Description |
|---|---|---|
| id | INT | Primary Key (Auto Increment) |
| departure | VARCHAR(100) | Departure location |
| destination | VARCHAR(100) | Destination location |
| date | DATE | Travel date |
| class_type | VARCHAR(50) | Type of train class |
| created_at | TIMESTAMP | Timestamp of booking creation |
| Column Name | Data Type | Description |
|---|---|---|
| id | INT | Primary Key (Auto Increment) |
| departure | VARCHAR(100) | Departure location |
| destination | VARCHAR(100) | Destination location |
| date | DATE | Travel date |
| passengers | INT | Number of passengers |
| seating_type | VARCHAR(50) | Type of seating |
| created_at | TIMESTAMP | Timestamp of booking creation |
-
User Signup:
- Users register an account with their email, username, and password.
- Passwords are hashed for security.
-
Booking Process:
- Users can book tickets for bus, train, or flights by providing required details (departure, destination, date, etc.).
- Booking details are securely stored in the MySQL database.
-
Email Notifications:
- After completing a booking, the user receives a confirmation email with booking details.
-
Clone the repository:
git clone https://github.com/your_username/travel_booking.git cd travel_booking -
Install dependencies:
pip install -r requirements.txt
-
Configure the database:
- Create a MySQL database with the required tables mentioned in the schema above.
- Update the
Configclass in yourconfig.pyfile with your MySQL credentials.
-
Run the Flask application:
python app.py
-
Access the application:
- Open your browser and navigate to
http://127.0.0.1:5000.
- Open your browser and navigate to
To enable email notifications:
-
Update the SMTP details in your
Configclass inconfig.py:MAIL_SERVER = 'smtp.your-email-provider.com' MAIL_PORT = 587 MAIL_USERNAME = 'your-email@example.com' MAIL_PASSWORD = 'your-app-password' MAIL_USE_TLS = True
-
Replace placeholders with your email provider's SMTP settings.
Want to make this project even better? Contributions are welcome! Fork the repository, make your changes, and submit a pull request. Let’s build something amazing together!
This project is licensed under the MIT License.