CourseAI Engineering: The Complete Course · Module 11: Data Stores · part 87 of 105
Part 87 · Module 11: Data Stores

Lab: Wire BrightCart's database, cache and jobs

16 min read·13 Oct 2026
Module 11 · Lab · About 70 minutes · Needs: lessons 1 to 4 of this module (SQL, PostgreSQL, caching, queues and storage)

What you are building

MODULE 11'S PIECE: ONE DATABASE, ONE CACHE, TWO JOBS assistant order lookup CachedOrders TTL 60 s Redis cache copies PostgreSQL + pgvector orders, tickets, articles, chunks Publish, timer enqueue RQ worker re-embed, report S3 bucket nightly CSV check_flow() runs all of it and asserts the counts
The finished piece: lookups go through CachedOrders (blue = BrightCart's code), Redis holds short-lived copies (green), and an RQ worker writes chunks to PostgreSQL and reports to S3 (grey = a file store).

Four lessons built four stores one at a time. This lab joins them into the piece Module 11 adds to BrightCart: a database, a cache and background jobs. Orders and tickets live in PostgreSQL behind a small repository. Help-centre chunks and their vectors sit in the same database with pgvector. Redis keeps 60-second copies of order lookups and drops a copy the moment an order changes. When Priya's team edits an article, an RQ job re-embeds it once, however many times the edit is announced. Every night a second job writes Marta's ticket report to an S3 bucket. The lab ends with one check that runs the whole flow and asserts the counts. No hosted model is called; the only model is the small local embedder from Lesson 2.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.