Skip to content

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🚖 Ubar

A production-ready, full-stack ride-booking application

Built with the M.E.R.N stack — real-time ride requests over Socket.IO, live GPS tracking, OpenStreetMap-based routing, and distance-based fare calculation.

React Node.js Express MongoDB Socket.IO Netlify Render License

Live Demo

📑 Table of Contents


📖 Overview

Ubar is a two-sided ride-hailing platform with completely separate, real-time experiences for Riders and Captains (drivers). Riders search a pickup and destination, get matched with nearby online captains within a live radius, and track their ride from request to drop-off. Captains receive live ride requests via WebSockets, accept and navigate to the pickup, and get a running record of their trips and earnings.


✨ Features

  • 🔐 JWT-based authentication for both Users and Captains
  • 🔒 Password hashing with bcrypt
  • 📍 Real address search & geocoding via OpenStreetMap Nominatim
  • 🗺️ Real road-route generation and live distance tracking via OSRM
  • 📡 Real-time ride requests and status updates over Socket.IO
  • 🛰️ Live captain GPS tracking, broadcast to the rider in real time
  • 💰 Transparent, distance-based fare calculation (₹/km)
  • 🚗 Multi-vehicle support — Car, Bike, and Auto
  • 🖼️ Profile photo uploads via Cloudinary, proxied securely through the backend
  • 📜 Ride history and earnings tracking for captains
  • 📱 Fully responsive, mobile-first UI

🖼️ Screenshots

Add your own screenshots here whenever you're ready — Home, Login/Signup, Location Search, Vehicle Selection, Captain Dashboard, Live Tracking, Ride History.


🛠️ Tech Stack

Frontend

React Vite JavaScript HTML5 CSS3 Tailwind CSS React Router Axios

Backend

Node.js Express JWT bcrypt Socket.IO Multer dotenv

Database

MongoDB Mongoose

Maps & Location

OpenStreetMap Nominatim OSRM

Deployment & Tools

Netlify Render Cloudinary Git GitHub Postman VS Code

Also: MERN Stack • REST APIs • OpenRouteService API • Context API • MongoDB Compass


🧠 Concepts Implemented

  • Full Stack MERN Development
  • RESTful API Design
  • MVC Architecture
  • JWT-based Authentication & Authorization
  • Password Hashing
  • Protected Routes
  • Real-Time Communication with Socket.IO
  • Distance-based Fare Calculation
  • Geolocation & Route Calculation
  • Cloud Database Integration
  • Production Deployment
  • Environment Variable Management
  • Responsive UI Design

📁 Folder Structure

Ubar/
├── Frontend/
│   ├── src/
│   │   ├── pages/
│   │   ├── components/
│   │   ├── utils/
│   │   └── assets/
│   └── package.json
└── Backend/
    ├── controllers/
    ├── models/
    ├── routes/
    ├── services/
    ├── middlewares/
    ├── socket/
    └── package.json

⚙️ Installation

git clone https://github.com/<your-username>/ubar.git

cd Frontend
npm install
npm run dev

cd ../Backend
npm install
npm start

🔑 Environment Variables

Frontend (.env)

VITE_BASE_URL=

Backend (.env)

PORT=
DB_CONNECT=
JWT_SECRET=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=

⚠️ Never commit real secrets — the values above are placeholders only.


📡 API Endpoints

Users

POST   /users/check-email
POST   /users/register
POST   /users/login
GET    /users/profile
GET    /users/logout
PUT    /users/update-profile
GET    /users/photo/:id

Captains

POST   /captains/check-email
POST   /captains/check-plate
POST   /captains/register
POST   /captains/login
GET    /captains/profile
GET    /captains/logout
PUT    /captains/update-profile
GET    /captains/:id/photo
POST   /captains/go-online
POST   /captains/go-offline

Rides

POST   /rides/create
GET    /rides/recent
GET    /rides/nearby-captains
POST   /rides/accept
POST   /rides/start-ride
POST   /rides/complete-ride
POST   /rides/cancel
GET    /rides/history/user
GET    /rides/history/captain

🏗️ Architecture

React (Vite)
     │
     ▼
   Axios ──────────────► Express.js
                              │
                              ▼
                        Controllers
                              │
                              ▼
                          Services
                              │
                              ▼
                       MongoDB Atlas
                              │
                              ▼
                          Socket.IO
                              │
                              ▼
                     Captain  ⇄  User

🗄️ Database Collections

  • users
  • captains
  • rides

🔐 Authentication

  • JWT tokens issued on login/register
  • Passwords hashed with bcrypt before storage
  • Token blacklisting on logout
  • Protected routes via auth middleware, sent as Bearer tokens / cookies

🗺️ Maps & Routing

  • Nominatim — free-text address search and geocoding
  • OSRM — real road-network routes, live distance and duration between two points
  • Haversine formula — straight-line distance for nearby-captain radius checks

🚀 Deployment

  • Frontend — Netlify
  • Backend — Render
  • Database — MongoDB Atlas

🔮 Future Improvements

  • 💳 Online payments (Stripe / Razorpay)
  • ⭐ Driver & rider ratings
  • 🔔 Push notifications
  • 💬 In-app chat
  • 📊 Admin dashboard & analytics

👤 Author

Tanvir Pathan

Tanvir Pathan

Aspiring Full-Stack Developer

Python Django Flask MERN JavaScript Docker Docker Hub Git GitHub

Internship & Project Experience


LinkedIn Live Project

📄 License

This project is licensed under the MIT License.

About

A full-stack MERN-based Uber Clone featuring secure authentication, ride booking, Google Maps integration, fare estimation, real-time ride management, and responsive dashboards for riders and drivers.

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages