A cloud-native microservices backend for a ride-hailing application, built as part of the SE360 course at UIT.
UIT-Go is a backend system that allows:
- Passengers to register, book trips, and track drivers in real-time
- Drivers to go online, receive trip requests, and update their location
| Component | Technology |
|---|---|
| User Service | NestJS + PostgreSQL |
| Trip Service | Spring Boot + PostgreSQL |
| Driver Service | Spring Boot + Redis |
| Notification Service | NestJS + RabbitMQ + Socket.IO |
| API Gateway | Kong (DB-less mode) |
| Infrastructure | Docker, Terraform, Azure |
| Service | Port | Description |
|---|---|---|
| Kong Gateway | 8000 | API routing, JWT validation |
| User Service | 3000 | Authentication, user profiles |
| Trip Service | 8081 | Trip lifecycle, fare calculation |
| Driver Service | 8082 | Location tracking, driver matching |
| Notification Service | 3001 | WebSocket notifications |
| RabbitMQ | 5672, 15672 | Message broker |
| PostgreSQL (User) | 5433 | User database |
| PostgreSQL (Trip) | 5434 | Trip database |
| Redis | 6379 | Driver locations & cache |
- Docker Desktop (v20.10+)
- Git
- Azure CLI
- Azure subscription with credits
- GitHub account (for CI/CD)
git clone https://github.com/Ama2352/UIT-Go.git
cd UIT-GoThe system uses RS256 (asymmetric) JWT tokens. Generate key pair:
# Create keys directory
mkdir -p services/user-service
mkdir -p services/shared
# Generate private key (for User Service)
openssl genrsa -out services/user-service/private.pem 2048
# Generate public key (shared across services)
openssl rsa -in services/user-service/private.pem -pubout -out services/shared/public.pemCreate .env file in the root directory:
# User Service
USERDB_USERNAME=postgres
USERDB_PASSWORD=postgres
USERDB_DATABASE=user-db
DATABASE_URL=postgresql://postgres:postgres@user-postgres:5432/user-db
# Trip Service
TRIPDB_USERNAME=postgres
TRIPDB_PASSWORD=postgres
TRIPDB_DATABASE=trip-db
TRIPDB_URL=jdbc:postgresql://trip-postgres:5432/trip-db
# JWT
JWT_EXPIRES_IN=7d
# RabbitMQ
RABBITMQ_USER=guest
RABBITMQ_PASSWORD=guestdocker compose up -d --buildThis will start:
- 2 PostgreSQL databases
- 1 Redis instance
- 1 RabbitMQ message broker
- 4 application services (User, Trip, Driver, Notification)
- 1 Kong API Gateway
Wait about 30 seconds for all services to start, then check:
# Check all containers are running
docker compose ps
# Test Kong Gateway
curl http://localhost:8000
# Test User Service
curl http://localhost:8000/users/health
# Test Trip Service
curl http://localhost:8000/trips/health
# Test Driver Service
curl http://localhost:8000/drivers/health| Service | URL |
|---|---|
| API Gateway | http://localhost:8000 |
| RabbitMQ Management | http://localhost:15672 (guest/guest) |
| User Service (direct) | http://localhost:3000 |
| Trip Service (direct) | http://localhost:8081 |
| Driver Service (direct) | http://localhost:8082 |
| Notification Service (direct) | http://localhost:3001 |
# View logs for all services
docker compose logs -f
# View logs for specific service
docker compose logs -f user-service
# Restart all services
docker compose restart
# Stop all services
docker compose down
# Stop and remove volumes (reset databases)
docker compose down -vThe project uses GitHub Actions for automated deployment to Azure.
- Create Azure Service Principal:
az login
az ad sp create-for-rbac \
--name "uitgo-github-actions" \
--role Contributor \
--scopes /subscriptions/<YOUR_SUBSCRIPTION_ID>- Add GitHub Secrets (Repository → Settings → Secrets):
| Secret | Value |
|---|---|
AZURE_CLIENT_ID |
App ID from step 1 |
AZURE_CLIENT_SECRET |
Password from step 1 |
AZURE_SUBSCRIPTION_ID |
Your Azure subscription ID |
AZURE_TENANT_ID |
Tenant ID from step 1 |
- Go to Actions → Infrastructure - Terraform
- Click Run workflow → Select apply
- Wait ~10 minutes for VM creation
- CD workflow will automatically deploy the application
Access at: http://<VM_PUBLIC_IP>:8000
# Create resource group
az group create --name uit-go-rg --location southeastasia
# Create VM
az vm create \
--resource-group uit-go-rg \
--name uit-go-vm \
--image Ubuntu2204 \
--size Standard_B2s \
--admin-username azureuser \
--generate-ssh-keysssh azureuser@<VM_PUBLIC_IP>curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
# Logout and login againgit clone https://github.com/Ama2352/UIT-Go.git
cd UIT-Go
# Create .env file (same as local development)
nano .env
# Generate JWT keys
openssl genrsa -out services/user-service/private.pem 2048
openssl rsa -in services/user-service/private.pem -pubout -out services/shared/public.pem
# Start services
docker compose up -d --buildaz vm open-port --resource-group uit-go-rg --name uit-go-vm --port 8000
az vm open-port --resource-group uit-go-rg --name uit-go-vm --port 80All requests go through Kong Gateway at port 8000.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /users/register |
Register new user | No |
| POST | /users/login |
Login, get JWT token | No |
| GET | /users/profile |
Get current user profile | Yes |
| PUT | /users/profile |
Update profile | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /trips/estimate |
Estimate fare | Yes |
| POST | /trips |
Create new trip | Yes |
| GET | /trips/{id} |
Get trip details | Yes |
| POST | /trips/{id}/cancel |
Cancel trip | Yes |
| POST | /trips/{id}/start |
Start trip (driver) | Yes |
| POST | /trips/{id}/complete |
Complete trip (driver) | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| PUT | /drivers/location |
Update driver location | Yes |
| POST | /drivers/online |
Go online | Yes |
| POST | /drivers/offline |
Go offline | Yes |
| POST | /drivers/trips/{id}/accept |
Accept trip | Yes |
| GET | /drivers/nearby?lat=...&lng=... |
Find nearby drivers | Yes |
| Endpoint | Service | Description |
|---|---|---|
ws://host:3001/notifications |
Notification Service | Real-time trip updates |
ws://host:8082/ws/driver-location |
Driver Service | GPS streaming |
| Document | Description |
|---|---|
| ARCHITECTURE.MD | System architecture diagrams |
| REPORT_PHASE2.md | Final project report |
| docs/DESIGN_DECISIONS.md | Technology choices and trade-offs |
| docs/CHALLENGES.md | Challenges faced and solutions |
| docs/FUTURE.md | Results and future improvements |
| docs/ADR/ | Architectural Decision Records |
