From 47 Monthly Stock-Outs
to 3 — Automated
How Akranit replaced three conflicting spreadsheets and 32 hours of weekly manual entry with an Anvil + N8N + GPT-4 pipeline that achieved 99.2% inventory accuracy, cut stock-outs by 93.6%, and saved $13,100/month across a 3-warehouse, 2,400-SKU operation.
The Spreadsheet Inventory Trap
RetailCore, a mid-size e-commerce company selling across Amazon, Shopify, and wholesale, operated 3 warehouses with 2,400 active SKUs. Each warehouse ran its own Google Sheet — updated manually at end of shift, 8–12 hours after physical stock changes. Buyers made reorder decisions on stale numbers, leading to cascading stock-outs during peak periods and chronic overstock on slow-moving lines. Three spreadsheets. Zero sync. 47 stock-out incidents in the month before we stepped in.
across 3 warehouses, peak weeks worse
across 3 warehouse staff updating sheets
dead capital tied up in slow-moving SKUs
vs 95%+ industry benchmark for e-commerce
3 separate warehouse spreadsheets with no sync — buyers reading data 8–12 hours out of date
No demand forecasting: reorder decisions based on gut feel, leading to 23% overstock on 40% of SKUs
Stock-out during a peak promo cost $34,000 in lost sales in a single weekend
Reorder emails sent manually to 14 suppliers — no standard format, no tracking, frequent missed replies
Warehouse staff spent 32 hrs/week on data entry that generated no value beyond record-keeping
No low-stock alerts: buyers discovered stock-outs by checking sheets manually or from customer complaints
How the Inventory System Was Built
Seven nodes. One source of truth. Every stock movement — whether a warehouse scan, a supplier delivery, or a Shopify sale — flows through the same pipeline and updates every system in real time, with GPT-4 forecasting demand and Anvil generating purchase orders automatically.
Custom inventory dashboard + purchase order generation. Anvil's Python backend handles PO logic, supplier routing, and approval workflows — all in one deployable app with no frontend framework needed
Orchestration layer — connects React Native barcode events, Shopify webhooks, supplier emails, Slack, and Anvil in one visual pipeline with retry handling and deduplication
Demand forecasting node — reads 90 days of sales velocity, seasonal signals, and supplier lead times to predict when each SKU will hit reorder point, outputting structured JSON per item
Warehouse barcode scanning app deployed to staff iOS/Android devices. Scans update stock in real time via N8N webhook — replacing end-of-shift manual spreadsheet entry entirely
Single shared source of truth replacing the 3 siloed warehouse sheets. N8N writes every stock movement in real time — buyers and warehouse managers read from one live sheet
Critical low-stock alerts fire to #inventory-ops with SKU, warehouse, current count, days-to-stockout estimate, and a one-click 'Approve PO' button linked to the Anvil draft
Step-by-Step Pipeline Walkthrough
React Native Barcode Scan
Warehouse staff scan incoming or outgoing stock with the React Native app. Each scan fires a POST to the N8N webhook with SKU, quantity delta, warehouse ID, and timestamp. The app works offline and queues scans — syncing when connectivity returns. Zero end-of-shift data entry.
N8N Normalization & Deduplication
N8N receives the webhook payload and runs a SHA-256 hash deduplication check (scan ID + 30-second window) to prevent double-counts from device retry logic. It then normalizes the payload and writes the stock delta to the Google Sheets master ledger in real time.
GPT-4 Demand Forecast Node
On each stock update, the GPT-4 node reads the last 90 days of sales velocity for that SKU from Google Sheets, applies seasonal weightings, and outputs: projected days-to-stockout, recommended reorder quantity, and a confidence score. Structured JSON, every time.
Stock Gate (IF Router)
GPT-4's days-to-stockout output drives three branches: <7 days triggers the Anvil PO + Slack critical alert in parallel. 7–21 days triggers a Slack advisory ping only. >21 days logs to the weekly report. Overstock (>180 days supply) triggers a separate markdown-pricing Slack alert to the buying team.
Anvil Purchase Order Generation
For critical and standard reorders: N8N calls the Anvil Python API to generate a structured PO with SKU, quantity, unit cost, preferred supplier, and estimated delivery window. POs under $2,000 auto-send to the supplier via email. POs over $2,000 route to a buyer approval flow in Slack — one click to approve.
Slack Critical Low-Stock Alert
A structured Slack message fires to #inventory-ops with: SKU name, warehouse, current count, days-to-stockout, GPT-4 confidence, and a deep link to the Anvil PO draft. The buying team sees full context in one message — no sheet-checking required.
Weekly Inventory Health Report
Every Monday at 7 AM, a cron node pulls full inventory state from Google Sheets and computes: stock-out incidents in the past 7 days, SKUs in critical range, overstock value by category, and top 10 fastest/slowest movers. Posted to #buying-ops. Zero manual reporting.
Inventory Accuracy by Category
Before vs. after deployment — measured across all 2,400 SKUs at 30-day mark
Accuracy computed as: correct stock count / total SKU count per category. Baseline from 30-day pre-deployment audit.
The Results After Month One
Measured at the 30-day mark across all 3 warehouses and 2,400 SKUs. All metrics compared to the 30-day pre-deployment baseline.
↓ from 47 (↓ 93.6%)
↓ from 32 hrs (↓ 93.4%)
$18,400 → $5,300/mo carrying
↑ from 67% baseline
| Metric | Before | After (30 days) | Change |
|---|---|---|---|
| Stock-out incidents / month | 47 | 3 | ↓ 93.6% |
| Inventory accuracy | 67% | 99.2% | ↑ 48.1% |
| Manual data entry hours / week | 32 hrs | 2.1 hrs | ↓ 93.4% |
| Overstock carrying cost / month | $18,400 | $5,300 | ↓ 71.2% |
| Time from scan to system update | 8–12 hours | < 30 seconds | ↓ 99.9% |
| PO generation time per order | 45 min manual | 0 (automated) | ↓ 100% |
| Low-stock alerts missed / month | ~19 | 0 | ↓ 100% |
| Monthly labor + overstock cost | $21,200 | $8,100 | ↓ 61.8% |
What Nobody Tells You About Inventory Automation
Seven weeks, 2,400 SKUs, three warehouses, and a few surprises that no N8N tutorial or inventory management blog covers.
GPT-4 demand forecasting requires 90 days of clean historical data — not just any data
We initially fed GPT-4 the client's raw Shopify export. The data had 3 gaps from system migrations and mixed in cancelled orders. GPT-4 forecasted with high confidence on bad numbers. After cleaning the data (removing cancellations, filling gaps with category averages, normalizing for promotional spikes), forecast accuracy jumped from 71% to 94%. The lesson: garbage in, confident garbage out — LLMs don't know when data is dirty.
React Native offline mode is not optional for warehouse environments
Warehouse 2 had dead zones near the loading dock — exactly where most receiving scans happened. In week one, staff lost a batch of scans when the app tried to POST during a 4-minute connectivity gap. We implemented SQLite-based offline queuing with sync-on-reconnect. After that, zero lost scans. Any mobile app used in a physical warehouse must assume intermittent connectivity from day one.
Supplier lead times are variables, not constants — model them as ranges
Our initial Anvil PO logic used fixed lead times from the supplier master list: 'Supplier A = 7 days.' In reality, lead times varied from 4 to 14 days depending on season and order size. After two near-miss stockouts from optimistic lead-time estimates, we rebuilt the forecast to use rolling 90-day average lead times per supplier. Always treat lead time as a distribution, not a number.
Human approval for high-value POs improved trust in the system — not just compliance
We set the auto-approve threshold at $2,000. POs above this amount route to a buyer Slack approval flow. This wasn't just legal/financial caution — it was change management. Buyers who approved POs manually for a week developed confidence in GPT-4's reorder quantities before the system was handling $40,000/week in automated orders. The approval gate was a trust-building mechanism, not an obstacle.
Overstock alerts delivered more ROI than stockout prevention in month one
We scoped the project around stockout reduction. The client expected that to be the headline win. But the first monthly report showed the overstock markdown alert — identifying $13,100 in excess slow-movers for immediate price adjustment — delivered more measurable impact than the stockout prevention did. The buying team had never had a systematic view of overstock before. Sometimes the problem you solve isn't the problem the client thought they had.
One real-time source of truth changes behavior faster than any training session
Before the system, buyers checked the Google Sheet once a day — because the data was a day old anyway. After launch, with the sheet updating in real time, buyers were checking it 8–10 times per day within two weeks. The same data, made live, fundamentally changed how the team interacted with inventory. You don't need to train people to use better tools — you need to give them tools that are actually better.
Want This Built for Your Operation?
We build the same inventory automation systems — tailored to your warehouse setup, suppliers, and ERP — typically live in 6–8 weeks.