Empat service yang saling terhubung untuk mendemonstrasikan alur order → product/payment → notification.
Client ──> Order Service ──> Payment Service ──> Notification Service
│
└────────────> Product Service
| Service | Tech | Port | Database |
|---|---|---|---|
| order-service | Java 21 + Spring Boot 3 | 8080 | orderdb |
| product-service | Bun + TypeScript | 3000 | productdb |
| payment-service | Go 1.22 (net/http + pgx) | 8081 | paymentdb |
| notification-service | Node.js 20 + Express | 3001 | notificationdb |
| postgres | PostgreSQL 16 | 5432 | semua di atas |
docker compose up --buildPostgreSQL akan otomatis membuat empat database lewat init-db.sh. Tiap service melakukan migrasi tabel saat startup.
-
Lihat daftar product:
curl http://localhost:3000/products
-
Buat order — order-service akan memanggil product-service (ambil harga, kurangi stock) lalu payment-service (yang lalu memberi tahu notification-service):
curl -X POST http://localhost:8080/orders \ -H "Content-Type: application/json" \ -d '{ "customer": "yoel@example.com", "productId": 1, "quantity": 1, "paymentMethod": "CARD" }'
-
Cek notifikasi yang sudah dikirim:
curl http://localhost:3001/notifications
Setiap service punya konfigurasi default yang menunjuk ke localhost:5432 (kredensial demo/demo). Pastikan PostgreSQL berjalan dan database sudah ada, lalu:
order-service:./mvnw spring-boot:run(ataumvn spring-boot:run)product-service:bun install && bun run devpayment-service:go run .notification-service:npm install && npm run dev
.
├── docker-compose.yml
├── init-db.sh
├── order-service/ # Java Spring Boot 3
├── product-service/ # Bun + TypeScript
├── payment-service/ # Go
└── notification-service/ # Node.js