System brief
The backend supports customers, cashiers, and administrators without collapsing their permissions into one controller. Loyalty commands pass through authentication, rate policy, idempotency checks, and service rules before state changes are accepted.
Key engineering decisions
- Safe retriesIdempotency handling protects transaction-style commands from repeated client requests.
- Abuse boundaryBucket4j token buckets apply per-IP and per-user policies, with explicit cleanup for inactive local buckets.
- Bounded workAn expired-redemption job processes a fixed batch every five minutes instead of attempting an unbounded sweep.
- VisibilitySpring Actuator, Micrometer, and Prometheus expose health and runtime metrics; request logging and audits provide operational context.