Back to Case Studies
    Inventory Automation · E-commerce · 7-Week Project

    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.

    Stock-outs: 47 → 3/month· 99.2% accuracy · $13,100/mo saved
    Industry: E-commerce / Retail
    Timeline: 7 Weeks
    Stack: Anvil · N8N · GPT-4 · React Native
    Scale: 2,400 SKUs · 3 Warehouses
    The Problem

    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.

    Stock-Out Incidents / Month
    0

    across 3 warehouses, peak weeks worse

    Manual Data Entry / Week
    0 hrs

    across 3 warehouse staff updating sheets

    Overstock Carrying Cost / Mo
    $0

    dead capital tied up in slow-moving SKUs

    Inventory Accuracy
    0%

    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

    The Automation Pipeline

    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.

    Barcode ScanReact Native
    N8N TriggerWebhook Intake
    GPT-4 EngineDemand Forecast
    Stock GateIF Low / OK / Over
    Anvil POAuto-Reorder
    Slack AlertCritical Low Stock
    Weekly ReportInventory Health
    Anvil (Python)$30/mo

    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

    N8N (self-hosted)$20/mo VPS

    Orchestration layer — connects React Native barcode events, Shopify webhooks, supplier emails, Slack, and Anvil in one visual pipeline with retry handling and deduplication

    OpenAI GPT-4~$40/mo

    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

    React Native AppOne-time build

    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

    Google Sheets APIFree tier

    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

    Slack WebhooksFree tier

    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

    01

    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.

    02

    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.

    03

    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.

    04

    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.

    05

    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.

    06

    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.

    07

    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

    Electronics34% → 98%
    Before
    34%
    After
    98%
    Apparel61% → 99%
    Before
    61%
    After
    99%
    Home & Garden72% → 99%
    Before
    72%
    After
    99%
    Sports58% → 97%
    Before
    58%
    After
    97%
    Automotive44% → 98%
    Before
    44%
    After
    98%
    Consumables81% → 99%
    Before
    81%
    After
    99%

    Accuracy computed as: correct stock count / total SKU count per category. Baseline from 30-day pre-deployment audit.

    After 30 Days

    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.

    Stock-Out Incidents / Mo
    0

    ↓ from 47 (↓ 93.6%)

    Manual Entry Hours / Week
    0.1 hrs

    ↓ from 32 hrs (↓ 93.4%)

    Overstock Reduction
    0%

    $18,400 → $5,300/mo carrying

    Inventory Accuracy
    0.2%

    ↑ from 67% baseline

    MetricBeforeAfter (30 days)Change
    Stock-out incidents / month473↓ 93.6%
    Inventory accuracy67%99.2%↑ 48.1%
    Manual data entry hours / week32 hrs2.1 hrs↓ 93.4%
    Overstock carrying cost / month$18,400$5,300↓ 71.2%
    Time from scan to system update8–12 hours< 30 seconds↓ 99.9%
    PO generation time per order45 min manual0 (automated)↓ 100%
    Low-stock alerts missed / month~190↓ 100%
    Monthly labor + overstock cost$21,200$8,100↓ 61.8%
    Lessons Learned

    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.

    01Data Quality

    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.

    02Infrastructure

    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.

    03Forecasting

    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.

    04Change Management

    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.

    05Business Insight

    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.

    06Product Design

    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.

    Built by Akranit

    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.