← all work ← back to all work
// case study
Salesloop
A Shopify app that schedules sales and always reverts prices.
The problem
Running a sale in Shopify means editing prices by hand and trusting yourself to set them back. If the process fails halfway, some products stay discounted forever.
What I built
A merchant sets a discount and a time window. The app rewrites product prices at the start and guarantees a revert at the end from an immutable price snapshot.
The revert holds on pause, on delete, and on failure, so prices always come back. The product competes on reliability, not feature count.
It ships a storefront countdown banner, sale statistics from order webhooks, billing, and the legal and GDPR pieces an App Store listing needs.
Engineering I solved
- Built an idempotent and resumable apply, revert, verify job engine, proven under fault injection with a fake Admin client, with no silent skips and retries on API throttling.
- Kept a pure money, discount, and snapshot domain core separate from infrastructure and covered it with property based tests, including the property that restore(apply(x)) equals x.
- Fixed a GDPR webhook error storm where the mandatory compliance webhooks returned 500, caused by a token refresh running inside the standard HMAC check. Verification moved to its own module with a timing safe HMAC-SHA256 compare.
- Protected snapshots from corruption when sales overlap on the same variant, and made billing work inside the embedded iframe around a redirect and 401 problem.
Stack
App
- TypeScript
- React Router 7
- App Bridge v4
- Polaris
API
- GraphQL Admin API
- App proxy
- Theme app extension
Data
- PostgreSQL
- Prisma
- Redis
- BullMQ
Infra and tests
- Docker Compose
- Caddy
- Vitest
- fast-check
Proof
- Shopify App Store Discount Scheduler ↗
- Live site salescheduler.org ↗
- Tests about 79, property based
- Source private