Inspiration

Urban congestion and the rising cost of commuting are global problems. While ride-hailing apps exist, they are often too expensive for daily use, and public transport isn't always accessible. We noticed that informal carpooling (via chat groups or forums) is popular but lacks trust, safety, and fairness.

We wanted to build a platform that professionalizes peer-to-peer carpooling. Our goal was to create a "Compliance-First" engine that doesn't just match riders, but handles the complex logistics of fair fare splitting, regulatory compliance (like data privacy and transport laws), and rider safety automatically. We wanted to prove that you can have the convenience of a taxi with the affordability of a bus.

What it does

Carpool is a smart ride-sharing platform that connects commuters with similar routes to split costs.

  • Smart Matching Engine: Automatically groups riders based on proximity (within 500m) and direction (bearing calculation) to minimize detours.

  • Dynamic Fair Pricing: Instead of arbitrary negotiations, our system calculates a fair price for every rider based on distance and demand, offering 20-40% savings compared to solo rides.

  • Safety Suite: Includes an SOS button, real-time location tracking links for family, and masked calling so riders can coordinate without revealing personal phone numbers.

  • Regulatory Compliance: Built-in modules for "Consent Management" and "Trip Manifests" that adapt to local transport regulations (currently configured for Vietnam's Decree 10 & 13).

    How we built it

    We built a robust, real-time backend using Node.js and TypeScript.

  • Database & ORM: We used PostgreSQL with Prisma to model complex relationships between Users, Trips, and MatchGroups.

  • Geolocation Algorithms: We implemented the Haversine formula and Bearing calculations from scratch in our matching.service.ts to cluster trips effectively without relying heavily on expensive third-party Maps APIs for the initial sort.

  • Real-time Communication: We utilized Socket.io to handle live updates. When a driver moves or a match is found, events are broadcast instantly to specific "rooms" (trip-specific or user-specific channels), ensuring the UI is always in sync.

  • Integration: The system generates deep links for major ride-hailing apps (like Grab or Be), allowing the matched group to easily book the actual vehicle if they don't have a car owner in the group.

    Challenges we ran into

  • The "Traveling Salesman" Variation: Building the matching algorithm was tough. We had to balance "optimal routes" with "acceptable wait times." Calculating the bearing difference to ensure two riders are actually going in the same direction (and not just close to each other) required precise trigonometric calculations.

  • Real-time State Management: Managing the state of a trip (from PENDING to MATCHING to IN_PROGRESS) across multiple users via WebSockets was complex. Handling disconnects and ensuring all riders received the "Match Found" notification simultaneously took several iterations.

  • Fair Cost Splitting: Creating a pricing logic that feels fair to everyone (accounting for different pickup points and distances) was mathematically challenging. We had to implement a weighted split algorithm based on individual distance traveled.

    Accomplishments that we're proud of

  • The Matching Engine: We successfully built a background engine that runs periodically to batch-process ride requests, creating optimized groups of up to 4 riders automatically.

  • Privacy-First Architecture: We are proud of the granular consent management system. Users have explicit control over their location and profiling data, making the platform ready for strict privacy laws (like GDPR or local equivalents).

  • Seamless "Hailing" Handoff: The feature that allows a matched group to instantly generate a booking link for external ride-hailing apps solves the "who drives?" problem elegantly.

    What we learned

  • Geography is Math: We deepened our understanding of geospatial data—calculating coordinates, bearings, and search radii is fundamental to logistics apps.

  • Trust is a Feature: We learned that features like "Masked Calling" and "Emergency Contacts" are not just add-ons; they are core requirements for users to trust a P2P platform.

  • Socket Scalability: We learned how to structure WebSocket rooms efficiently (e.g., match:${matchGroupId}) to broadcast location updates to the right people without overloading the server.

    What's next for Carpool

  • Global Expansion: While we started with a focus on specific local regulations, the compliance engine is modular. We plan to add configuration files for other regions (e.g., Singapore, Thailand), allowing the app to adapt its legal checks and pricing models instantly.

  • AI-Powered Matching: Currently, we use mathematical heuristics. The next step is to train a Machine Learning model on trip history to predict cancellations and "no-shows," optimizing matches for reliability rather than just distance.

  • Corporate Carpooling (B2B): We plan to launch a "Carpool for Enterprise" version, allowing companies to offer exclusive, verified carpooling networks for their employees to reduce campus traffic.

  • Multi-Modal Routing: Integrating with public transport APIs so a "Carpool" leg can be just one part of a longer journey (e.g., Carpool to the Train Station).

Share this project:

Updates