A full-fledged Uber-like ride booking application built with the MERN stack, featuring real-time ride updates with Socket.IO and Google Maps integration for location search and live tracking.
- π€ User & Captain Authentication (JWT-based login/signup/logout).
- π Ride Booking System with live ride status (Looking, Waiting, Riding, Finished).
- πΊοΈ Google Maps API Integration for location search, suggestions, and live tracking.
- π Real-Time Communication between user and captain using Socket.IO.
- π‘οΈ Protected Routes for both users and captains.
- π± Modern React frontend styled with Tailwind CSS.
- π REST APIs with Express.js backend & MongoDB as database.
Frontend
- React 19
- Vite
- Tailwind CSS
- Socket.IO Client
- @react-google-maps/api
Backend
- Node.js + Express.js
- MongoDB + Mongoose
- Socket.IO
- JWT Authentication
- Axios
controllers/ β Handles request/response logic
db/ β Database connection (MongoDB)
middlewares/ β Authentication middleware
models/ β Mongoose schemas for User, Captain, Ride
routes/ β API routes (User, Captain, Ride, Maps)
services/ β Business logic & third-party integrations
socket.js β Socket.IO setup
app.js β Express app config
server.js β Entry point (runs server)
.env β Environment variables
components/ β Reusable UI components
context/ β React Contexts (User, Captain, Socket)
pages/ β Pages for Users & Captains
App.jsx β Routing setup
main.jsx β Entry point
.env β Frontend environment variables
git clone https://github.com/Sarg3n7/Uber-Clone.git
cd Uber-Clonecd Backend
npm installcd ../frontend
npm installBoth Backend and frontend have a .env.example file.
- Copy
.env.exampleβ.envcp .env.example .env
- Update your
.envwith actual values. Example:
Backend/.env
PORT=5000
MONGO_URI=for example : mongodb://0.0.0.0/uber-clone
JWT_SECRET=your_secret_key
GOOGLE_MAPS_API=your_google_maps_api_keyfrontend/.env
VITE_BASE_URL=http://localhost:4000
VITE_GOOGLE_MAPS_API_KEY=your_google_maps_api_key- Go to Google Cloud Console.
- Create a new project (or select an existing one).
- Navigate to APIs & Services β Credentials.
- Click Create Credentials β API Key.
- Copy the generated key and paste it into your
.envfiles. - Enable the following APIs:
- Maps JavaScript API
- Places API
- Geocoding API
cd Backend
npx nodemoncd frontend
npm run devOpen the frontend in your browser β http://localhost:5173 (default Vite port). Go to console and change the dimensions to a mobile screen.
- Signup/Login β
user.routes.jsβuser.controller.jsβuser.service.js - Book Ride β
ride.routes.jsβride.controller.jsβride.service.js - Get Suggestions β
maps.routes.jsβmap.controller.jsβmaps.service.js
- Signup/Login β
captain.routes.jsβcaptain.controller.jsβcaptain.service.js - Accept Ride β
ride.routes.jsβride.controller.jsβride.service.js
- Autocomplete & Place Details β
maps.service.js(Google Maps API)
- socket.js manages real-time ride updates.
- Used in UserContext and CaptainContext to emit/listen to ride events.
- Fork the repo
- Create your feature branch (
git checkout -b feature/foo) - Commit changes (
git commit -m 'Add foo') - Push to branch (
git push origin feature/foo) - Create a Pull Request
MIT License
Copyright (c) 2025 Sarg3n7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


