A full-stack Uber clone application built with React, Node.js, Express, and MongoDB.
- Real-time ride tracking and updates
- User and Captain (Driver) authentication
- Route visualization using Google Maps
- Distance and fare calculation
- OTP verification for ride start
- Socket.IO integration for real-time communication
-
Authentication
Login.jsx- User login componentCaptainLogin.jsx- Captain login componentRegister.jsx- User registrationCaptainRegister.jsx- Captain registration
-
Maps & Location
CurrentLocationMap.jsx- Shows current locationRouteInMap.jsx- Displays ride route with markersPickupRouteMap.jsx- Shows route to pickup location
-
Ride Flow
DriverDetailPanel.jsx- Captain and vehicle detailsRideConfirmationPanel.jsx- Ride confirmation UIAcceptedRideUserDetailPanel.jsx- Ride details after acceptanceSearchingForVehiclePanel.jsx- Loading state while finding ride
-
Protected Routes
UserProtectedWrapper.jsxCaptainProtectedWrapper.jsxUserRidingProtectedWrapper.jsxCaptainRidingProtectedWrapper.jsx
Home.jsx- Main user dashboardCaptainHome.jsx- Captain dashboardRiding.jsx- Active ride viewRideStarted.jsx- Ongoing ride view
user.model.js- User schemacaptain.model.js- Captain schema with vehicle detailsride.model.js- Ride information schema
%%{init: {"theme": "dark", "themeVariables": { "background": "#2b2b2b" }}}%%
erDiagram
USER ||--o{ RIDE : "books"
CAPTAIN ||--o{ RIDE : "assigned_to"
USER {
String _id
Object fullname
String email
String password
String socketId
}
CAPTAIN {
String _id
Object fullname
String email
String password
String socketId
String status
Object vehicle
Object location
}
RIDE {
String _id
String pickup
String destination
Number distance
Number duration
Object fare
String status
String paymentId
String orderId
String signature
String vehicleType
String otp
}
/auth- Authentication endpoints/users- User management/captains- Captain management/ride- Ride operations/map- Location and routing services
auth.service.js- Authentication logicmap.service.js- Google Maps integrationride.service.js- Ride managementsocket.service.js- Real-time updates
- Clone the repository:
git clone <repository-url>- Install dependencies:
# Frontend
cd frontend
npm install
# Backend
cd backend
npm install- Environment Setup:
Create
.envfiles in both frontend and backend:
# Backend .env
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
GOOGLE_MAPS_API_KEY=your_google_maps_key
# Frontend .env
VITE_GOOGLE_MAP_API=your_google_maps_key
VITE_BASE_URL=http://localhost:5000- Start the servers:
# Backend
npm start
# Frontend
npm run dev- JWT authentication
- Protected routes
- OTP verification
- Role-based access control
- Socket room management
- Live location tracking
- Instant ride updates
- Captain-User chat
- Ride status notifications
- Frontend: React, TailwindCSS, GSAP, Socket.IO Client
- Backend: Node.js, Express, MongoDB, Socket.IO
- Maps: Google Maps API
- State Management: React Context
- Authentication: JWT
The application is fully responsive and optimized for:
- Desktop views
- Tablet views
- Mobile views
- User requests ride
- Nearby captains are notified
- Captain accepts ride
- OTP verification
- Ride starts
- Real-time tracking
- Ride completion
- Fork the repository
- Create a feature branch
- Commit changes
- Push to branch
- Open a Pull Request
MIT License - feel free to use this project for learning purposes.