- Node.js 18+ and npm (or pnpm/yarn)
- Git (optional)
git clone <this-repo> inventory-prototype
cd inventory-prototype
npm install# Creates data folder if it doesn't exist and starts the server (server initializes DB automatically)
npm startcurl -s http://localhost:3000/inventory/sku-123 | jq .or
curl http://localhost:3000/inventory/sku-123 | ConvertFrom-Jsoncurl -X POST http://localhost:3000/inventory/sku-123/adjust \
-H "Content-Type: application/json" \
-H "X-Store-Id: store-1" \
-H "Idempotency-Key: my-op-123" \
-d '{"delta": -2, "expectedVersion": 5}'curl -X PUT http://localhost:3000/inventory/sku-123 \
-H "Content-Type: application/json" \
-H "X-Store-Id: store-1" \
-d '{"quantity": 10}'npm test # Run all tests
npm run test:coverage # Run with coverageSee postman-examples.md for comprehensive API testing examples.
- This prototype is deliberately simple: the intention is to demonstrate architectural decisions and key mechanisms (optimistic locking, idempotency, local transactions).
- For production it's recommended to: migrate event bus to Kafka/Kinesis, use Redis for read cache, add TLS/JWT, and deploy services in containers + autoscaling.
- More examples at postman-examples.md