
- User authentication with JWT tokens - Trip management with itineraries - Destination database with search functionality - Booking management for flights, hotels, car rentals, activities - SQLite database with Alembic migrations - Health monitoring endpoint - CORS enabled for all origins - Complete API documentation at /docs and /redoc - Environment variable support for SECRET_KEY Requirements for production: - Set SECRET_KEY environment variable
2.6 KiB
2.6 KiB
Travel App Backend
A comprehensive travel planning and booking API built with FastAPI, SQLAlchemy, and SQLite.
Features
- User Authentication: JWT-based authentication with registration and login
- Trip Management: Create, update, and manage travel trips with itineraries
- Destination Database: Browse and search travel destinations
- Booking Management: Handle various types of bookings (flights, hotels, car rentals, activities)
- Health Monitoring: Built-in health check endpoint
API Endpoints
Authentication
POST /auth/register
- Register a new userPOST /auth/login
- Login and get access tokenGET /auth/me
- Get current user information
Trips
POST /trips/
- Create a new tripGET /trips/
- Get all user tripsGET /trips/{trip_id}
- Get specific tripPUT /trips/{trip_id}
- Update tripDELETE /trips/{trip_id}
- Delete tripPOST /trips/{trip_id}/itinerary
- Add itinerary itemGET /trips/{trip_id}/itinerary
- Get trip itinerary
Destinations
GET /destinations/
- Get all destinations (with filters)POST /destinations/
- Create new destinationGET /destinations/{destination_id}
- Get specific destinationPUT /destinations/{destination_id}
- Update destinationDELETE /destinations/{destination_id}
- Delete destinationGET /destinations/search/
- Search destinations
Bookings
POST /bookings/
- Create a new bookingGET /bookings/
- Get all user bookings (with filters)GET /bookings/{booking_id}
- Get specific bookingPUT /bookings/{booking_id}
- Update bookingDELETE /bookings/{booking_id}
- Delete bookingGET /bookings/trip/{trip_id}
- Get all bookings for a trip
System
GET /
- API informationGET /health
- Health check endpointGET /docs
- Interactive API documentationGET /redoc
- Alternative API documentation
Installation
- Install dependencies:
pip install -r requirements.txt
- Run database migrations:
alembic upgrade head
- Start the application:
uvicorn main:app --reload
Environment Variables
Make sure to set the following environment variables:
SECRET_KEY
: JWT secret key for token encryption (required for production)
Database
The application uses SQLite database stored at /app/storage/db/db.sqlite
.
Development
The project uses Ruff for code formatting and linting. Run:
ruff check .
ruff format .
Documentation
- API Documentation: http://localhost:8000/docs
- Alternative Documentation: http://localhost:8000/redoc
- OpenAPI JSON: http://localhost:8000/openapi.json