Run for your money: Engineering a treadmill that prints store credit
For NYC Marathon weekend, Shopify and Endorphins Running built a gamified curved manual treadmill that awards in-store credit for holding a chosen pace within a padded "zone" for 30 seconds, earning 1/30th of $75 per second in zone. A Python script on a single MacBook Pro reads Bluetooth FTMS messages and relays them over Socket.IO to a local Remix/Express app that drives displays, a state-machine control panel, Shopify discount creation and Epson ePOS receipt printing. Irregular FTMS message timing is normalized by weighting each interval as a fraction of a second. A POS UI extension scans the receipt barcode to attach the customer and discount, and it is hosted on production rather than the local server so treadmill problems never block checkout.
Related posts
- Behind the Scenes - A Glimpse into Tax Calculations
Etsy Code as Craft mediumAdeptEtsy calculates marketplace tax by calling Vertex's tax engine: a Quotation Request SOAP call when items are added to cart, and DistributeTaxRequest calls at order creation, cancellation and refund so Vertex's tax journal holds a complete record for reporting and remittance. Product taxonomy had to be mapped to Vertex rule drivers. To protect checkout latency as traffic grew, quotation and distribution calls were split onto separate Vertex instances, which kept report generation from interfering with carts and allowed horizontal scaling via modulo routing on cart_id and receipt_id. Before major launches, shadow requests are ramped up to load-test Vertex without applying the results to buyers' carts.
- Building a Real-time Buyer Signal Data Pipeline for Shopify Inbox
Shopify Engineering mediumAdeptShopify built a streaming pipeline on Apache Beam and Google Cloud Dataflow that surfaces cart actions and order completions to merchants inside Shopify Inbox conversations. Kafka inputs (Monorail and Debezium CDC from MySQL) are filtered, keyed by buyer token with CoGroupByKey, and aggregated in a Global Window. Stateful processing compares timestamps to drop out-of-order events, derives cart actions from quantity changes, clears cart state on checkout, and uses event-time timers to expire state. In an A/B test, merchant response rate rose 2 percentage points and conversation conversion rate rose 0.7 points, with no change in response time.
- Scaling Shopify's BFCM Live Map: An Apache Flink Redesign
Shopify Engineering mediumAdeptShopify scaled its Black Friday/Cyber Monday live sales map by putting Apache Flink in front of Cricket, its home-grown Go stateful streaming service. Flink filtered the checkout Kafka stream so Cricket processed only about one percent of the events, and Flink also computed new metrics such as product trends and unique shoppers. The Flink jobs used cross-region sharding and active-active deployment, handled load tests of 1M events/sec and ran with 100% uptime through BFCM, with Spark batch jobs as a fallback. Redis used for broadcasting to browsers still became a bottleneck and briefly clogged in production, so the planned redesign moves all metrics into Flink and snapshots them to a store that a web tier serves from an in-memory cache.
- Behind the build: 2025's BFCM globe in a pinball machine 🌎🕹️
Shopify Engineering mediumAdeptShopify's 2025 BFCM live globe was embedded in a browser pinball game built with three.js and react-three-fiber, streaming real merchant orders via server-sent events and reacting to sales milestones and first sales. The team switched from Rapier 3D to Rapier 2D physics for mobile performance, faking ramps with sensors that toggle collider sets, and cut the physics step from 2ms to about 0.2ms even with six balls and continuous collision detection. Lighting was baked in Blender with MeshBasicMaterials. The 85 dynamic table lights are rendered via an emissive texture plus a mask texture encoding light IDs in the red channel. A shader plays 128x32 dot-matrix sprite sheets, and AR support took about 100 lines with @react-three/xr.
- Beyond rate limits: scaling access to Codex and Sora
OpenAI mediumAdept
OpenAI replaced hard rate-limit stops for Codex and Sora with a real-time access engine that treats rate limits, free tiers, credits, promotions and enterprise entitlements as layers in a single decision waterfall evaluated per request. Rate limits are consumed synchronously, and credits are checked in the same request but debited asynchronously through a streaming processor. Three chained datasets (product usage events, monetization events, balance updates) make every outcome auditable and replayable. Idempotency keys prevent double-debits, per-account serialized atomic transactions pair each balance decrement with an attributed record, and brief overshoots from the async delay are automatically refunded, trading strict enforcement for provable correctness.