Skip to content

FareFinder - Smart Cab & Bike Fare Comparison App πŸš—πŸοΈ A comprehensive Flutter mobile application that empowers users to compare real-time fares across multiple ride-sharing services including Uber, Ola, Rapido, and BluSmart. Make smarter transportation decisions with instant fare estimates and seamless booking management.

Notifications You must be signed in to change notification settings

Aditya41150/Fare-Finder-Cabs-and-Bikes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FareFinder πŸš—

A comprehensive Flutter mobile application for comparing cab fares across multiple ride-sharing services. FareFinder helps users make informed decisions by providing real-time fare estimates from various cab providers including Uber, Ola, Rapido, and BluSmart.

App Screenshots:

image

Fare Comparison Page

image

Features ✨

Frontend (Flutter)

  • Google Places Autocomplete: Smart location search with real-time suggestions
  • Multi-Service Fare Comparison: Compare fares across Uber, Ola, Rapido, and BluSmart
  • Clean, Intuitive UI: Modern Material Design interface
  • State Management: Efficient state management using Provider pattern
  • Responsive Design: Optimized for various screen sizes
  • Booking Management: Create and track booking history

Backend (Node.js/Express)

  • RESTful API: Clean API endpoints for fare estimation and booking management
  • Multi-Provider Integration: Mock implementations for major cab services
  • CORS Support: Cross-origin resource sharing enabled
  • Scalable Architecture: Modular backend structure for easy expansion
  • Health Check Endpoint: Monitor backend service status

Tech Stack πŸ› οΈ

Frontend

  • Flutter (Dart)
  • Provider - State management
  • HTTP - API communication
  • Google Places API - Location autocomplete
  • Material Design - UI components

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • CORS - Cross-origin requests
  • Firebase Admin (Ready for integration)

Project Structure πŸ“

FareFinder/
β”œβ”€β”€ lib/                          # Flutter source code
β”‚   β”œβ”€β”€ models/                   # Data models
β”‚   β”‚   β”œβ”€β”€ booking.dart
β”‚   β”‚   β”œβ”€β”€ cab_service.dart
β”‚   β”‚   └── place_prediction.dart
β”‚   β”œβ”€β”€ providers/                # State management
β”‚   β”‚   └── fare_provider.dart
β”‚   β”œβ”€β”€ screens/                  # UI screens
β”‚   β”‚   β”œβ”€β”€ booking_history_screen.dart
β”‚   β”‚   β”œβ”€β”€ home_screen.dart
β”‚   β”‚   └── results_screen.dart
β”‚   β”œβ”€β”€ services/                 # API and external services
β”‚   β”‚   β”œβ”€β”€ api_service.dart
β”‚   β”‚   └── places_service.dart
β”‚   β”œβ”€β”€ widgets/                  # Reusable UI components
β”‚   β”‚   └── location_autocomplete.dart
β”‚   └── main.dart                 # App entry point
β”œβ”€β”€ backend/                      # Node.js backend
β”‚   β”œβ”€β”€ server.js                 # Main server file
β”‚   └── package.json              # Dependencies
└── README.md                     # Project documentation

Getting Started πŸš€

Prerequisites

  • Flutter SDK (latest version)
  • Node.js and npm
  • Google Cloud Platform account (for Places API)
  • Android Studio or VS Code with Flutter extensions

Backend Setup

  1. Navigate to backend directory:

    cd backend
  2. Install dependencies:

    npm install
  3. Start the server:

    npm start

    The backend will run on http://localhost:3000

Frontend Setup

  1. Install Flutter dependencies:

    flutter pub get
  2. Configure Google Places API:

    • Create a Google Cloud Platform project
    • Enable the Places API
    • Generate an API key
    • Update the API key in lib/services/places_service.dart:
      final String apiKey = 'YOUR_GOOGLE_PLACES_API_KEY';
  3. Run the app:

    flutter run

API Endpoints 🌐

Backend API

  • GET /health - Health check endpoint
  • POST /api/fare-estimate - Get fare estimates
    {"pickup": "Location Name", "destination": "Location Name"}
  • POST /api/bookings - Create a new booking
  • GET /api/bookings/:userId - Get user's booking history

Google Places API Integration

The app integrates with Google Places API for:

  • Autocomplete: Real-time location suggestions
  • Place Details: Detailed information about selected locations
  • Geocoding: Convert addresses to coordinates

Key Features Implementation πŸ”§

Google Places Autocomplete

The LocationAutocomplete widget provides:

  • Debounced Search: Optimized API calls with 500ms delay
  • Real-time Suggestions: Dynamic list of location predictions
  • Error Handling: Graceful handling of API failures
  • Custom Styling: Consistent with app theme
// Usage in HomeScreen
LocationAutocomplete(
  hintText: 'Enter pickup location',
  onPlaceSelected: (prediction) {
    // Handle place selection
  },
)

Fare Comparison

The app compares fares across multiple services:

  • Uber: Various ride types (UberGo, UberPremium, etc.)
  • Ola: Multiple categories (Mini, Prime, etc.)
  • Rapido: Bike and auto options
  • BluSmart: Electric cab service

State Management

Using Provider pattern for:

  • Fare Data: Managing fare estimates and loading states
  • Location State: Tracking pickup and destination selections
  • Booking History: Managing user's booking records

Configuration βš™οΈ

Google Places API Setup

  1. Enable APIs:

    • Places API
    • Geocoding API (optional, for coordinate conversion)
  2. API Key Restrictions (Recommended):

    • Application restrictions: Android apps
    • API restrictions: Places API
  3. Billing: Ensure billing is enabled for your GCP project

Backend Configuration

The backend includes mock data for cab services. To integrate with real APIs:

  1. Add API keys for each service in environment variables
  2. Implement actual API calls in respective service modules
  3. Handle authentication and rate limiting

Development Guidelines πŸ“

Flutter Best Practices

  • Use proper state management with Provider
  • Implement error handling for all API calls
  • Follow Material Design guidelines
  • Use const constructors where possible
  • Implement proper loading states

Backend Best Practices

  • Use proper HTTP status codes
  • Implement input validation
  • Add proper error handling middleware
  • Use environment variables for configuration
  • Implement logging for debugging

Troubleshooting πŸ”

Common Issues

  1. Google Places API not working:

    • Check API key validity
    • Ensure Places API is enabled
    • Verify billing is set up
    • Check API quotas and limits
  2. Backend connection issues:

    • Ensure backend is running on correct port
    • Check CORS configuration
    • Verify API endpoints are correct
  3. Flutter build issues:

    • Run flutter clean
    • Delete pubspec.lock and run flutter pub get
    • Check Flutter and Dart SDK versions

Debugging Tips

  • Use Flutter Inspector for UI debugging
  • Check browser developer tools for API calls
  • Monitor backend logs for API errors
  • Use print() statements for debugging state changes

Future Enhancements πŸš€

  • Firebase Integration: User authentication and data persistence
  • Real-time Tracking: Live tracking of booked rides
  • Payment Integration: In-app payment processing
  • Push Notifications: Ride status updates
  • Favorites: Save frequently used locations
  • Price Alerts: Notify users of fare changes
  • Route Optimization: Suggest optimal routes
  • Multi-city Support: Expand to multiple cities

Contributing 🀝

  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

License πŸ“„

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

Support πŸ’¬

If you have any questions or run into issues, please:

  • Check the troubleshooting section above
  • Open an issue on GitHub
  • Review the Flutter and Node.js documentation

Happy Coding! πŸŽ‰

About

FareFinder - Smart Cab & Bike Fare Comparison App πŸš—πŸοΈ A comprehensive Flutter mobile application that empowers users to compare real-time fares across multiple ride-sharing services including Uber, Ola, Rapido, and BluSmart. Make smarter transportation decisions with instant fare estimates and seamless booking management.

Resources

Stars

Watchers

Forks

Packages

No packages published