Skip to content

logesh45/GPU-Drop-Reserver

Repository files navigation

GPU Drop Reserver

Educational demo — not affiliated with NVIDIA, Best Buy, or Ticketmaster, and no real retailer APIs.

Why this exists (a checkout story)

From personal experience: you finally get through the queue, the GPU (or ticket) shows in your cart, and then the site turns into a stress test. Autofill puts the wrong ZIP on the first try, the wallet step wants an extra click, or the bank’s 3-D Secure page spins—and the whole time you’re guessing whether a silent timer is counting down. When the page flakes or the hold expires, you rarely get a clean answer: did payment go through, did stock go back, or are you in limbo? That ambiguity is what makes people walk away angry even when the engineering is “working as designed.”

This repo doesn’t replace a real storefront. It’s a playground for the clearer contract those moments need: reserve units when the customer enters checkout, give them a real deadline, complete the order when they finish, and restore inventory on timeout so the next person isn’t blocked by ghost stock—and so the shopper knows what happened.

Under the hood, a small Temporal workflow does exactly that for a demo SKU (founders-gpu-fe): wait for a checkout signal up to a timeout, then confirm or roll back plus a stub “cart expired” notice. The same hold timer + compensation idea shows up in GPU drops (short pay window after allocation) and Ticketmaster-style seat holds (pay within N minutes or the seats return).

Detailed steps: INSTRUCTIONS.md
Agent / maintainer notes: CLAUDE.md

Screenshots

Captured from a full local run: Temporal on Docker, worker on flash-sale-cart, demo at http://localhost:5173. All files are in docs/screenshots/.

Browser demo (NVIDIA-style UI)

Idle — stock loaded, no active workflow; Complete checkout disabled.

Browser demo — idle

Hold in progress — status Running, countdown in Hold / pay, Complete checkout enabled.

Browser demo — active hold

After timeout — outcome expired (no checkout in time).

Browser demo — expired outcome

After checkout — outcome completed (inventory decremented).

Browser demo — completed outcome

Temporal Web UI

Workflows — recent CartReservationWorkflow runs in namespace default.

Temporal — workflows list

Happy path — Historyreserve_inventory → deadline → userCheckedOutgenerate_ticket; result completed.

Temporal — completed workflow history

Timeout path — History — deadline fires → restore_inventorysend_cart_expired_email; result expired.

Temporal — expired workflow history

Timeout path — run summary — inputs and expired result (compact header view).

Temporal — expired workflow summary

Quick start (GitHub clone → run)

git clone https://github.com/logesh45/GPU-Drop-Reserver.git && cd GPU-Drop-Reserver
make setup      # Python venv + pip + frontend npm install
make up         # Temporal + Web UI + Postgres (Temporal metadata)

Open Temporal UI: http://localhost:8080

Browser demo (Honcho — one terminal)

After Temporal is up, run worker + FastAPI + Vite together with prefixed logs:

make wait-temporal   # optional: block until :7233 is ready
make honcho

Uses the root Procfile (Honcho). Stop all with Ctrl+C, or stop only the worker from another terminal: make stop-worker (API + Vite stay up). Bring a worker back with make worker or restart Honcho.

Then open http://localhost:5173.

Alternative: three separate terminals

  1. make worker — worker polling task queue flash-sale-cart
  2. make ui-api — FastAPI on port 8787
  3. make ui-web — Vite on 5173 (proxies /api → 8787)

One-command CLI demos

make demo-timeout    # expiry → inventory restored (see worker.log)
make demo-checkout   # checkout signal → inventory stays decremented

Override product id: ITEM=concert-floor-a make init-db (same workflow; Ticketmaster-style mental model).

What it demonstrates

  • Start workflow → reserve in SQLite
  • Timer + signal: wait for userCheckedOut up to N seconds
  • Success: stub “order confirmed” activity
  • Timeout: restore inventory + stub “cart expired” email

Prerequisites

  • Python 3.11+
  • Node.js 18+ (for the Vite UI)
  • Docker (Temporal server, Web UI, Postgres for Temporal persistence)

Tests

make test

License / disclaimer

Use for learning only. Trademarks (NVIDIA, Best Buy, Ticketmaster) are cited to explain scenario context; this project does not use their services or endorse scraping or ToS violations.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors