A lightweight microservices demo showing a Java Spring Boot Product Service and a Python FastAPI Pricing Service. The services communicate over REST and run with Docker Compose using PostgreSQL containers. A simple React frontend shows products and requests prices.
-
Product Service (Java / Spring Boot) — port 8080
- CRUD products
- Endpoint to fetch product price by calling Pricing Service
-
Pricing Service (Python / FastAPI) — port 8000
- Simple pricing logic (demo)
-
Frontend (React + Vite) — port 5173 (development server)
- Docker & Docker Compose
- (Optional) Java and Maven if you want to build locally, but Docker multi-stage build will run Maven inside the builder stage.
From the project root:
docker-compose up --buildWait for services to start. You can then:
- Create a product (example):
curl -X POST http://localhost:8080/products -H "Content-Type: application/json" -d '{"name":"T-Shirt","category":"Apparel","basePrice":29.99}'- Get product list:
curl http://localhost:8080/products- Get product price (calls pricing service):
curl http://localhost:8080/products/1/price- Open frontend: http://localhost:5173 and click "Get Price" for a product.
- The Product service uses
spring.jpa.hibernate.ddl-auto=updatefor demo ease. For production use explicit migrations (Flyway / Liquibase). - Optional improvements: add Redis caching for prices, use Kafka for price update events, secure endpoints with JWT, or add a React production build served by nginx.