Automated Action 2de9589e3d Initial Travel App Backend Implementation
- FastAPI application with user management, destinations, and trip planning
- SQLite database with SQLAlchemy ORM
- Database models for Users, Destinations, and Trips
- Pydantic schemas for request/response validation
- Full CRUD API endpoints for all resources
- Alembic migrations setup
- Health check endpoint
- CORS configuration for development
- Comprehensive documentation and README
2025-06-20 01:25:27 +00:00
2025-06-20 01:19:50 +00:00

Travel App Backend

A FastAPI-based backend application for a travel planning and management system.

Features

  • User Management: Create and manage user accounts
  • Destination Management: Add, update, and browse travel destinations
  • Trip Planning: Create and manage travel trips with destinations, dates, and budgets
  • RESTful API: Full CRUD operations for all resources
  • Database Integration: SQLite database with SQLAlchemy ORM
  • API Documentation: Automatic OpenAPI documentation

Tech Stack

  • Framework: FastAPI
  • Database: SQLite
  • ORM: SQLAlchemy
  • Migrations: Alembic
  • Validation: Pydantic
  • Server: Uvicorn

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Run database migrations:
alembic upgrade head
  1. Start the server:
uvicorn main:app --reload

The API will be available at http://localhost:8000

API Documentation

API Endpoints

Root

  • GET / - API information and links
  • GET /health - Health check endpoint

Users

  • GET /api/users/ - List all users
  • GET /api/users/{user_id} - Get user by ID
  • POST /api/users/ - Create new user
  • PUT /api/users/{user_id} - Update user

Destinations

  • GET /api/destinations/ - List all destinations
  • GET /api/destinations/{destination_id} - Get destination by ID
  • POST /api/destinations/ - Create new destination
  • PUT /api/destinations/{destination_id} - Update destination
  • DELETE /api/destinations/{destination_id} - Delete destination

Trips

  • GET /api/trips/ - List all trips
  • GET /api/trips/{trip_id} - Get trip by ID
  • GET /api/trips/user/{user_id} - Get trips for specific user
  • POST /api/trips/ - Create new trip
  • PUT /api/trips/{trip_id} - Update trip
  • DELETE /api/trips/{trip_id} - Delete trip

Database Schema

Users

  • id: Primary key
  • email: Unique email address
  • full_name: User's full name
  • hashed_password: Encrypted password
  • is_active: Account status
  • created_at: Account creation timestamp
  • updated_at: Last update timestamp

Destinations

  • id: Primary key
  • name: Destination name
  • country: Country name
  • city: City name
  • description: Destination description
  • latitude: GPS latitude
  • longitude: GPS longitude
  • rating: Destination rating (0-5)
  • image_url: Destination image URL
  • created_at: Creation timestamp
  • updated_at: Last update timestamp

Trips

  • id: Primary key
  • title: Trip title
  • description: Trip description
  • user_id: Foreign key to Users table
  • destination_id: Foreign key to Destinations table
  • start_date: Trip start date
  • end_date: Trip end date
  • budget: Trip budget
  • status: Trip status (planned, ongoing, completed, cancelled)
  • created_at: Creation timestamp
  • updated_at: Last update timestamp

Development

Running with Ruff

ruff check .
ruff format .

Database Migrations

# Create new migration
alembic revision --autogenerate -m "Description"

# Apply migrations
alembic upgrade head

# Rollback migration
alembic downgrade -1

Storage

The application uses /app/storage/db/ directory for SQLite database storage.

CORS Configuration

The API is configured to allow all origins (*) for development purposes.

Description
Project: Travel App Backend
Readme 40 KiB
Languages
Python 97.4%
Mako 2.6%