This project is a travel itinerary platform that offers curated travel experiences designed by influencers. The backend is built using Django and Django REST framework.
- API endpoints for user registration, login, trip viewing, cart management, and checkout.
- Integration with a database to store and retrieve travel data.
- Authentication and authorization for user accounts.
- Clone the repository:
git clone https://github.com/Piyush-sri11/Travel_website.git
- Set up a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
- Install dependencies:
pip install -r requirements.txt
- Navigate to the backend directory:
cd travel - Apply database migrations:
python manage.py migrate
- Start the development server:
python manage.py runserver
This project is a travel itinerary platform that offers curated travel experiences designed by influencers. The frontend is built using React and Tailwind CSS.
- Navigation bar with links to Home, Dashboard, Cart, Login, and Register.
- Header section with a background image and search input.
- Display of upcoming popular explorations with details such as title, tags, info, price, curator, and available spots.
- Responsive design with Tailwind CSS.
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Start the development server:
npm start
- Ensure backend is running
- Navigate to
http://localhost:3000to view the application.
Endpoint: /register/
Method: POST
Description: This endpoint allows you to register a new user.
Request Body:
{
"email": "user@example.com",
"password": "password123",
"first_name": "John",
"last_name": "Doe"
}Response Body:
{
"message": "User registered successfully",
"user_id": 1
}Endpoint: /login/
Method: POST
Description: This endpoint allows you to login user.
Request Body:
{
"email": "user@example.com",
"password": "password123"
}Response Body:
{
"message": "Login successful",
"refresh": "string token",
"access": "string token"
}Endpoint: /trip/
Method: GET
Description: This endpoint allows you to view different trips available. Its landing page.
Request Body:
{
}Response Body:
[
{
"id": 1, //trip id
"organizer": {
"id": 2, //user id
"first_name": "Johny",
"last_name": "Walker"
},
"name": "Kasol", //trip name
"description": "Brownie",
"start_date": "2025-01-01",
"end_date": "2025-01-10",
"price": "3999.99",
"total_slots": 12,
"available_slots": 6,
"cancellation_policy": ""
},
{
"id": 3,
"organizer": {
"id": 2,
"first_name": "Johny",
"last_name": "Walker"
},
"name": "Jaipur",
"description": "Padharo mhare desh",
"start_date": "2025-02-10",
"end_date": "2025-02-15",
"price": "2999.99",
"total_slots": 12,
"available_slots": 12,
"cancellation_policy": ""
}
]Endpoint: /logout/
Method: POST
Description: This endpoint allows you to logout user.
Request Body:
{
"refresh": "string token"
}Response Body:
{
"message": "Logout successful"
}Endpoint: /cart/
Method: GET
Description: This endpoint allows you to view the items in the cart.
Request Headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
}Response Body:
[
{
"trip_id": 1,
"name": "Kasol",
"price": "3999.99",
"quantity": 2
},
{
"trip_id": 3,
"name": "Jaipur",
"price": "2999.99",
"quantity": 1
}
]Endpoint: /cart/
Method: POST
Description: This endpoint allows you to add a trip to the cart.
Request Headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
"id": 1, // trip id required
"persons": 5 // no persons
}Response Body:
{
"message": "Trip added to cart successfully",
"cart_item_id": 1
}Endpoint: /cart/
Method: DELETE
Description: This endpoint allows you to remove a trip from the cart.
Request Headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
"id": 1 //cart item id
}Response Body:
{
"message": "Trip removed from cart successfully"
}Endpoint: /cart/
Method: PATCH
Description: This endpoint allows you to update the quantity of a trip in the cart.
Request Headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
"id": 1, //cart item id
"persons": 3
}Response Body:
{
"message": "Cart item updated successfully"
}Checkout
Endpoint: /checkout/
Method: POST
Description: This endpoint allows you to proceed to payment and book the trips in the cart.
Request headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Response body:
{
"message": "Booking successful"
}Cancel Booking
Endpoint: /cancel-booking/
Method: POST
Description: This endpoint allows you to cancel a booking.
Request headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
"booking_id": 1
}Response body:
{
"message": "Booking cancelled successfully"
}View Bookings
Endpoint: /view-booking/
Method: GET
Description: This endpoint allows you to view your bookings.
Request headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
}Response body:
{
[
{
"id": 1, //booking id
"trip": {
"id": 1, //trip id
"name": "Kasol",
"description": "Brownie",
"start_date": "2025-01-01",
"end_date": "2025-01-10",
"price": "3999.99",
"total_slots": 12,
"available_slots": 6,
"cancellation_policy": ""
},
"user": 6, //user id
"booking_date": "2024-12-20T21:11:00Z",
"total_persons": 2,
"total_price": "7999.98",
"status": "CONFIRMED",
"refund_amount": null
}
]
}Endpoint: /exist-org/
Method: GET
Description: This endpoint allows you to check if an organizer exists.
Request Headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Response Body:
{
"message": "You are now registered as an organizer"
}Register as Organizer
Endpoint: /organizer/register/
Method: POST
Description: This endpoint allows you to register as an organizer.
Request Body:
{
"email": "organizer@example.com",
"password": "password123",
"first_name": "John",
"last_name": "Doe",
"is_organizer": true
}Response body:
{
"user_id": 6
}Add Trip (Organizer Only)
Endpoint: /org-trips/
Method: POST
Description: This endpoint allows organizers to add new trips.
Request headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
"name": "Trip Name",
"description": "Trip Description",
"start_date": "2025-01-01",
"end_date": "2025-01-10",
"price": "3999.99",
"total_slots": 12,
"available_slots": 12,
"cancellation_policy": "Cancellation Policy"
}Response body:
{
"trip_id": 1
}View Organizer Trips (Organizer Only)
Endpoint: /org-trips/
Method: GET
Description: This endpoint allows organizers to view their trips.
Request headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Response body:
{
[
{
"id": 1, //trip id
"name": "Trip Name",
"description": "Trip Description",
"start_date": "2025-01-01",
"end_date": "2025-01-10",
"price": "3999.99",
"total_slots": 12,
"available_slots": 12,
"cancellation_policy": "Cancellation Policy"
}
]
}Delete Trip (Organizer Only)
Endpoint: /org-trips/
Method: DELETE
Description: This endpoint allows organizers to delete a trip.
Request headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
"id": 1 //trip id
}Response body:
{
"message": "Trip deleted successfully"
}Update Trip (Organizer Only)
Endpoint: /org-trips/
Method: PATCH
Description: This endpoint allows organizers to update a trip.
Request headers:
{
"Authorization": "Bearer token",
"Content-Type": "application/json"
}Request Body:
{
{
"id": 1, //trip id required
"name": "Updated Trip Name",
"description": "Updated Trip Description",
"start_date": "2025-01-01",
"end_date": "2025-01-10",
"price": "3999.99",
"total_slots": 12,
"available_slots": 12,
"cancellation_policy": "Updated Cancellation Policy"
}
}Response body:
{
"trip_id": 1
}