Distributed backend for a simplified food ordering platform built with Java, Spring Boot, Docker, and Kubernetes.
| Student | Responsibility |
|---|---|
| 1 | User Service + Spring Security (JWT) |
| 2 | Menu Service |
| 3 | Order Service |
| 4 | API Gateway + Docker Compose + Kubernetes |
Student 4 owns
docker-compose.ymland all files underk8s/. The other three must provide a workingDockerfilein their service folder.
FoodOrdering/
├── pom.xml ← parent POM (do not edit unless agreed)
├── .gitignore
├── docker-compose.yml ← owned by Student 4
├── README.md
│
├── user-service/ ← Student 1
├── menu-service/ ← Student 2
├── order-service/ ← Student 3
└── api-gateway/ ← Student 4
k8s/
├── user-service/ ← deployment.yml + service.yml (Student 4)
├── menu-service/
├── order-service/
└── api-gateway/
| Service | Local Port | Swagger UI |
|---|---|---|
| api-gateway | 8080 |
http://localhost:8080/swagger-ui/index.html |
| user-service | 8081 |
http://localhost:8081/swagger-ui/index.html |
| menu-service | 8082 |
http://localhost:8082/swagger-ui/index.html |
| order-service | 8083 |
http://localhost:8083/swagger-ui/index.html |
Each service uses its own isolated PostgreSQL database. Student 4 decides the host ports in docker-compose.yml.
| Service | Database name | Default local port (suggestion) |
|---|---|---|
| user-service | userdb |
5433 |
| menu-service | menudb |
5434 |
| order-service | orderdb |
5435 |
| api-gateway | — | no database |
Each service reads configuration from environment variables. Defaults are set in application.yml for local dev.
| Variable | Default (dev) | Description |
|---|---|---|
DB_HOST |
localhost |
PostgreSQL hostname |
DB_USERNAME |
postgres |
DB user |
DB_PASSWORD |
postgres |
DB password |
JWT_SECRET |
(set in application.yml) | Must be ≥32 chars |
| Variable | Default (dev) | Description |
|---|---|---|
MENU_SERVICE_HOST |
localhost |
Hostname used to call Menu Service |
MENU_SERVICE_PORT |
8082 |
Port of Menu Service |
| Variable | Default (dev) | Description |
|---|---|---|
USER_SERVICE_HOST |
localhost |
|
MENU_SERVICE_HOST |
localhost |
|
ORDER_SERVICE_HOST |
localhost |
Client → API Gateway (8080)
├─► /users/** → user-service (8081)
├─► /menu/** → menu-service (8082)
└─► /orders/** → order-service (8083)
order-service ──REST──► menu-service (validate + fetch menu items)
Communication uses plain REST/JSON. Order Service calls Menu Service to validate items before creating an order.
- JWT tokens are issued by user-service on login.
- menu-service and order-service validate the token on every request.
- The
JWT_SECRETvalue must be identical across all three services. - Roles:
CUSTOMER,ADMIN.
- Java 17+
- Maven 3.9+
- PostgreSQL (or Docker for containerised databases)
git clone <repo-url>
cd FoodOrderingmvn validateAll 4 modules (user-service, menu-service, order-service, api-gateway) should resolve without errors.
Create a local PostgreSQL database matching your service's DB name, then run:
# example for user-service
cd user-service
mvn spring-boot:runOr set env vars explicitly:
DB_HOST=localhost DB_USERNAME=postgres DB_PASSWORD=postgres mvn spring-boot:runmvn clean package -DskipTestsdocker-compose.yml and all files under k8s/ are owned by Student 4 and are currently empty.
Each other student must provide a working Dockerfile in their service root before Student 4 can wire everything together.
- Multi-stage build: Maven build → JRE runtime.
- Final image exposes the correct port (see table above).
- Reads configuration from environment variables (no hardcoded secrets).
| Branch | Purpose |
|---|---|
main |
Stable, deployable code |
develop |
Integration branch — merge feature branches here |
feature/<name> |
One branch per feature/task |
Workflow:
- Branch off
develop:git checkout -b feature/my-feature develop - Open a Pull Request targeting
develop. - At least one teammate must review before merging.
mainis updated only at the end of each week with a stable snapshot.
CREATED → CONFIRMED → COMPLETED
↓
CANCELLED
| Layer | Technology |
|---|---|
| Language | Java 17 |
| Framework | Spring Boot 3.2 |
| Security | Spring Security + JWT (jjwt 0.12) |
| Persistence | Spring Data JPA + PostgreSQL |
| Gateway | Spring Cloud Gateway (reactive) |
| API Docs | SpringDoc OpenAPI (Swagger UI) |
| Testing | JUnit 5 + Mockito |
| Containerisation | Docker |
| Orchestration | Kubernetes |
| Build | Maven (multi-module) |