This project is a microservices-based Uber clone with separate services for user management, ride handling, and captain operations. The services communicate using RabbitMQ for asynchronous messaging.
- User Service: Registration, login, logout, profile management, and ride acceptance.
- Captain Service: Registration, login, logout, profile management, availability toggle, and ride handling.
- Ride Service: Ride creation and acceptance.
- Authentication: JWT-based authentication for secure API endpoints.
- Asynchronous Communication: Uses RabbitMQ (
amqplib
) for message passing between services.
- Backend Framework: Express.js
- Database: MongoDB (via Mongoose)
- Authentication: JWT & Bcrypt
- Message Queue: RabbitMQ (
amqplib
) - HTTP Requests: Axios (only in Ride Service)
- Environment Management: Dotenv
Handles captain-related actions such as registration, authentication, and ride availability.
POST /register
- Register a new captainPOST /login
- Login captainGET /logout
- Logout captainGET /profile
- View captain profile (Authenticated)PATCH /toggle-availability
- Toggle captain availability (Authenticated)GET /new-ride
- Listen for new ride requests (Authenticated)
"amqplib": "^0.10.5",
"bcrypt": "^5.1.1",
"cookie-parser": "^1.4.7",
"dotenv": "^16.4.7",
"express": "^4.21.2",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.10.0",
"morgan": "^1.10.0"
Manages user authentication, profiles, and accepted rides.
POST /register
- Register a new userPOST /login
- Login userGET /logout
- Logout userGET /profile
- View user profile (Authenticated)GET /accepted-ride
- Fetch accepted rides (Authenticated)
"amqplib": "^0.10.5",
"bcrypt": "^5.1.1",
"cookie-parser": "^1.4.7",
"dotenv": "^16.4.7",
"express": "^4.21.2",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.10.1"
Handles ride creation and acceptance.
POST /create-ride
- Create a new ride (User Authenticated)POST /accept-ride
- Accept a ride (Captain Authenticated)
"amqplib": "^0.10.5",
"axios": "^1.7.9",
"bcrypt": "^5.1.1",
"cookie-parser": "^1.4.7",
"dotenv": "^16.4.7",
"express": "^4.21.2",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.10.1"
- Node.js (>=14.x)
- MongoDB (running locally or via cloud)
- RabbitMQ (for message queueing)
- Clone the repository:
git clone https://github.com/your-username/uber-microservices.git cd uber-microservices
- Install dependencies for each service:
cd captain && npm install cd ../user && npm install cd ../ride && npm install
- Create
.env
files for each service:- Example:
PORT=5000 MONGO_URI=mongodb://localhost:27017/uber_service JWT_SECRET=your_jwt_secret RABBITMQ_URL=amqp://localhost
- Example:
- Start MongoDB and RabbitMQ.
- Run each service:
cd captain && npm start cd ../user && npm start cd ../ride && npm start
- Uses JWT (JSON Web Tokens) for secure API access.
- Include
Authorization: Bearer <token>
in headers for protected routes.
- Implement WebSockets for real-time ride updates
- Add payment integration (Stripe, PayPal, etc.)
- Enhance logging and monitoring
This project is licensed under the MIT License.