This project is a microservices-based Forex Simulation platform, consisting of:
- customer-service: Manages customer data
- order-service: Handles forex orders
- currency-service: Manages currency information
Each service is a Spring Boot application with a PostgreSQL database, orchestrated via Docker Compose.
-
Clone the repository
-
Build and start all services:
docker-compose up --build
This will build all services and start them along with their respective PostgreSQL databases.
-
Access the services:
- Customer Service: http://localhost:8081
- Order Service: http://localhost:8082
- Currency Service: http://localhost:8083
- Base URL:
http://localhost:8081 - Endpoints:
GET /customers/{id}— Get customer by IDPOST /customers/create— Create a new customer- Body:
{ "name": "John Doe", "email": "john@example.com"}
- Body:
- Base URL:
http://localhost:8082 - Endpoints:
GET /orders/{id}— Get order by IDPOST /orders— Create a new order- Body:
{ "currencyFrom": "USD", "currencyTo": "AMD", "amount": 1000 }
- Body:
- Base URL:
http://localhost:8083 - Endpoints:
GET /rates— Get current ratePOST /simulate— Simulate rate change
- Create Customer
Response:
curl -X POST http://localhost:8081/api/v1/customers/create -H "Content-Type: application/json" -d '{"name":"John Doe","email":"john@example.com"}'
{ "id": 1, "name": "John Doe", "email": "john@example.com" }
- Create Order
Response:
curl -X POST http://localhost:8082/api/v1/orders/create -H "Content-Type: application/json" -d '{"currencyFrom": "USD", "currencyTo": "AMD", "amount": 1000}'
{ "id": 1, "currencyFrom": "USD", "currencyTo": "AMD", "amount": 1000 }
If enabled, Swagger UI is typically available at /swagger-ui.html for each service (e.g., http://localhost:8081/swagger-ui.html).
- Update API endpoints and sample payloads as needed to match your actual implementation.
- Ensure Docker is running before executing
docker-compose up --build.