Harry is a personal project exploring a microservices architecture to process returned items in a warehouse. It uses NATS for messaging and Centrifugo with WebSockets to notify fulfillment clients in real time, which helps unblock fulfillment items.
- Docker & Docker Compose
- Make
-
Start all services:
make run-all
This will automatically:
- Start infrastructure services (PostgreSQL, NATS, Redis, Centrifugo)
- Create databases and run migrations
- Build and start all microservices
-
Generate Centrifugo token for WebSocket testing:
docker exec -it centrifugo centrifugo gentoken -u 123722Copy the generated token for use in
.envfiles and Postman.
-
Create test data in fulfillment database:
INSERT INTO dbo.fulfillment (id, order_id, sku, quantity, status, fulfilled_at) VALUES(nextval('dbo.fulfillment_id_seq'::regclass), 10, 'sku-1234', 2, 'blocked', CURRENT_TIMESTAMP); SELECT id, order_id, sku, quantity, status, fulfilled_at FROM dbo.fulfillment;
-
Connect to WebSocket using Postman:
Connect to:
ws://localhost:8000/connection/websocket?cf_ws_frame_ping_pong=trueSend these messages:
{"id": 1, "connect": { "token": "<the_generated_token>"}} {"id": 2, "subscribe": {"channel": "fulfillment.order_unblocked"}} -
Test the return item API:
curl --location 'http://localhost:8080/return-item' \ --header 'Content-Type: application/json' \ --data '{ "sku": "sku-5234", "quantity": 2 }'
make run-all- Build and start all services (detached)make dev-up- Build and start all services (foreground with logs)make stop-all- Stop all servicesmake logs- View logs from all servicesmake restart- Restart all services
See the Makefile for individual service build/run commands for development.
