A Node.js-powered Ride Booking API – an Uber Clone backend with real-time ride management, Redis queues, and MongoDB integration.
This project is ideal for learning or building ride-sharing, taxi booking, and Uber-like apps with robust scalable architecture.
- RESTful API for ride booking operations
- Real-time notifications using job queues
- MongoDB integration with Mongoose ODM
- Redis for caching and queue management
- BullMQ for background job processing
- Zod schema validation
- Comprehensive error handling and logging
- CORS enabled for cross-origin requests
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB (Mongoose)
- Cache/Queue: Redis (IORedis)
- Job Queue: BullMQ
- Validation: Zod
- Logging: Morgan
- Environment: dotenv
Make sure you have the following installed:
- Clone the repository:
git clone <repository-url>
cd rideBooking- Install dependencies:
npm install- Set up environment variables:
Create a
.envfile in the root directory with the following variables:
PORT=3000
MONGODB_URI=mongodb://localhost:27017/ridebooking
REDIS_URL=redis://localhost:6379
NODE_ENV=development
REDIS_PORT=6379
REDIS_HOST=localhost- Start MongoDB and Redis services on your system.
npm startThe server will start on the port specified in your environment variables (default: 7071).
The API is available at /api base path. Main endpoints include:
- Riders:
/api/riders- Rider management - Rides:
/api/rides- Ride booking and management
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 7071 |
MONGODB_URI |
MongoDB connection string | - |
REDIS_URL |
Redis connection string | - |
NODE_ENV |
Environment mode | development |
The application includes comprehensive error handling:
- Global error handler for unhandled errors
- Custom error classes for different error types
- Structured error responses
- Request logging with Morgan
The application uses BullMQ for handling background jobs:
- Job queues for asynchronous processing
- Worker processes for job execution
- Redis-backed job persistence
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.