Skip to content

mayur262/Carpooling-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚗 ShareMyRide - Carpooling & Ridesharing Platform

ShareMyRide Banner Expo Supabase Node.js

A modern, feature-rich carpooling application built with React Native, Expo, and Supabase. Final Year Project 2024-2025.


📱 Features

🎯 Core Features

  • User Authentication - Secure signup/login with Supabase Auth
  • Ride Posting - Drivers can post available rides
  • Ride Booking - Passengers can search and book rides
  • Real-time Chat - In-app messaging between drivers and passengers
  • Push Notifications - Booking updates, chat messages, and ride reminders
  • Rating System - Rate drivers and passengers after rides
  • Payment Integration - Multiple payment methods (Cash, UPI, Card, Wallet)
  • Smart Matching - Algorithm-based ride recommendations (96.1% accuracy)
  • SOS Emergency - Emergency alert system with contact notifications
  • Live Location Tracking - Real-time ride tracking on map
  • Profile Management - Complete user profiles with photo upload

🔔 Notification System

  • 📋 Booking status updates (pending, confirmed, active, completed)
  • 💬 Real-time chat message alerts
  • 🔔 Ride reminders (15 minutes before departure)
  • 🚨 SOS emergency alerts to emergency contacts
  • 🎁 Promotional notifications

💳 Payment Features

  • Multiple payment methods (Card, Cash, UPI, Wallet)
  • Stripe integration for card payments
  • Payment transaction history
  • Fare breakdown display
  • Automatic revenue tracking for drivers
  • Dual confirmation system (driver + passenger)

🛡️ Safety Features

  • Emergency SOS button
  • Emergency contact management (with active/inactive toggle)
  • Real-time location sharing during rides
  • Driver and passenger ratings
  • Trip history tracking
  • Contact notification system

🏗️ Tech Stack

Frontend (Mobile App)

  • Framework: React Native with Expo SDK 51
  • Navigation: React Navigation v6
  • State Management: React Context API + Hooks
  • UI Components: React Native Paper, Custom Safe Components
  • Maps: React Native Maps (Google Maps)
  • Notifications: Expo Notifications
  • Storage: AsyncStorage
  • Payment: Stripe React Native SDK
  • HTTP Client: Fetch API

Backend (API Server)

  • Runtime: Node.js v18+
  • Framework: Express.js
  • Database: PostgreSQL (via Supabase)
  • Authentication: Supabase Auth (JWT-based)
  • Push Notifications: Expo Server SDK
  • Real-time: Supabase Realtime Subscriptions

Database & Services

  • Primary Database: Supabase (PostgreSQL)
  • Authentication: Supabase Auth
  • Storage: Supabase Storage (profile pictures)
  • Real-time: Supabase Realtime (chat, location tracking)
  • SMS Service: Twilio (for SOS alerts)

🚀 Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v18 or higher) - Download
  • npm or yarn package manager
  • Git - Download
  • Expo CLI - npm install -g expo-cli
  • EAS CLI - npm install -g eas-cli (for building APK)
  • Physical Android/iOS device (for testing push notifications)

1️⃣ Clone the Repository

git clone https://github.com/mayurnaik32/SMR.git
cd SMR/ShareMyRide

2️⃣ Install Dependencies

Frontend (Mobile App)

# Navigate to ShareMyRide folder
cd ShareMyRide

# Install mobile app dependencies
npm install

Backend (API Server)

cd backend
npm install
cd ..

3️⃣ Setup Supabase Database

  1. Create Supabase Project:

    • Go to https://supabase.com
    • Click "New Project"
    • Fill in project details
    • Wait for database provisioning (~2 minutes)
  2. Run Database Migration:

    • Open Supabase Dashboard → SQL Editor
    • Copy ALL content from database/complete_schema_migration.sql
    • Paste into SQL Editor
    • Click "Run" button (or press Ctrl+Enter)
    • Wait for success message: ✅ Schema migration completed successfully!
  3. Get Your Credentials:

    • Go to Settings → API
    • Copy Project URL and anon/public key
    • For backend, also copy service_role key (keep secret!)

4️⃣ Configure Environment Variables

Frontend Configuration

Update config/supabase.js:

import { createClient } from '@supabase/supabase-js';

const supabaseUrl = 'YOUR_SUPABASE_PROJECT_URL';
const supabaseAnonKey = 'YOUR_SUPABASE_ANON_KEY';

export const supabase = createClient(supabaseUrl, supabaseAnonKey);

Backend Configuration

Create backend/.env:

# Supabase Configuration
SUPABASE_URL=YOUR_SUPABASE_PROJECT_URL
SUPABASE_SERVICE_KEY=YOUR_SUPABASE_SERVICE_ROLE_KEY

# Server Configuration
PORT=3000
NODE_ENV=development

5️⃣ Update Backend URL for Device Testing

Update utils/notificationHelper.js (around line 5):

// For local testing on same machine:
const BACKEND_URL = 'http://localhost:3000';

// For testing on physical device (replace with your computer's IP):
// const BACKEND_URL = 'http://192.168.1.100:3000';

// Find your IP:
// Windows: Run 'ipconfig' in CMD, look for IPv4 Address
// Mac/Linux: Run 'ifconfig', look for inet address

6️⃣ Start the Application

Terminal 1: Start Backend Server

cd backend
node server.js

# Expected Output:
# ✅ Server running on http://localhost:3000

Keep this terminal running!

Terminal 2: Start Mobile App

Option A: Expo Go (Quick Testing - No Notifications)

npx expo start

# Scan QR code with Expo Go app
# ⚠️ Note: Push notifications won't work in Expo Go

Option B: Development Build (For Testing Notifications)

# Connect Android device via USB with USB debugging enabled
npx expo run:android

# This will:
# 1. Build a development APK (5-10 minutes first time)
# 2. Install on connected device
# 3. Start Metro bundler
# ✅ Notifications WILL work!

📦 Building APK

Method 1: Local Build (Fastest)

Requirements:

  • Android device connected via USB
  • USB debugging enabled

Steps:

# 1. Enable USB debugging on Android:
#    Settings → About Phone → Tap "Build Number" 7 times
#    Settings → Developer Options → Enable "USB Debugging"

# 2. Connect device to computer via USB

# 3. Build and install:
npx expo run:android

# APK will be installed automatically

Method 2: EAS Build (Cloud Build) ☁️

Step 1: Setup EAS

# Install EAS CLI globally
npm install -g eas-cli

# Login to Expo account
eas login

# Initialize EAS
eas init

Step 2: Create EAS Configuration

Create eas.json:

{
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "android": {
        "buildType": "apk"
      }
    },
    "preview": {
      "distribution": "internal",
      "android": {
        "buildType": "apk"
      }
    },
    "production": {
      "android": {
        "buildType": "app-bundle"
      }
    }
  }
}

Step 3: Build APK

# Development build
eas build --profile development --platform android

# Preview build (for testing)
eas build --profile preview --platform android

# Production build (for Play Store)
eas build --profile production --platform android

🧪 Testing

Test Push Notifications

  1. Build development APK (see above)
  2. Install on physical device
  3. Login to app
  4. Go to: Profile → Notification Settings
  5. Tap: "Send Test Notification"
  6. Result: Notification should appear! 🎉

Test Backend API

# Health check
curl http://localhost:3000/health

# Expected: {"status":"ok"}

📊 Database Schema

Main Tables (13 Total)

  • users - User profiles, ratings, push tokens
  • rides - Posted rides by drivers
  • bookings - Ride bookings by passengers
  • messages - Chat messages
  • ratings - User ratings and reviews
  • notifications - System notifications
  • notification_logs - Push notification history
  • contacts - Emergency contacts
  • sos_events - Emergency SOS alerts
  • payment_transactions - Payment history
  • ride_matches - Smart matching results
  • live_locations - Real-time location tracking
  • ride_requests - Passenger ride requests

Automated Features

  • ✅ Auto-update ride statistics (booking counts, revenue)
  • ✅ Auto-calculate user ratings
  • ✅ Auto-update timestamps
  • ✅ Row Level Security (RLS) for data protection

🐛 Troubleshooting

Push Notifications Not Working

Solutions:

  • ✅ Use development build, NOT Expo Go
  • ✅ Test on physical device, NOT emulator
  • ✅ Check notification permissions are granted
  • ✅ Verify backend server is running
  • ✅ Check push token is saved in database

Backend Connection Failed

Solutions:

  • ✅ Check backend is running: node backend/server.js
  • ✅ Update backend URL in utils/notificationHelper.js
  • ✅ Use your computer's IP address (not localhost) for device testing
  • ✅ Ensure device and computer are on same WiFi network

Database Errors

Solutions:

  • ✅ Re-run migration script in Supabase SQL Editor
  • ✅ Check Supabase logs: Dashboard → Database → Logs
  • ✅ Verify credentials in config files

📚 API Documentation

Base URL

http://localhost:3000/api

Notification Endpoints

Send Generic Notification

POST /api/notifications/send
Content-Type: application/json

{
  "userId": "uuid",
  "title": "Notification Title",
  "body": "Notification body text"
}

Booking Update Notification

POST /api/notifications/booking-update

{
  "bookingId": "uuid",
  "status": "confirmed",
  "recipientId": "uuid"
}

Chat Message Notification

POST /api/notifications/chat-message

{
  "recipientId": "uuid",
  "senderName": "John Doe",
  "message": "Message text"
}

🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/AmazingFeature
  3. Commit your changes: git commit -m 'Add AmazingFeature'
  4. Push to branch: git push origin feature/AmazingFeature
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License.

MIT License - Copyright (c) 2025 Mayur Naik

👥 Team

  • Mayur Naik - @mayurnaik32
  • University: [Your University Name]
  • Department: Computer Engineering
  • Year: 2024-2025

🙏 Acknowledgments


📞 Support

For support:


🎓 Academic Use

This project is developed as part of a Final Year Project for Bachelor of Engineering in Computer Engineering.

Project Title: ShareMyRide - Smart Carpooling & Ridesharing Platform
Academic Year: 2024-2025

Key Highlights:

  • ✅ Complete full-stack mobile application
  • ✅ Real-time features
  • ✅ Push notification system
  • ✅ Payment integration
  • ✅ Smart matching algorithm (96.1% accuracy)
  • ✅ Production-ready database architecture
  • ✅ Safety features (SOS, emergency contacts)

🗺️ Roadmap

Completed

  • User Authentication
  • Ride Posting & Booking
  • Real-time Chat
  • Push Notifications
  • Payment Integration
  • Rating System
  • SOS Emergency Feature
  • Smart Matching Algorithm

Future Enhancements 🚀

  • In-app Voice/Video Calling
  • Multi-language Support
  • Dark Mode Theme
  • Carbon Footprint Calculator
  • Driver Verification System

🔄 Project Status

Status Version Build

Current Version: 1.0.0
Last Updated: October 28, 2025
Status: ✅ Production Ready


🚀 Quick Start Commands

# Clone repository
git clone https://github.com/mayurnaik32/SMR.git
cd SMR/ShareMyRide

# Install dependencies
npm install
cd backend && npm install && cd ..

# Start backend
cd backend && node server.js

# Start app (new terminal)
npx expo start

# Build APK
npx expo run:android

💻 System Requirements

Development

  • OS: Windows 10/11, macOS 10.15+, Ubuntu 20.04+
  • RAM: 8GB minimum, 16GB recommended
  • Storage: 10GB free space
  • Node.js: v18.0.0 or higher

Mobile Device

  • Android: 6.0 (API 23) or higher
  • iOS: 13.0 or higher
  • RAM: 2GB minimum
  • Storage: 100MB free space

📝 Changelog

Version 1.0.0 (2025-10-28)

  • ✅ Initial release
  • ✅ Complete notification system
  • ✅ Smart matching algorithm
  • ✅ Database schema with 13 tables
  • ✅ Payment integration
  • ✅ Real-time chat
  • ✅ SOS emergency system
  • ✅ Production-ready build

🔗 Useful Links


⭐ If you find this project useful, please give it a star on GitHub!


Made with ❤️ by Mayur Naik GEC-GOA | 2025-2026

GitHubEmail

About

carpooling apk using reactnative,supabase,expo,nodejs

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors