Single-Table Inventory Demo
A tiny operations-style inventory system that updates machine and SKU counts, writes adjustment events, and shows why DynamoDB access patterns matter.
Problem
Inventory systems look simple until the business needs current stock, machine-level history, restock events, and auditability. This demo keeps the scope small while showing the data-model thought process.
Design
- Cognito and API Gateway protect the API.
- Lambda validates a machine, SKU, and stock delta.
- DynamoDB stores the current machine/SKU quantity and a separate event item under the same user partition.
- The browser receives the updated item plus a compact inventory list.
Access pattern
The live query is intentionally narrow: list the signed-in reviewer's current machine/SKU records. Event history is written with a separate sort-key prefix so the table can later support restock audit queries without changing storage engines.
Cost controls
Reviewer actions are limited to three per day, deltas are capped between -25 and 25, records expire with TTL, and the implementation reuses the existing provisioned DynamoDB table.