This logistics platform is designed for connecting clients to vehicle drivers using a microservices architecture, focusing on modular, scalable, and efficient systems for real-time tracking, booking, and driver management.
-
Microservices Architecture Independent Services: Booking, driver management, and real-time tracking are separated, allowing for independent scaling and maintenance. Trade-offs: Easier scalability but added complexity in communication and data consistency handled via REST APIs and message queues.
-
Real-time Updates with WebSockets WebSockets (Socket.io): Used for low-latency real-time driver location updates. Challenges: Handling scalability of concurrent WebSocket connections.
-
Asynchronous Job Processing BullMQ: Used for async job handling (e.g., driver assignment), improving responsiveness. Retries & Error Handling: Built-in support for retries and task prioritization.
-
Caching & Data Management Redis: For caching driver data, improving read performance and reducing database load. Cron Job: Driver ratings are updated daily via a scheduled cron job to ensure rating accuracy.
-
Scalability & Traffic Management Database Optimization: Indexed fields and MongoDB geospatial queries for efficient nearest-driver searches. Rate Limiting: Prevents abuse by limiting API requests. Stateless Backend: Backend is stateless, allowing easy horizontal scaling.
-
Surge Price Tracking Price tracking based on the distance between the two coordinates.
-
Future Scalability Kubernetes: Planned for container orchestration, enabling auto-scaling and self-healing services. Multi-region Deployment: Support for global multi-region deployment, reducing latency and improving fault tolerance.
- React: Used for building the user interface.
- React Router: For client-side routing.
- Leaflet & React-Leaflet: Used for mapping and location-based services.
- Axios: For making HTTP requests.
- Node.js & Express: Backend framework for handling requests and routing.
- MongoDB & Mongoose: Database and ORM for storing and managing data.
- JWT (jsonwebtoken): For handling user authentication and security.
- Zod: For schema validation.
- Bcryptjs: For hashing passwords.
- Cronjon: For updating driver ratings every 24 hours.
- Bullmq: For assigning drivers through a queue system.
- Redis: For caching of driver and current session data.
- Node.js: Ensure you have Node.js installed on your system.
-
Fork the Repository
-
Clone the Repository:
git clone ${url_of_your_forked_repo} cd logistics-platform
-
Setup the Client:
cd frontend npm install -
Setup the Server:
cd ../backend npm install -
Create a
.envFile:-
In the
backenddirectories, create a.envfile and add the necessary environment variables. -
Example for
server/.env:MONGO_URI=your_mongodb_uri JWT_SECRET_KEY=your_jwt_secret_key GOOGLE_API_KEY=your_google_api_key SESSION_SECRET=your_secret
-
-
Start the backend
cd backend npm run dev -
Start the frontend
cd ../frontend npm run start
- Open your browser and go to http://localhost:3000 to view the application.










