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.
- Overview
- Features
- Tech Stack
- Concepts Implemented
- Folder Structure
- Installation
- Environment Variables
- API Endpoints
- Architecture
- Database
- Authentication
- Maps & Routing
- Deployment
- Future Improvements
- Author
- License
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.
- 🔐 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
Add your own screenshots here whenever you're ready — Home, Login/Signup, Location Search, Vehicle Selection, Captain Dashboard, Live Tracking, Ride History.
Also: MERN Stack • REST APIs • OpenRouteService API • Context API • MongoDB Compass
- 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
Ubar/
├── Frontend/
│ ├── src/
│ │ ├── pages/
│ │ ├── components/
│ │ ├── utils/
│ │ └── assets/
│ └── package.json
└── Backend/
├── controllers/
├── models/
├── routes/
├── services/
├── middlewares/
├── socket/
└── package.json
git clone https://github.com/<your-username>/ubar.git
cd Frontend
npm install
npm run dev
cd ../Backend
npm install
npm startFrontend (.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.
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
React (Vite)
│
▼
Axios ──────────────► Express.js
│
▼
Controllers
│
▼
Services
│
▼
MongoDB Atlas
│
▼
Socket.IO
│
▼
Captain ⇄ User
userscaptainsrides
- 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
- 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
- Frontend — Netlify
- Backend — Render
- Database — MongoDB Atlas
- 💳 Online payments (Stripe / Razorpay)
- ⭐ Driver & rider ratings
- 🔔 Push notifications
- 💬 In-app chat
- 📊 Admin dashboard & analytics
This project is licensed under the MIT License.