How rohithcherukuri816/ai-based-travel-agent works
Project Type and Purpose
• This is a full-stack, AI-driven travel planning web application.
• Frontend: React/TypeScript PWA (“frontend/…”).
• Backend: FastAPI Python (“app.py”, “main.py”, “ai_chat.py”, etc.) orchestrating multiple AI agents.
• Data services: local SQLite/PostgreSQL (“database.py”, “travel_agent.db”), optional Redis cache, plus static JSON fixtures in “data/…”.
• Integrations: Google Maps, OpenWeather, Wikipedia, Eventbrite, Amadeus, Booking.com, Stripe, PayPal, etc.
File Structure
• Top-level scripts (app.py, main.py, ai_chat.py, analytics_dashboard.py, payment_system.py, real_apis.py) implement:
• API endpoints & gateway logic
• AI agent orchestration (LangGraph / LangChain workflows)
• Analytics reporting
• Payment creation & webhook handlers
• “config.py” holds environment configuration (DB URLs, API keys).
• “database.py” + “models.py” define ORM or raw SQL access.
• “data/” contains sample JSON for offline/demo use.
• “frontend/” is a CRA-style React app with:
• public/ – index.html, manifest, favicon
• src/ – App.tsx, components, tests, styles
Extract Architecture Notes from README
• Four logical layers:
1. Frontend Layer (PWA + Chat UI + Analytics Dashboard + Payment UI)
2. API Gateway (FastAPI, Auth, Rate Limiting, Security middleware)
3. AI Agent Orchestration (UserAgent, FlightAgent, HotelAgent, ActivityAgent, WeatherAgent, BudgetAgent, PlannerAgent, BookingAgent)
4. Data Layer (PostgreSQL/SQLite, Redis Cache, File Storage, External API integrations)
a. Presentation Layer
• React PWA (components: ChatWindow, AnalyticsDashboard, BookingConfirmationDisplay, etc.)
• Static assets (index.html, script.js, style.css)
b. API Gateway / Backend Layer
• FastAPI server (app.py, main.py) exposing REST and WebSocket endpoints (/api/plan, /api/chat/stream, /api/analytics/real-time, /api/payment/create-intent, /api/auth/*)
• Middleware: JWT Auth, Rate Limit, CORS
c. AI Agent Orchestration
• LangGraph StateGraph workflow defined in ai_chat.py or in the backend code
• Individual agents as logical subcomponents (FlightAgent, HotelAgent, ActivityAgent, WeatherAgent, BudgetAgent, PlannerAgent, BookingAgent)
d. Data Layer
• Relational DB (PostgreSQL or local SQLite “travel_agent.db”)
• Redis Cache (optional, for session or partial cache)
• File storage (uploads, logs)
• Static JSON fixtures (“data/…”)
e. External Services
• Google Maps Platform (Places & Directions API)
• OpenWeatherMap API
• Wikipedia API
• Eventbrite API
• Amadeus API (flights)
• Booking.com API (hotels)
• Stripe & PayPal (payment processing)
Relationships & Data Flow
• Frontend → HTTP/HTTPS calls → API Gateway
• API Gateway → orchestrator module (in-process or separate microservice)
• Orchestrator → reads/writes → Data Layer (DB, Redis, file)
• Orchestrator → external calls → third-party APIs
• API Gateway → returns structured JSON to Frontend
• Analytics Dashboard → polls or WebSocket → Backend Analytics endpoints
Architectural Patterns & Principles
• Layered architecture: clear separation of concerns
• Multi-agent orchestration pattern (LangGraph StateGraph)
• Progressive Web App for offline/low-latency interactions
• Caching layer for performance (Redis)
• Modular, single-repository monolith with logical service boundaries
• Secure API gateway with JWT, rate limiting, CORS