
- 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
92 lines
2.6 KiB
Markdown
92 lines
2.6 KiB
Markdown
# 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:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. Run database migrations:
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
3. Start the application:
|
|
```bash
|
|
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:
|
|
|
|
```bash
|
|
ruff check .
|
|
ruff format .
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- API Documentation: http://localhost:8000/docs
|
|
- Alternative Documentation: http://localhost:8000/redoc
|
|
- OpenAPI JSON: http://localhost:8000/openapi.json
|