RideX is a full-stack ride-booking platform for passengers, drivers, and administrators. It is designed as an independently engineered portfolio project with secure authentication, driver verification, location-aware fare estimates, ride matching, real-time updates, payments architecture, ratings, notifications, and operations tooling.
- JWT authentication with bcrypt password hashing
- Role-based access for passengers, drivers, and admins
- Driver onboarding and admin verification
- Leaflet/OpenStreetMap maps with place search and route previews
- Backend-owned fare calculation for bike, auto, and cab
- Ride lifecycle with guarded state transitions
- Nearby driver matching using MongoDB geospatial queries
- Driver acceptance with atomic assignment protection
- Socket.IO ride status and driver location updates
- Payment model with cash settlement and online-provider guard
- Completed-ride ratings with duplicate prevention
- Persistent and live notifications
- Admin statistics and driver verification dashboard
- Responsive React application with lazy-loaded routes
- Frontend: React, Vite, React Router, Axios, Leaflet, Socket.IO Client, Lucide React
- Backend: Node.js, Express, Mongoose, MongoDB Atlas, JWT, bcryptjs, Socket.IO
- External services: OpenStreetMap tiles, Nominatim geocoding, OSRM routing
React UI
-> Axios / Socket.IO
-> Express routes and middleware
-> Controllers
-> Services
-> Mongoose models
-> MongoDB
Authentication is enforced by JWT middleware. Roles are loaded from MongoDB after token verification. Ride prices are recalculated on the backend, and driver assignment uses a conditional database update.
client/
src/api/ Axios API modules
src/components/ Reusable UI and map components
src/context/ Authentication context
src/hooks/ Socket.IO hooks
src/pages/ Routed application pages
server/
config/ Database connection
controllers/ HTTP request handlers
middleware/ Authentication, roles, and errors
models/ User, Driver, Ride, Payment, Rating, Notification
routes/ Express route modules
services/ Fare, ride, matching, and notification logic
socket/ Socket.IO server and event emitters
test/ Node.js core tests
Prerequisites: Node.js 20+, MongoDB database, and a modern browser.
cd server
npm install
Copy-Item .env.example .env
cd ..\client
npm install
Copy-Item .env.example .envReplace placeholder values in .env files. Never commit real credentials.
Terminal 1:
cd server
npm run devTerminal 2:
cd client
npm run devClient: http://localhost:5173
Backend: http://localhost:5000
Server variables are documented in server/.env.example. Client variables are documented in client/.env.example.
Required server values:
MONGO_URIJWT_SECRETCLIENT_URL
Optional payment values are only used when a real provider integration is configured. Secrets must remain server-side.
POST /api/auth/registerPOST /api/auth/loginGET /api/auth/me
POST /api/drivers/onboardingGET /api/drivers/me/statusPATCH /api/drivers/me/onlinePOST /api/ridesGET /api/ridesPATCH /api/rides/:rideId/cancelGET /api/driver-rides/requestsPOST /api/driver-rides/:rideId/acceptPATCH /api/driver-rides/:rideId/status
GET /api/payments/historyPOST /api/payments/:rideId/createPOST /api/payments/:rideId/confirm-cashPOST /api/ratings/:rideIdGET /api/ratings/ride/:rideIdGET /api/notificationsPATCH /api/notifications/read-all
GET /api/admin/statsGET /api/admin/users?page=1GET /api/admin/rides?page=1GET /api/drivers?status=pendingPATCH /api/drivers/:driverId/verification
cd server
npm test
cd ..\client
npm run lint
npm run buildThe current automated backend tests cover fare calculations and ride lifecycle transitions. API workflows should additionally be exercised with Thunder Client using passenger, approved driver, and admin accounts.
Authenticated Socket.IO clients join a user room and authorized ride rooms. Drivers publish validated GeoJSON locations; the server persists them and broadcasts updates to the passenger room. REST ride changes also emit Socket.IO status events.
User: identity, credentials, and roleDriver: vehicle, verification, availability, rating, and locationRide: participants, route, fare, payment, and lifecyclePayment: one payment record per rideRating: reviewer, reviewed user, ride, score, and commentNotification: recipient, event type, read state, and optional ride
Recommended deployment:
- Frontend: Vercel, with
VITE_API_URLandVITE_SOCKET_URL - Backend: Render or another Node-compatible host
- Database: MongoDB Atlas
Configure production CORS using the deployed frontend origin. Set production secrets through the hosting provider, not source control. The payment provider integration remains guarded until server-side order creation and signature verification are configured.
Add screenshots of the landing page, booking map, driver desk, and admin operations dashboard before publishing the portfolio repository.
- Complete Razorpay order creation and signature verification
- Cloudinary document uploads
- Dedicated active-ride and driver navigation pages
- Automated API and Socket.IO integration tests
- Analytics charts and richer admin filtering
- Production map-provider quotas and observability
Built by the RideX project author as a full-stack portfolio application.