🚖 Advanced Uber-style Ride Hailing Backend 📌 Built with MERN + Microservices | Features: Real-time, Scalable, GeoSpatial, Authentication 🎯 Learning Project showcasing backend architecture, realtime communication, and microservices in practice.
This project is a learning-focused Uber-style ride hailing system built with MERN stack and a microservices architecture. It simulates how a real-world ride-sharing app like Uber works: riders request trips, drivers accept, live tracking happens, and payments are processed.
- 🔐 Authentication & Authorization (JWT, role-based: Rider, Driver, Admin)
- 🌍 GeoSpatial Queries using MongoDB
2dsphere(find nearby drivers) - ⚡ Real-time Communication with Socket.io (driver–rider live updates)
- 🧩 Microservices Architecture (Auth, Users, Drivers, Trips, Payments)
- 💳 Payment Flow (mock/Stripe for learning)
- 📊 Scalable Project Structure with API gateway & shared modules
- 📝 Logging & Activity Tracking for trip lifecycle
- Frontend: React, TailwindCSS (for Rider/Driver/Admin dashboards)
- Backend: Node.js, Express, Socket.io
- Database: MongoDB (with GeoSpatial queries), Redis (for caching/sessions)
- Auth: JWT + Role-based access control
- Others: Docker (for containerized services), Mapbox/Google Maps APIs
/server
/services
auth/
users/
drivers/
trips/
payments/
/gateway # API Gateway
/common # shared utilities, constants, models
/client-rider # React frontend for riders
/client-driver # React frontend for drivers
/admin-dashboard # Admin UI
- Understand microservices design in Node.js
- Practice real-time systems with Socket.io
- Work with GeoSpatial data in MongoDB
- Learn event-driven architecture for ride lifecycle
- Build a scalable and modular project for future apps
-
Clone the repo
git clone https://github.com/OwaisZakir/Advance-Backend-Microservices-Ubar-Project.git
-
Install dependencies for backend services
cd server/services/auth && npm install
(repeat for other services as needed)
-
Setup environment variables (
.env)MONGO_URI=your_mongo_url JWT_SECRET=your_secret SOCKET_PORT=5000 -
Run services
npm start
-
(Optional) Run client apps in their respective folders
Registers a new user into the system.
Request Body:
{
"fullName": {
"firstName": "John",
"lastName": "Doe"
},
"email": "johndoe@example.com",
"password": "password123"
}Validations:
fullName.firstName→ minimum 3 characters requiredemail→ must be a valid email addresspassword→ minimum 6 characters required
Responses:
- ✅ 201 Created → Returns
tokenanduserobject - ❌ 400 Bad Request → Validation errors
- ❌ 500 Internal Server Error → Server issues
Response Example (201):
{
"token": "<jwt_token>",
"user": {
"_id": "65f1b0c2e4b8f1a2b3c4d5e6",
"fullName": {
"firstName": "John",
"lastName": "Doe"
},
"email": "johndoe@example.com"
}
}Logs in an existing user and returns an authentication token.
Request Body:
{
"email": "johndoe@example.com",
"password": "password123"
}Validations:
email→ must be a valid email addresspassword→ minimum 6 characters required
Responses:
- ✅ 200 OK → Returns
tokenanduserobject - ❌ 400 Bad Request → Validation errors
- ❌ 401 Unauthorized → Invalid email or password
- ❌ 500 Internal Server Error → Server issues
Response Example (200):
{
"token": "<jwt_token>",
"user": {
"_id": "65f1b0c2e4b8f1a2b3c4d5e6",
"fullName": {
"firstName": "John",
"lastName": "Doe"
},
"email": "johndoe@example.com"
}
}Fetches the profile of the currently authenticated user.
Authentication:
- Requires JWT token (sent in
Authorizationheader asBearer <token>or as cookie).
Responses:
- ✅ 200 OK → Returns
userobject of the logged-in user - ❌ 401 Unauthorized → Missing or invalid token
Response Example (200):
{
"user": {
"_id": "65f1b0c2e4b8f1a2b3c4d5e6",
"fullName": {
"firstName": "John",
"lastName": "Doe"
},
"email": "johndoe@example.com"
}
}Logs out the currently authenticated user.
Authentication:
- Requires JWT token (sent in
Authorizationheader asBearer <token>or as cookie).
Responses:
- ✅ 200 OK → User logged out successfully
- ❌ 401 Unauthorized → Missing or invalid token
Response Example (200):
{
"message": "Logged out successfully"
}✨ Built with passion for learning & backend mastery. 🚀