Your AI-Powered Travel Planning Companion
TripPilot is a feature-rich Flutter mobile application that revolutionizes travel planning by combining intelligent search capabilities, AI-powered recommendations, budget optimization, and seamless trip management.
- Features
- Architecture
- Tech Stack
- Project Structure
- Getting Started
- Configuration
- Core Features Documentation
- API Integration
- Database
- State Management
- Theme & UI
- Troubleshooting
- Contributing
- Flights: Real-time flight search across multiple airlines with pricing and amenities
- Hotels: Comprehensive hotel listings with ratings, prices, and facilities
- Activities: Curated activities and attractions filtered by destination and preferences
- Infinite Scroll Pagination: Automatic loading of more results as you scroll (5 items per load)
- Dynamic Filters: Sort and filter by price, rating, duration, and preferences
- OpenAI GPT Integration: Real-time recommendations powered by GPT-3.5-turbo
- Smart Destination Suggestions: Personalized destination recommendations based on preferences and budget
- Itinerary Generation: AI-created day-by-day itineraries with activities and meals
- Local Tips & Insights: Curated local tips for authentic travel experiences
- Restaurant Recommendations: Cuisine-specific restaurant suggestions
- Activity Suggestions: Tailored activities based on preferences and budget
- Graceful Fallback: High-quality fallback recommendations when API is unavailable
- Budget Optimization: AI-powered breakdown of trip costs by category
- Deal Detection: Smart algorithms to identify the best travel deals
- Cost Tracking: Real-time tracking of estimated vs. planned expenses
- Budget Visualization: Charts and graphs showing expense distribution
- Create & Manage Trips: Full CRUD operations for trip planning
- Offline-First Architecture: Local database caching with ObjectBox
- Cloud Sync: Supabase integration for cloud backup and sync
- Trip Details: Store dates, budgets, destinations, and travelers
- Supabase Auth: Secure authentication with email/password
- User Profile Management: Manage personal information and preferences
- Session Management: Persistent login across app restarts
TripPilot follows Clean Architecture principles with a clear separation of concerns:
Domain Layer (Business Logic)
β
Data Layer (Repositories & Data Sources)
β
Presentation Layer (UI & State Management)
Domain Layer (lib/domain/)
- Abstract repository interfaces
- Business entities (Trip, Budget, Recommendation)
- Use cases for business logic
- No dependencies on external frameworks
Data Layer (lib/data/)
- Repository implementations
- Remote data sources (APIs: OpenAI, Amadeus, Supabase, etc.)
- Local data sources (ObjectBox database)
- Data models and mappers
Presentation Layer (lib/presentation/)
- BLoC state management
- UI screens and widgets
- Theme and styling
- User interaction handling
- Flutter 3.x - UI framework
- Dart 3.x - Programming language
- flutter_bloc - BLoC pattern for state management
- equatable - Value equality comparison
- Dio - HTTP client with interceptors
- OpenAI API - GPT-3.5-turbo for AI recommendations
- Amadeus API - Flight, hotel, and activity data (sandbox/test)
- RapidAPI - Additional search capabilities
- ObjectBox - Local NoSQL database (offline-first)
- Supabase - Backend-as-a-service for authentication and cloud storage
- Supabase Auth - Email/password authentication
- flutter_dotenv - Environment variables management
- logger - Structured logging
- get_it - Service locator/dependency injection
- go_router - Declarative routing
- flutter_secure_storage - Secure credential storage
- staggered_animations - Smooth staggered list animations
- shimmer - Loading skeleton screens
lib/
βββ core/ # Core app functionality
β βββ config/ # Configuration (Supabase, API)
β βββ errors/ # Error handling & failures
β βββ theme/ # App theming (colors, fonts, spacing)
β βββ utils/ # Utilities (injection, logging, routing)
β βββ router/ # Navigation configuration
β
βββ domain/ # Business logic layer
β βββ entities/ # Data models (Trip, Budget, etc.)
β βββ repositories/ # Abstract interfaces
β βββ usecases/ # Business logic operations
β
βββ data/ # Data layer
β βββ datasources/
β β βββ remote/ # API clients (Amadeus, OpenAI, Supabase)
β β βββ local/ # ObjectBox database
β βββ models/ # Data models with JSON serialization
β βββ repositories/ # Repository implementations
β
βββ presentation/ # UI layer
β βββ bloc/ # BLoC state management
β β βββ search/ # Flight, hotel, activity search
β β βββ trip/ # Trip management
β β βββ budget/ # Budget operations
β β βββ auth/ # Authentication
β β βββ recommendations/ # AI recommendations
β β βββ navigation/ # App navigation
β β βββ rating/ # Rating system
β βββ screens/ # App screens
β β βββ search_screen.dart
β β βββ recommendations_screen.dart
β β βββ budget_tracker_screen.dart
β β βββ trip_details_screen.dart
β β βββ ...
β βββ widgets/ # Reusable UI widgets
β
βββ main.dart # App entry point
βββ injection_container.dart # OpenAI services setup
βββ pubspec.yaml # Dependencies
test/ # Unit & widget tests
βββ widget_test.dart
βββ ...
- Flutter 3.x or higher
- Dart 3.x
- iOS: Xcode 14+
- Android: Android Studio with SDK 21+
-
Clone the repository
git clone https://github.com/sohailmahmud/TripPilot.git cd TripPilot -
Install dependencies
flutter pub get
-
Set up environment variables (see Configuration)
cp .env.example .env # Edit .env with your API keys -
Run the app
flutter run
-
Build for production
flutter build apk # Android flutter build ios # iOS
Create a .env file in the project root with the following variables:
# Supabase Configuration
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key
# OpenAI API
OPENAI_API_KEY=sk-proj-your-api-key
# Amadeus API (Flight/Hotel/Activity Search)
AMADEUS_URL=https://test.api.amadeus.com/v2
AMADEUS_AUTH_URL=https://test.api.amadeus.com/v1/security/oauth2/token
AMADEUS_CLIENT_ID=your-client-id
AMADEUS_CLIENT_SECRET=your-client-secret
# RapidAPI Key
RAPID_API_KEY=your-rapidapi-key- Visit https://platform.openai.com/api-keys
- Create a new API key
- Add it to
.envasOPENAI_API_KEY
- Visit https://supabase.com
- Create a new project
- Get your URL and Anon Key from project settings
- Add to
.env
- Visit https://developers.amadeus.com
- Register for free account
- Get Client ID and Secret
- Uses sandbox/test data (not real flights)
- Visit https://rapidapi.com
- Create account and get API key
- Used for additional search capabilities
Flight Search:
- Real-time flight searches via Amadeus API
- Infinite scroll with 5 items per load
- Filters: price, duration, airline, amenities
- Details: departure/arrival times, stops, pricing
Hotel Search:
- Hotel listings with photos and ratings
- Location-based search
- Filters: price range, star rating, amenities
- Details: address, phone, website
Activity Search:
- Curated activities and attractions
- Category-based filtering
- User ratings and reviews
- Booking information
Infinite Scroll Implementation:
// Automatically loads more items at 80% scroll
_flightScrollController.addListener(() {
if (_scrollPosition / _scrollExtent > 0.8) {
_loadMoreFlights();
}
});How It Works:
- User enters preferences (destination, duration, budget)
- App sends request to OpenAI GPT-3.5-turbo
- AI generates personalized recommendations
- Results cached locally for offline access
- Fallback to curated data if API unavailable
Recommendation Types:
- Destination recommendations
- Day-by-day itineraries
- Local tips and insights
- Restaurant suggestions
- Activity recommendations
Optimization Algorithm:
- Analyzes budget across categories (flights, hotels, activities, meals)
- Suggests adjustments based on market data
- Tracks actual vs. planned spending
- Identifies cost-saving opportunities
Offline-First Approach:
- All data stored locally with ObjectBox
- Changes sync to cloud when online
- Seamless offline functionality
- No data loss on network interruption
Endpoint: https://api.openai.com/v1/chat/completions
Model: GPT-3.5-turbo
Request Format:
{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a travel expert..."
},
{
"role": "user",
"content": "Recommend destinations for..."
}
],
"temperature": 0.7,
"max_tokens": 1500
}Error Handling:
- 401: Invalid/expired API key β Fallback data
- 429: Rate limit exceeded β Fallback data
- 500+: Server error β Fallback data
Endpoints:
- Flights:
/v2/shopping/flight-offers - Hotels:
/v2/shopping/hotel-search - Activities:
/v2/shopping/activities
Authentication: OAuth 2.0 (Client Credentials)
Purpose: Offline-first local storage
Data Stored:
- User profiles
- Trip information
- Search history
- Cached recommendations
- Budget data
Initialization:
await LocalDatabase.initialize();Purpose: Authentication and cloud backup
Features:
- User authentication
- Cloud trip storage
- Data sync across devices
- Real-time updates
TripPilot uses BLoC (Business Logic Component) pattern for state management.
// Event
class GetRecommendationsRequested extends RecommendationEvent {
final String destination;
final int numberOfDays;
// ...
}
// State
class RecommendationLoading extends RecommendationState {}
class RecommendationSuccess extends RecommendationState {
final List<Map<String, dynamic>> recommendations;
}
// BLoC
class RecommendationBloc extends Bloc<RecommendationEvent, RecommendationState> {
RecommendationBloc(this.aiService) : super(RecommendationInitial()) {
on<GetRecommendationsRequested>(_onGetRecommendations);
}
}- SearchBloc - Flight, hotel, activity search
- TripBloc - Trip CRUD operations
- BudgetBloc - Budget optimization
- AuthBloc - User authentication
- RecommendationBloc - AI recommendations
- NavigationBloc - App navigation state
Primary Colors:
- Light:
#1A237E(Navy) - Dark:
#3D5AFE(Blue)
Secondary Colors:
- Light:
#455A64(Slate Blue) - Dark:
#90CAF9(Light Blue)
Accent Colors:
- Tertiary:
#006064(Cyan) - Success:
#1B5E20(Green) - Warning:
#F57F17(Amber) - Error:
#D32F2F(Red)
Font Family: Poppins (primary), Roboto (fallback)
Font Sizes:
- Display Large: 57sp
- Headline Large: 32sp
- Title Large: 22sp
- Body Large: 16sp
- Label Large: 14sp
- xs: 4dp
- sm: 8dp
- md: 16dp
- lg: 24dp
- xl: 32dp
1. "OPENAI_API_KEY not found"
- Cause:
.envfile missing or API key not set - Solution: Create
.envfile with validOPENAI_API_KEY
2. App using fallback recommendations
- Cause: API key expired, rate limit exceeded, or invalid
- Solution: Update API key in
.envor wait for rate limit reset
3. Flights/Hotels not loading
- Cause: Amadeus API credentials invalid
- Solution: Verify
AMADEUS_CLIENT_IDandAMADEUS_CLIENT_SECRETin.env
4. Authentication failing
- Cause: Supabase not initialized or credentials wrong
- Solution: Check
SUPABASE_URLandSUPABASE_ANON_KEYin.env
5. Offline data not syncing
- Cause: Network issues or database not initialized
- Solution: Check internet connection and restart app
Enable detailed logging:
// In AppLogger or main.dart
logger.level = Level.debug;View logs in console:
flutter logsflutter_bloc: ^8.1.0- State managementdio: ^5.3.0- HTTP clientobjectbox: ^3.x.x- Local databasesupabase_flutter: ^1.x.x- Backend serviceslogger: ^2.x.x- Loggingflutter_dotenv: ^5.x.x- Environment variablesgo_router: ^10.x.x- Routing
See pubspec.yaml for complete dependency list.
- API Keys: Never commit
.envfile (it's in.gitignore) - Secure Storage: Use
flutter_secure_storagefor sensitive data - HTTPS Only: All API calls use secure connections
- Authentication: Supabase handles secure auth
- Data Encryption: Local database supports encryption
- Infinite Scroll: Load 5 items at a time to reduce memory usage
- Image Caching: Automatic caching of hotel/activity images
- Database Indexing: ObjectBox creates indexes for fast queries
- Lazy Loading: Screens loaded on-demand
- State Caching: BLoC prevents redundant API calls
flutter build apk --release
# Output: build/app/outputs/flutter-apk/app-release.apkflutter build ios --release
# Follow Xcode instructions for App Store submissionContributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see LICENSE file for details.
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check existing documentation
- Review troubleshooting section
- OpenAI for GPT-3.5-turbo API
- Amadeus for travel data APIs
- Supabase for backend services
- Flutter community for amazing libraries
- Contributors and testers
Built with β€οΈ for travel enthusiasts | Happy travels! π