A full-stack ride-hailing platform inspired by Uber, built with React, Node.js, Express, MongoDB, and Socket.io. Casby enables users to book rides, captains (drivers) to accept rides, and provides real-time location tracking and ride management.
- About the Project
- Features
- Tech Stack
- Getting Started
- Environment Variables
- API Endpoints
- Folder Structure
- Deployment
- Contributing
- License
Casby is a modern, scalable ride-hailing application. It allows users to register, log in, search for rides, and track their journey in real-time. Captains (drivers) can register, log in, receive ride requests, and update their location live. The platform uses WebSockets for real-time communication and Google Maps for geolocation and suggestions.
- User and Captain registration & authentication
- Secure JWT-based login/logout with token blacklisting
- Real-time ride requests and notifications via Socket.io
- Live location tracking for both users and captains
- Google Maps integration for address suggestions and route display
- Ride fare calculation based on distance
- Responsive, modern UI with Tailwind CSS
- Modular, scalable backend with Express and MongoDB
Frontend:
- React 19
- React Router DOM
- Tailwind CSS
- Axios
- @react-google-maps/api
- Socket.io-client
- React Icons, Lucide React
Backend:
- Node.js
- Express.js
- MongoDB & Mongoose
- Socket.io
- JWT (jsonwebtoken)
- bcrypt
- express-validator
- dotenv
- Node.js (v18+ recommended)
- npm or yarn
- MongoDB instance (local or cloud)
- Google Maps API Key
git clone https://github.com/yourusername/casby.git
cd casbycd backend
npm install
cp .env.example .env
# Edit .env with your MongoDB URI and JWT secret
npm startcd ../frontend
npm install
cp .env.example .env
# Edit .env with your backend base URL and Google Maps API key
npm run devPORT=3000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
VITE_BASE_URL=http://localhost:3000
VITE_GOOGLE_MAPS_API_KEY=your_google_maps_api_key
POST /api/user/register— Register a new userPOST /api/user/login— User loginGET /api/user/profile— Get user profile (auth required)GET /api/user/logout— Logout user (auth required)
POST /api/captain/register— Register a new captainPOST /api/captain/login— Captain loginGET /api/captain/profile— Get captain profile (auth required)GET /api/captain/logout— Logout captain (auth required)
GET /api/maps/get-suggestions?input=...— Get address suggestions (auth required)GET /api/maps/get-coordinates?address=...— Get coordinates for an address (auth required)GET /api/maps/get-distance-time?origin=...&destination=...— Get distance and time (auth required)
POST /api/ride/create— Create a new ride (user auth required)GET /api/ride/get-fare?pickup=...&destination=...— Get fare estimate (user auth required)POST /api/ride/confirm— Captain confirms a ride (captain auth required)GET /api/ride/start-ride?rideId=...&otp=...— Start ride with OTP (captain auth required)POST /api/ride/end-ride— End ride (captain auth required)
casby/
│
├── backend/
│ ├── [app.js]
│ ├── [server.js]
│ ├── config/
│ ├── controller/
│ ├── middleware/
│ ├── models/
│ ├── routes/
│ ├── services/
│ ├── [socket.js]
│ └── [README.md]
│
├── frontend/
│ ├── src/
│ │ ├── assets/
│ │ ├── components/
│ │ ├── context/
│ │ ├── pages/
│ │ ├── [App.jsx]
│ │ ├── [main.jsx]
│ │ └── [index.css]
│ ├── public/
│ ├── [package.json]
│ ├── [vite.config.js]
│ └── [README.md]
│
└── [README.md]
Deploy to services like Heroku, Render, or DigitalOcean. Set environment variables for production.
Deploy to Vercel, Netlify, or any static hosting. Set the production backend URL and Google Maps API key in the environment variables.
Contributions are welcome!
Please open issues or submit pull requests for improvements and bug fixes.
Steps to contribute:
# 1. Fork the repository
# 2. Create your feature branch
git checkout -b feature/your-feature
# 3. Commit your changes
git commit -am 'Add new feature'
# 4. Push to the branch
git push origin feature/your-feature
# 5. Open a pull requestThis project is licensed under the [MIT License]
Made with ❤️ for urban mobility.
.png)
.png)
.png)
.png)
.png)
.png)