https://github.com/kibeno7/eMotion
eMotion is a scalable, microservices-based ride-hailing platform featuring real-time ride notifications via WebSocket, robust service communication through RabbitMQ, and efficient request routing using Nginx as a reverse proxy. The backend is containerized with Docker Compose and deployed on Azure VM, while the frontend is hosted on Vercel.
https://github.com/kibeno7/eMotion
docker docker-compose express microservices mongodb nginx-proxy nodejs rabbitmq typescript websockets
Last synced: 6 months ago
JSON representation
eMotion is a scalable, microservices-based ride-hailing platform featuring real-time ride notifications via WebSocket, robust service communication through RabbitMQ, and efficient request routing using Nginx as a reverse proxy. The backend is containerized with Docker Compose and deployed on Azure VM, while the frontend is hosted on Vercel.
- Host: GitHub
- URL: https://github.com/kibeno7/eMotion
- Owner: alucard017
- Created: 2025-06-09T14:49:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-26T05:21:16.000Z (about 1 year ago)
- Last Synced: 2025-07-07T19:45:41.081Z (12 months ago)
- Topics: docker, docker-compose, express, microservices, mongodb, nginx-proxy, nodejs, rabbitmq, typescript, websockets
- Homepage: https://e-motion-eight.vercel.app
- Size: 3.91 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# β‘eMotion
- **eMotion** is a scalable, event-driven ride-hailing platform built with Node.js, Express.js, MongoDB, WebSockets, and RabbitMQ.
- It supports real time ride management with WebSocket notifications and microservice communication for a smooth user experience.
---
## π Architecture Overview
eMotion uses a microservices architecture featuring:
- **Nginx** as a reverse proxy and load balancer.
- **Docker Compose** to containerize and decouple services.
- **RabbitMQ** for reliable message queuing and asynchronous communication.
- **WebSocket server** for real-time ride event notifications.
- **MongoDB** to store user, captain, and ride data.
- **Multiple microservices** for User, Captain, Ride, and Central Websocket based Notification handling.
### π Communication Flow
1. Users and captains authenticate via JWT-secured REST endpoints.
2. Ride requests are created and managed via REST APIs.
3. Ride status updates (accept, start, end) are propagated via RabbitMQ events.
4. WebSocket server pushes real-time notifications to users and captains.
5. Nginx routes incoming requests to appropriate microservices.
---
## βοΈ Tech Stack
| Technology | Purpose |
| -------------- | -------------------------------------------- |
| Node.js | Backend runtime |
| Express.js | REST API framework |
| MongoDB | Persistent data storage |
| RabbitMQ | Message queue for microservice communication |
| WebSocket | Real-time notifications |
| Nginx | Reverse proxy & load balancing |
| Docker Compose | Container orchestration |
| Azure VM | Hosting backend infrastructure |
| Vercel | Frontend deployment |
---
## π Features
- β
User & Captain registration and JWT authentication
- β
REST APIs for ride creation, acceptance, start, and completion
- β
Real-time ride event notifications via WebSocket with sub-10ms latency
- β
Reliable, decoupled microservices communication using RabbitMQ
- β
Scalable multi-instance backend containerized with Docker Compose
- β
Nginx reverse proxy managing load balancing between services
---
## π Performance Metrics from Load Testing
- Successfully handled **306+ concurrent WebSocket sessions** with average connection latency under **10ms**
- Supported over **393 ride event checks** with **74% success rate** at peak load (15 VUs, 8 mins)
- Average HTTP request duration: **~11.5 seconds**, median: **1.78 seconds** under stress
- Maintained **100% successful user and captain logins** during tests
- RabbitMQ ensured reliable asynchronous messaging with minimal overhead and zero message loss
- Dockerized microservices maintained clear separation and easy scaling in Azure VM environment
---
## π οΈ Deployment & Setup
- Frontend is currently hosted on `https://e-motion-eight.vercel.app`
- Backend is currently hosted on `https://distros.tech`
### 1. Prerequisites
- Docker & Docker Compose installed
- Azure Virtual Machine for backend deployment
- Nginx installed on VM as reverse proxy
- MongoDB instance (can be hosted or containerized)
- RabbitMQ instance running (can be containerized)
- Vercel account for frontend hosting
### 2. Clone the repository
```bash
git clone https://github.com/alucard017/eMotion-Backend.git
cd eMotion-Backend
git clone https://github.com/alucard017/eMotion-frontend.git
cd eMotion-frontend
```
### 3. Configure environment variables
- Create a `.env` file inside each user, ride, captain services following `.env.sample` with values like:
- Creating `.env` is optional if you want to directly provide `environments` via `docker-compose`.
- If not using docker-compose you need to run the` gateway server` or else if using docker-compose you need to run `nginx` and configure `nginx.conf `as given as sample.
- `docker-compose file sample` is also provided to follow the structure strictly.
### 4. Running services
- For frontend it will be running on `localhost:3000` if `3000` port is not available it will run in port `3001` alterntaively.
- Make sure to add `.env `variable in frontend too and make sure to use the `API_BASE_UR`L of backend to make API calls. Currently frontend assumes the request comes from hosted frontend and backend so `API_BASE_URL` is ignored.
- For backend if not using docker-compose simply go to `each service folders` and run.
```bash
npm run build
npm run start
```
- Service will start successfuly.
- Make sure that all services will be connected via `gateway server`.
- If using docker-compose then just run the below command
```bash
docker-compose up --build -d
```
- You can see the logs by
```bash
docker compose logs -f
```
- Make sure when using `docker-compose`, place `nginx.conf` as in the `same file` where docker-compose lies.