Automated Action 2cb6659b63 Add comprehensive travel app backend with FastAPI
- 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
2025-06-20 01:29:17 +00:00

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 user
  • POST /auth/login - Login and get access token
  • GET /auth/me - Get current user information

Trips

  • POST /trips/ - Create a new trip
  • GET /trips/ - Get all user trips
  • GET /trips/{trip_id} - Get specific trip
  • PUT /trips/{trip_id} - Update trip
  • DELETE /trips/{trip_id} - Delete trip
  • POST /trips/{trip_id}/itinerary - Add itinerary item
  • GET /trips/{trip_id}/itinerary - Get trip itinerary

Destinations

  • GET /destinations/ - Get all destinations (with filters)
  • POST /destinations/ - Create new destination
  • GET /destinations/{destination_id} - Get specific destination
  • PUT /destinations/{destination_id} - Update destination
  • DELETE /destinations/{destination_id} - Delete destination
  • GET /destinations/search/ - Search destinations

Bookings

  • POST /bookings/ - Create a new booking
  • GET /bookings/ - Get all user bookings (with filters)
  • GET /bookings/{booking_id} - Get specific booking
  • PUT /bookings/{booking_id} - Update booking
  • DELETE /bookings/{booking_id} - Delete booking
  • GET /bookings/trip/{trip_id} - Get all bookings for a trip

System

  • GET / - API information
  • GET /health - Health check endpoint
  • GET /docs - Interactive API documentation
  • GET /redoc - Alternative API documentation

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Run database migrations:
alembic upgrade head
  1. 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