Skip to content

fuseai-fellowship/Travya---Agentic-AI-Powered-Travel-Companion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Travya - AI-Powered Travel Companion

License: MIT FastAPI React TypeScript

Travya is an intelligent travel planning and booking platform powered by AI agents. Plan trips, discover destinations, book flights, and manage your travel experiences with ease.

🌟 Overview

Travya combines the power of AI agents with modern web technologies to provide a comprehensive travel planning experience. The platform features multi-agent AI systems for intelligent trip planning, real-time booking capabilities, and a beautiful, intuitive interface.

Key Features

  • πŸ€– AI-Powered Trip Planning - Multi-agent system for intelligent itinerary generation
  • πŸ—ΊοΈ Real-Time Mapping - Interactive maps with location parsing and visualization
  • πŸ“Έ Photo Gallery - Automated photo collection from web scraping
  • πŸ’¬ AI Chat Assistant - Conversational interface for travel queries
  • πŸ“ Travel Notes - Sticky-note style notes for trip reminders
  • πŸ” Secure Authentication - JWT-based auth with user management
  • πŸ“Š Dashboard - Overview of trips, conversations, and travel statistics
  • 🎨 Modern UI - Apple-inspired design with dark mode support

πŸ—οΈ Architecture

Travya follows a microservices architecture with clear separation of concerns:

flowchart TD
    %% FRONTEND
    subgraph F["Frontend (React)"]
        F1["β€’ TanStack Router for routing"]
        F2["β€’ TanStack Query for data fetching"]
        F3["β€’ Chakra UI for components"]
    end

    %% BACKEND
    subgraph B["Backend (FastAPI)"]
        subgraph B1["AI Agents"]
            B1a["β€’ Research"]
            B1b["β€’ Planner"]
            B1c["β€’ Booker"]
        end

        subgraph B2["API Routes"]
            B2a["β€’ Travel"]
            B2b["β€’ Chat"]
            B2c["β€’ Users"]
        end

        subgraph B3["Services"]
            B3a["β€’ RAG"]
            B3b["β€’ Documents"]
            B3c["β€’ Images"]
        end
    end

    %% DATABASES
    subgraph DB1["PostgreSQL"]
        DB1a["β€’ User Data"]
        DB1b["β€’ Trips"]
        DB1c["β€’ Conversations"]
    end

    subgraph DB2["Redis"]
        DB2a["β€’ Sessions"]
        DB2b["β€’ Cache"]
        DB2c["β€’ Memory"]
    end

    %% CONNECTIONS
    F --> B
    B --> DB1
    B --> DB2
Loading

πŸš€ Quick Start

Prerequisites

  • Docker Desktop (recommended for quick setup)
  • Node.js 18+ and Python 3.11+ (for local development)
  • Git

Installation & Running

# 1. Clone the repository
git clone <repository-url>
cd travya

# 2. Set up environment variables
cp backend/env.example .env
# Edit .env with your configuration (API keys, secrets, etc.)

# 3. Start all services
docker compose up -d --build

# 4. Verify services are running
docker compose ps

# 5. Access the application
# Frontend:  http://localhost:5173
# Backend API: http://localhost:8000
# API Docs: http://localhost:8000/docs
# Database Admin: http://localhost:8080

The application will be accessible at:

πŸ“ Project Structure

travya/
β”œβ”€β”€ backend/                    # FastAPI backend application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ agents/            # AI agent system
β”‚   β”‚   β”‚   β”œβ”€β”€ base_agent.py          # Base agent class
β”‚   β”‚   β”‚   β”œβ”€β”€ orchestrator.py       # Agent coordinator
β”‚   β”‚   β”‚   β”œβ”€β”€ research.py           # Research agent
β”‚   β”‚   β”‚   β”œβ”€β”€ planner.py            # Planning agent
β”‚   β”‚   β”‚   β”œβ”€β”€ booker.py              # Booking agent
β”‚   β”‚   β”‚   β”œβ”€β”€ rag_system.py         # RAG implementation
β”‚   β”‚   β”‚   └── tools.py              # Agent tools
β”‚   β”‚   β”œβ”€β”€ api/               # API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ routes/        # Route handlers
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ai_travel.py      # AI travel planning
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ conversations.py  # Chat endpoints
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ travel.py          # Trip management
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ map_parser.py      # Map parsing
β”‚   β”‚   β”‚   β”‚   └── photo_gallery.py   # Photo management
β”‚   β”‚   β”‚   └── main.py        # API router setup
β”‚   β”‚   β”œβ”€β”€ core/              # Core configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ config.py       # Settings management
β”‚   β”‚   β”‚   β”œβ”€β”€ db.py           # Database connection
β”‚   β”‚   β”‚   β”œβ”€β”€ llm.py          # LLM integration
β”‚   β”‚   β”‚   └── security.py     # Auth utilities
β”‚   β”‚   β”œβ”€β”€ services/          # Business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ vector_rag.py           # Vector database
β”‚   β”‚   β”‚   β”œβ”€β”€ redis_cache.py          # Caching layer
β”‚   β”‚   β”‚   β”œβ”€β”€ document_storage.py     # File storage
β”‚   β”‚   β”‚   β”œβ”€β”€ image_scraping.py       # Image collection
β”‚   β”‚   β”‚   β”œβ”€β”€ itinerary_parser.py     # Itinerary parsing
β”‚   β”‚   β”‚   β”œβ”€β”€ photo_gallery.py        # Gallery management
β”‚   β”‚   β”‚   └── map_parser.py           # Map processing
β”‚   β”‚   β”œβ”€β”€ alembic/           # Database migrations
β”‚   β”‚   β”œβ”€β”€ models.py          # SQLModel definitions
β”‚   β”‚   └── crud.py            # CRUD operations
β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”œβ”€β”€ pyproject.toml
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ frontend/                   # React frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ Common/        # Shared components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.tsx         # Top navigation
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Sidebar.tsx        # Side navigation
β”‚   β”‚   β”‚   β”‚   └── SidebarItems.tsx   # Menu items
β”‚   β”‚   β”‚   β”œβ”€β”€ Items/          # Travel Notes
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AddItem.tsx        # Create note
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ EditItem.tsx       # Edit note
β”‚   β”‚   β”‚   β”‚   └── DeleteItem.tsx     # Delete note
β”‚   β”‚   β”‚   β”œβ”€β”€ MapParserComponent.tsx # Map visualization
β”‚   β”‚   β”‚   β”œβ”€β”€ PhotoGallery.tsx       # Photo display
β”‚   β”‚   β”‚   └── Typewriter.tsx        # Typing effect
β”‚   β”‚   β”œβ”€β”€ routes/            # Application routes
β”‚   β”‚   β”‚   β”œβ”€β”€ _layout.tsx           # Main layout
β”‚   β”‚   β”‚   β”œβ”€β”€ _layout/index.tsx     # Dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ _layout/chat.tsx      # AI Chat
β”‚   β”‚   β”‚   β”œβ”€β”€ _layout/plan-trip.tsx # Trip planning
β”‚   β”‚   β”‚   β”œβ”€β”€ _layout/trips.tsx     # Trip list
β”‚   β”‚   β”‚   β”œβ”€β”€ _layout/settings.tsx  # User settings
β”‚   β”‚   β”‚   └── _layout/items.tsx     # Travel Notes
β”‚   β”‚   β”œβ”€β”€ contexts/          # React contexts
β”‚   β”‚   β”‚   β”œβ”€β”€ AuthContext.tsx       # Auth state
β”‚   β”‚   β”‚   β”œβ”€β”€ TravelContext.tsx     # Travel data
β”‚   β”‚   β”‚   └── SidebarContext.tsx    # UI state
β”‚   β”‚   β”œβ”€β”€ hooks/             # Custom hooks
β”‚   β”‚   β”œβ”€β”€ client/            # Generated API client
β”‚   β”‚   └── main.tsx           # App entry point
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   └── assets/
β”‚   β”‚       └── images/       # Static assets (logos)
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── package.json
β”‚
β”œβ”€β”€ docs/                       # Documentation
β”‚   β”œβ”€β”€ ai-agents/             # AI agents documentation
β”‚   β”œβ”€β”€ backend-api/           # Backend API docs
β”‚   β”œβ”€β”€ frontend/              # Frontend docs
β”‚   β”œβ”€β”€ database/              # Database schema
β”‚   β”œβ”€β”€ deployment/            # Deployment guides
β”‚   └── external-apis/         # API integrations
β”‚
β”œβ”€β”€ scripts/                    # Build and deployment scripts
β”œβ”€β”€ docker-compose.yml          # Docker Compose configuration
β”œβ”€β”€ .env                        # Environment variables (gitignored)
└── README.md                   # This file

🎯 Core Features & Implementation

1. AI-Powered Trip Planning

How it works:

  1. User creates a trip via /plan-trip page
  2. Request flows: Frontend β†’ POST /api/v1/travel/plan β†’ AI Travel Router
  3. Orchestrator agent receives the request and delegates to specialized agents:
    • Research Agent: Queries knowledge base and external APIs (Google Places)
    • Planner Agent: Generates structured itinerary using LLM
    • Booker Agent: Handles booking operations (Flights, Hotels)
  4. Response returned: Complete trip plan with itineraries, bookings, and recommendations

Code Flow:

frontend/src/routes/_layout/plan-trip.tsx
  β†’ API call: /api/v1/travel/plan
    β†’ backend/app/api/routes/ai_travel.py
      β†’ Agent orchestration: backend/app/agents/orchestrator.py
        β†’ Research: backend/app/agents/research.py
        β†’ Planning: backend/app/agents/planner.py
        β†’ Booking: backend/app/agents/booker.py

2. Interactive AI Chat

How it works:

  1. User sends message via chat interface
  2. Message stored in conversation context
  3. AI processes query and provides travel recommendations
  4. Context maintained across conversation history
  5. Real-time updates with streaming responses

Code Flow:

frontend/src/routes/_layout/chat.tsx
  β†’ API call: /api/v1/conversations/send
    β†’ backend/app/api/routes/conversations.py
      β†’ LLM processing: backend/app/core/llm.py
      β†’ Context retrieval: backend/app/services/vector_rag.py
      β†’ Response streaming back to frontend

3. Travel Notes (Sticky Notes)

How it works:

  1. User creates a note on /items page
  2. Note stored in PostgreSQL database
  3. Visual display with colorful sticky-note design
  4. Edit/Delete actions with confirmation modals
  5. Notes can contain travel reminders, checklists, ideas

Code Flow:

frontend/src/routes/_layout/items.tsx
  β†’ API call: /api/v1/items/
    β†’ backend/app/api/routes/items.py
      β†’ CRUD operations: backend/app/crud.py
      β†’ Database: backend/app/models.py (Item model)

4. Map Parsing & Visualization

How it works:

  1. User uploads image with travel map/locations
  2. Image processed via OCR and computer vision
  3. Locations extracted and geocoded
  4. Interactive map displayed with markers
  5. Clickable markers show location details

Code Flow:

frontend/src/components/MapParserComponent.tsx
  β†’ Upload image
    β†’ backend/app/api/routes/map_parser.py
      β†’ OCR processing: backend/app/services/map_parser.py
      β†’ Geocoding: External API (Google Maps)
      β†’ Data returned for visualization

5. Photo Gallery

How it works:

  1. Travellers share photos from their trips
  2. Auto-collected via web scraping service
  3. Organized by trip and location
  4. Displayed in gallery with captions
  5. Search and filter capabilities

Code Flow:

frontend/src/components/PhotoGallery.tsx
  β†’ API call: /api/v1/photo-gallery/
    β†’ backend/app/api/routes/photo_gallery.py
      β†’ Image collection: backend/app/services/image_scraping.py
      β†’ Display in UI

πŸ› οΈ Development Guide

Local Development Setup

Backend Development

# Navigate to backend
cd backend

# Install dependencies using uv (recommended)
uv sync
source .venv/bin/activate

# Or using pip
pip install -r requirements.txt

# Set up environment
cp env.example .env
# Edit .env with your API keys

# Run database migrations
alembic upgrade head

# Start development server
fastapi run app/main.py --reload

Frontend Development

# Navigate to frontend
cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

# Frontend will be available at http://localhost:5173

Database Migrations

# Create a new migration
docker compose exec backend alembic revision --autogenerate -m "Your description"

# Apply migrations
docker compose exec backend alembic upgrade head

# View migration history
docker compose exec backend alembic history

Running Tests

# Backend tests
docker compose exec backend pytest
docker compose exec backend pytest tests/agents/
docker compose exec backend pytest tests/api/

# Frontend tests
cd frontend
npm test

# E2E tests
npx playwright test
npx playwright test --ui  # Interactive mode

πŸ”§ Configuration

Environment Variables

Backend (.env)

# Application
PROJECT_NAME="Travya"
ENVIRONMENT=local
SECRET_KEY="your-secret-key-here"

# Database
POSTGRES_SERVER=db
POSTGRES_PORT=5432
POSTGRES_USER=travya
POSTGRES_PASSWORD=travya_password
POSTGRES_DB=travya

# Redis
REDIS_URL=redis://redis:6379/0

# AI & External APIs
OPENAI_API_KEY="sk-your-openai-key"
GOOGLE_AI_API_KEY="your-google-key"
GOOGLE_MAPS_API_KEY="your-maps-key"
AMADEUS_API_KEY="your-amadeus-key"
AMADEUS_API_SECRET="your-amadeus-secret"

# Email
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
EMAILS_FROM_EMAIL=noreply@travya.com

# Security
ACCESS_TOKEN_EXPIRE_MINUTES=11520
CORS_ORIGINS=["http://localhost:5173"]

Frontend (frontend/.env)

VITE_API_URL=http://localhost:8000

API Keys Setup

  1. OpenAI: Get API key from https://platform.openai.com
  2. Google AI: Get API key from https://makersuite.google.com
  3. Google Maps: Get API key from https://console.cloud.google.com
  4. Amadeus: Get API credentials from https://developers.amadeus.com

πŸ“š API Documentation

Interactive Documentation

Once the backend is running, access:

Key Endpoints

Authentication

  • POST /api/v1/login/access-token - Login
  • POST /api/v1/login/register - Register
  • GET /api/v1/users/me - Get current user

Travel Planning

  • POST /api/v1/travel/plan - Create trip plan
  • GET /api/v1/travel/trips - List user trips
  • GET /api/v1/travel/trips/{trip_id} - Get trip details

AI Chat

  • POST /api/v1/conversations/send - Send message
  • GET /api/v1/conversations - Get conversations

Travel Notes

  • GET /api/v1/items - List notes
  • POST /api/v1/items - Create note
  • PUT /api/v1/items/{id} - Update note
  • DELETE /api/v1/items/{id} - Delete note

πŸ§ͺ Testing

Backend Testing

# Run all tests
docker compose exec backend pytest

# Run with coverage
docker compose exec backend pytest --cov=app --cov-report=html

# Run specific test file
docker compose exec backend pytest tests/agents/test_orchestrator.py

# Run with verbose output
docker compose exec backend pytest -v

Frontend Testing

# Unit tests
cd frontend
npm test

# E2E tests
npx playwright test

# E2E tests in UI mode
npx playwright test --ui

# Run specific test
npx playwright test login.spec.ts

πŸš€ Deployment

Production Deployment

# 1. Set production environment
export ENVIRONMENT=production

# 2. Build images
docker compose -f docker-compose.prod.yml build

# 3. Start services
docker compose -f docker-compose.prod.yml up -d

# 4. Check status
docker compose -f docker-compose.prod.yml ps

Using Traefik for HTTPS

# Start with Traefik
docker compose -f docker-compose.traefik.yml up -d

πŸ“Š Monitoring & Health Checks

# Health check endpoints
curl http://localhost:8000/api/v1/health

# View logs
docker compose logs -f backend
docker compose logs -f frontend

# View specific service logs
docker compose logs -f redis
docker compose logs -f db

🀝 Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run tests: pytest && npm test
  5. Commit changes: git commit -m 'Add amazing feature'
  6. Push to branch: git push origin feature/amazing-feature
  7. Open Pull Request

Code Style

Backend (Python)

black .
isort .
flake8 .

Frontend (TypeScript/React)

npm run lint
npm run format

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

πŸ™ Acknowledgments

  • FastAPI for the excellent backend framework
  • TanStack for Router and Query
  • Chakra UI for the component library
  • The open-source community

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •