← All cases

Retail · department store · 2023 — 2024

A purchase history spread across seven systems

A Redis cache layer in front of seven systems, refreshed in the background through SNS and SQS, so the purchase history waits on none of them.

The problem

In a department store's purchase history, customers see what they bought online and in store. That data lives in seven different systems —⁠among them an AS/400 and the e‑commerce platform⁠— and querying all of them while the customer waited made the screen slow.

AppRedisanswers right awaybackground refreshSNSqueuequeuequeuequeuequeuequeuequeue7 source systems
The app reads from Redis; each system refreshes on its own queue.

What I did

With another developer, I put a Redis cache layer in front of the seven systems. The app answers from Redis and the refresh happens in the background: an SNS topic fans the work out to one SQS queue per source system.

I set up the NestJS service that queries the stores' AS/400 and added it to the cache, so the history also showed in-store purchases, with their exchange ticket.

When generating that ticket's PDF started failing in production, we moved it to its own service: I did the PDF conversion and connected the history to it.

What happened

The history stopped waiting on seven systems to answer, and it added purchases made in physical stores.

What I took away

The most useful work I did there wasn't adding features: it was hiding the complexity of seven systems behind a screen that loads fast.

NestJS · Redis · AWS SNS/SQS · AS/400