How Our Technology Detects Restocks in Under 5 Minutes
A deep dive into restocking's technical infrastructure: intelligent scraping, multi-layer detection, and double confirmation.
The Technical Behind-the-Scenes of restocking
Many users ask us: "How are you so fast?" Here are the technical details of our infrastructure.
Step 1: Intelligent Scraping
Our Python worker scans product pages using Playwright — a headless browser that executes JavaScript exactly like a real browser.
Why Playwright? Modern e-commerce sites load their stock data dynamically via JavaScript. A simple HTTP curl sees an empty page. Playwright executes the JS and gives us access to real data.
We also use stealth mode to avoid being blocked by anti-bot protections (Akamai, Cloudflare, DataDome).
Step 2: 4-Layer Detection
Once the page is loaded, we apply 4 detection layers:
Layer 1: dataLayer
Most e-commerce sites use a `digitalData` or `dataLayer` JavaScript object for tracking. This JSON often contains real-time stock status. We parse it first — it's the most reliable source.Layer 2: "Add to Cart" Button State
The purchase button changes state based on stock: `disabled` when the size is sold out, active when available. We check this attribute.Layer 3: Variant Attributes
Size and color selectors (`data-size`, `data-color`, `aria-label`) often contain availability information. We analyze them with a semantic classifier.Layer 4: LLM Analysis
For complex cases, we use DeepSeek to analyze the page's textual content and determine if the size is in stock.Step 3: Double Confirmation
This is our anti-false-positive secret. We require TWO consecutive IN_STOCK detections before sending an alert. Why?
- A button can be temporarily active during a reload
- A dataLayer can contain cached data
Two confirmations = zero false alerts.
Step 4: Notification
Email via Resend (premium SMTP, 99.9% deliverability) and SMS via Twilio for Pro users. Average delay: 3 seconds after detection.
Infrastructure
- Python Worker: running on Railway, cron every 5 minutes