Inspiration

Solving a Real Problem

The idea to create "MyTrip" stemmed from personal frustration and a close observation of daily challenges in my country. I was inspired by the desire to solve concrete problems affecting thousands of travelers:

  • Sector Disorganization: It was often difficult to find reliable and centralized information on routes, schedules, and prices. Each transport company had its own system, forcing people to physically travel to obtain information.
  • Ambient Insecurity: Waiting in bus stations, sometimes late at night, and the lack of visibility on the journey's progress created a sense of insecurity for travelers and their loved ones.
  • Inefficient Processes: Long queues to book and pay for tickets were a significant waste of time and energy for everyone. "MyTrip" was my answer to these challenges. I wanted to create a unique, modern, and secure solution that would radically simplify the travel experience, from planning to arrival. ## What it does "MyTrip" is a mobile application developed with Flutter, designed to transform and simplify the intercity travel experience. It offers a comprehensive suite of features, including route search and booking, real-time vehicle tracking, detailed travel information visualization (including distance traveled), and an integrated mobile payment process. Our mission is to solve real challenges related to travel planning and management, by offering an intuitive, visually appealing, and robust solution to encourage regular and repeated use.

Key Features:

  • Easy Search and Booking: Find and book routes between different cities, filtering by date.
  • Dynamic Mapping: The Maps SDK is the backbone of "MyTrip", enabling fluid and interactive display of routes. Clear polylines and custom markers for departure and arrival points offer instant visualization of the journey.
  • Real-time Tracking: Track the position of buses and vehicles in real-time on the map for greater peace of mind for travelers and their loved ones. The feature is designed to be highly scalable using a dynamic vehicle ID.
  • Precise Distance Calculation: The integration of distance calculation in kilometers between departure and arrival cities significantly enriches the information provided to the user.
  • Secure Mobile Payment: A payment process is directly integrated into the application for a complete and frictionless booking experience. ## How we built it The project is divided into two main parts that communicate with each other:
  1. The Backend (FastAPI API in Python)

The brain of the operation. It is responsible for:

  • Business Logic: Managing users, finding routes, calculating distances.
  • Database Communication: I used SQLModel for its simplicity and robustness to create tables (Users, Tickets, Vehicle Locations) and interact with the SQLite database.
  • External Services: It integrates with the Google Maps API to get route details and with Twilio to send SMS confirmations.
  • Real-time: It manages WebSocket connections to broadcast location updates to connected clients.
  1. The Frontend (Flutter Application)

The face of the application, used by the traveler. Its responsibilities include:

  • User Interface: Built with Flutter widgets for a fluid and responsive experience on Android and iOS.
  • API Calls: Using the http package to communicate with the FastAPI backend, whether to search for a route, register, or initiate a payment.
  • Map Display: Deep integration with google_maps_flutter to display routes, markers, and the user's location.
  • State Management: Using StatefulWidget and setState to manage loading states and elegantly update the interface when data is received from the API. ## Challenges we ran into No project is without its challenges, and "MyTrip" had its share:
  1. The localhost Trap: My biggest "Aha!" moment. Initially, the mobile application received no data, spinning endlessly. I realized after much research that the application on my phone couldn't access http://127.0.0.1:8000, because localhost referred to the phone itself! The solution was to start the Uvicorn server on 0.0.0.0 to make it accessible on my local network.

  2. Distance Calculation: I wanted to display the "as the crow flies" distance between two points. I had to research and implement the Haversine formula, which calculates the distance on a sphere from latitude and longitude coordinates.

    The formula is as follows, where R is the Earth's radius, φ is latitude, and λ is longitude: $$ d = 2R \cdot \arcsin\left(\sqrt{\sin^2\left(\frac{\Delta\phi}{2}\right) + \cos(\phi_1) \cos(\phi_2) \sin^2\left(\frac{\Delta\lambda}{2}\right)}\right) $$

  3. Asynchronous State Management: Ensuring the user interface correctly displayed loading indicators during network calls and gracefully handled errors required careful attention to state management in Flutter. This was an excellent exercise in mastering FutureBuilder and asynchronous logic in Dart.

This project was an enriching challenge that allowed me to improve my skills across the entire application development cycle, from backend to frontend, while solving a problem that is close to my heart.

Accomplishments that we're proud of

Transform and simplify the intercity travel experience: search and book trips, real-time vehicle location tracking, detailed trip information (including distance traveled), and an integrated mobile payment process.Overcoming technical difficulties (such as the localhost problem or the implementation of the Haversine formula). In addition, it was necessary to learn new things in new disciplines in a short time (digital mapping, intercity transport, technical operation of mobile payment).Create a solution that addresses the initial problems (disorganization, insecurity, queues). All of these challenges mentioned above are real accomplishments.

What we learned

A Technical Journey

This project represented a huge learning curve. It was our first real foray into the Google Maps Platform ecosystem, and we were fascinated by its power. We learned how to:

  1. Integrate dynamic maps with the google_maps_flutter package, displaying routes with polylines and custom markers.
  2. Manage real-time geolocation with the geolocator package to locate the user and find nearby agencies.
  3. Build a complete client-server architecture, enabling communication between a Flutter application and a back-end API.
  4. Develop a robust API with Python and FastAPI, a framework we chose for its speed, simplicity, and automatic documentation.
  5. Implement real-time communication with WebSockets for the live vehicle tracking feature, a new and exciting concept for us. 6. Manage user authentication with JWT (JSON Web Tokens) in the back-end to secure API access points. We were also able to discover a little more about the methods and operation of electronic payment technology by mobile phone through mobile phone operators. ## What's next for MonVoyage/MyTrip The project is designed to be scalable. Here are the next steps:

*Places API Integration: Allow users, once they arrive at their destination, to easily locate points of interest such as restaurants, hotels or public places. *Rating System: Adding a feature allowing customers to rate travel agencies and companies directly from the app, to improve the quality of service and help other travelers make their choice.

Built With

Share this project:

Updates