Scheduled diff-based stock reporting — only what changed, nothing else

The Problem

A store owner spending 40 minutes every morning manually checking inventory levels — most days nothing had changed and the 40 minutes were entirely wasted. No visibility into which products specifically crossed minimum thresholds overnight, which recovered, or which were newly critical.

The Solution

A Schedule Trigger fires at 7 am daily. Two Postgres nodes pull today's live stock and yesterday's stored snapshot. n8n's Compare Datasets node performs a set-difference operation on both streams keyed by SKU, outputting only records where stock values diverged. A Code node categorizes each divergence (below threshold / recovered/changed) and builds an HTML email table. After sending, today's snapshot is written to Postgres to serve as tomorrow's baseline — the cycle is self-sustaining.

Key Engineering

Result

→ 40-minute daily manual check eliminated. Owner receives a focused email containing only changed items — on unchanged days, no email. Threshold breach visibility from zero to immediate.

Tech Stack

Schedule TriggerPostgres NodeCompare DatasetsCode Node (JS)Send Email (SMTP)Supabase

n8n P7 img1.png

n8n P7 img2.png