Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI Travel Assistant

AI Travel Assistant Python React FastAPI TypeScript

Your intelligent companion for seamless travel planning

Features β€’ Demo β€’ Installation β€’ Usage β€’ API Docs β€’ Contributing


πŸ“‹ Table of Contents

🌟 Overview

AI Travel Assistant is a cutting-edge, full-stack application that revolutionizes travel planning through AI-powered natural language processing. Users can search flights, check weather forecasts, get travel summaries, and interact with the system using voice commands or text input.

Key Highlights

  • 🎀 Voice-Enabled Interface - Powered by Deepgram for accurate speech recognition
  • πŸ€– AI-Powered Conversations - Integrated with OpenRouter for intelligent responses
  • ✈️ Smart Flight Search - Real-time flight data via Amadeus API
  • 🌀️ Weather Intelligence - Accurate forecasts using OpenWeatherMap
  • 🎨 Modern UI/UX - Beautiful, responsive design with dark/light mode
  • πŸš€ High Performance - Built with modern frameworks for optimal speed

✨ Features

🎯 Core Functionality

Feature Description
Flight Search Search and compare flights using natural language queries
Weather Forecasting Get real-time weather data for any destination
AI Chat Assistant Conversational AI for travel planning and information
Voice Input Hands-free interaction with voice commands
Travel Summaries AI-generated summaries of travel articles and reviews
Multi-Modal Interaction Text, voice, or GUI-based interactions

🎨 User Experience

  • Responsive Design - Works seamlessly on desktop, tablet, and mobile
  • Dark/Light Mode - System-aware theme with manual toggle
  • Smooth Animations - Framer Motion powered transitions
  • Accessibility - WCAG 2.1 AA compliant
  • Progressive Web App - Installable on any device

πŸ” Security & Authentication

  • JWT-based authentication
  • Secure API key management
  • CORS protection
  • Rate limiting
  • Input validation and sanitization

πŸ› οΈ Tech Stack

Frontend

React 18.2          - UI Framework
TypeScript 5.2      - Type Safety
Vite 5.0            - Build Tool
Tailwind CSS 3.4    - Styling
Framer Motion       - Animations
React Query         - Data Fetching
Zustand             - State Management
React Hook Form     - Form Handling
Zod                 - Schema Validation
Lucide React        - Icons
Recharts            - Data Visualization

Backend

FastAPI 0.100+      - Web Framework
Python 3.12+        - Programming Language
SQLAlchemy          - ORM
Pydantic            - Data Validation
Uvicorn             - ASGI Server
SQLite              - Database
Httpx               - HTTP Client
Python-Jose         - JWT Handling
Passlib             - Password Hashing

External Services

OpenRouter          - AI/LLM Provider
Deepgram            - Voice Recognition
Amadeus             - Flight Data API
OpenWeatherMap      - Weather Data API

πŸ—οΈ Architecture

ai-assistant-app/
β”œβ”€β”€ ai-assistant/
β”‚   β”œβ”€β”€ frontend/              # React TypeScript Application
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ components/    # Reusable UI components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ home/      # Landing page sections
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ chat/      # Chat interface
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ flights/   # Flight search components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ weather/   # Weather widgets
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ui/        # Base UI components
β”‚   β”‚   β”‚   β”‚   └── layout/    # Layout components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom React hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ lib/           # Utilities and constants
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ types/         # TypeScript types
β”‚   β”‚   β”‚   └── styles.css     # Global styles
β”‚   β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   └── backend/               # FastAPI Python Application
β”‚       β”œβ”€β”€ app/
β”‚       β”‚   β”œβ”€β”€ api/           # API routes
β”‚       β”‚   β”‚   └── v1/        # API version 1
β”‚       β”‚   β”‚       β”œβ”€β”€ endpoints/  # Route handlers
β”‚       β”‚   β”‚       └── router.py   # API router
β”‚       β”‚   β”œβ”€β”€ core/          # Core functionality
β”‚       β”‚   β”‚   β”œβ”€β”€ config.py       # Configuration
β”‚       β”‚   β”‚   β”œβ”€β”€ security.py     # Auth & security
β”‚       β”‚   β”‚   β”œβ”€β”€ ai_client.py    # AI integration
β”‚       β”‚   β”‚   └── voice_client.py # Voice integration
β”‚       β”‚   β”œβ”€β”€ database/      # Database setup
β”‚       β”‚   β”œβ”€β”€ models/        # SQLAlchemy models
β”‚       β”‚   β”œβ”€β”€ schemas/       # Pydantic schemas
β”‚       β”‚   β”œβ”€β”€ services/      # Business logic
β”‚       β”‚   └── main.py        # Application entry
β”‚       └── requirements.txt
β”‚
β”œβ”€β”€ .env                       # Environment variables
β”œβ”€β”€ README.md                  # This file
└── .gitignore

πŸš€ Installation

Prerequisites

1. Clone the Repository

git clone https://github.com/yocho1/ai-assistant-app.git
cd ai-assistant-app

2. Backend Setup

# Navigate to backend directory
cd ai-assistant/backend

# Create virtual environment
python -m venv .venv

# Activate virtual environment
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Initialize database
python -m app.database.init_db

3. Frontend Setup

# Navigate to frontend directory
cd ../frontend

# Install dependencies
npm install

# or with yarn
yarn install

βš™οΈ Configuration

Environment Variables

Create a .env file in the backend directory:

# Authentication
SECRET_KEY=your-super-secret-jwt-key-change-in-production
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7

# OpenRouter AI
OPENROUTER_API_KEY=sk-or-v1-your-api-key-here
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
OPENROUTER_MODEL=openai/gpt-4-turbo-preview

# Deepgram Voice
DEEPGRAM_API_KEY=your-deepgram-api-key

# Amadeus Flight API
AMADEUS_API_KEY=your-amadeus-api-key
AMADEUS_API_SECRET=your-amadeus-api-secret
AMADEUS_BASE_URL=https://test.api.amadeus.com/v1

# OpenWeatherMap
OPENWEATHER_API_KEY=your-openweather-api-key

# Database
DATABASE_URL=sqlite+aiosqlite:///./assistant.db

# CORS
BACKEND_CORS_ORIGINS=["http://localhost:5173","http://localhost:8000"]

API Keys

Get your API keys from:

πŸ’» Usage

Development Mode

Start Backend Server

cd ai-assistant/backend
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Backend will be available at http://localhost:8000

Start Frontend Server

cd ai-assistant/frontend
npm run dev

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

Production Build

Backend

cd ai-assistant/backend
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4

Frontend

cd ai-assistant/frontend
npm run build
npm run preview

πŸ“š API Documentation

Interactive API Docs

Once the backend is running, visit:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Key Endpoints

Authentication

POST /api/v1/auth/register
POST /api/v1/auth/login
POST /api/v1/auth/refresh

Chat

POST /api/v1/chat/
GET  /api/v1/chat/history
POST /api/v1/chat/clear

Flights

POST /api/v1/flights/search
POST /api/v1/flights/book

Weather

GET  /api/v1/weather/{city}

Voice

POST /api/v1/voice/transcribe
POST /api/v1/voice/synthesize

Example Request

curl -X POST "http://localhost:8000/api/v1/chat/" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "message": "Find me flights from New York to Paris next week",
    "conversation_id": "optional-id"
  }'

🚒 Deployment

Docker Deployment (Recommended)

# Create Dockerfile for backend
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

Cloud Platforms

Backend

  • Railway: Connect GitHub repo, auto-deploy
  • Heroku: git push heroku main
  • AWS EC2: Deploy with PM2 or Systemd
  • Google Cloud Run: Container-based deployment
  • Azure App Service: Web app deployment

Frontend

  • Vercel: vercel deploy
  • Netlify: netlify deploy --prod
  • AWS Amplify: Connect GitHub repo
  • Cloudflare Pages: Git integration

Environment Configuration

Set environment variables in your deployment platform's dashboard or use .env files.

πŸ§ͺ Testing

Backend Tests

cd ai-assistant/backend
pytest tests/ -v --cov=app

Frontend Tests

cd ai-assistant/frontend
npm run test
npm run test:coverage

πŸ“Š Performance

  • Lighthouse Score: 90+
  • First Contentful Paint: < 1.5s
  • Time to Interactive: < 3.5s
  • API Response Time: < 200ms (average)

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Code Style

  • Python: Follow PEP 8, use Black formatter
  • TypeScript: Follow Airbnb style guide, use Prettier
  • Commits: Use conventional commits format

πŸ› Troubleshooting

Common Issues

Backend won't start:

# Check Python version
python --version  # Should be 3.12+

# Reinstall dependencies
pip install --force-reinstall -r requirements.txt

Frontend build errors:

# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm install

CORS errors:

  • Verify BACKEND_CORS_ORIGINS in .env
  • Check that frontend URL matches CORS origins

πŸ“ License

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

πŸ‘₯ Authors

  • yocho1 - Initial work - GitHub

πŸ™ Acknowledgments

  • OpenRouter for AI capabilities
  • Deepgram for voice recognition
  • Amadeus for flight data
  • OpenWeatherMap for weather data
  • All open-source contributors

πŸ“ž Support


Made with ❀️ and β˜•

If you find this project useful, please consider giving it a ⭐!

⬆ Back to Top

About

AI Travel Assistant is a cutting-edge, full-stack application that revolutionizes travel planning through AI-powered natural language processing. Users can search flights, check weather forecasts, get travel summaries, and interact with the system using voice commands or text input.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages