work · orderly
Orderly
WhatsApp ordering for kirana shops
Solo: owner app, WhatsApp bot · 2026

Problem
Kirana customers already order over WhatsApp, but owners lose track of messages. Orderly adds an always-on bot that answers price and stock questions from the live catalogue, with no app install for the buyer.
In short
- -Crash supervisor and 45-second heartbeat, shown live in the owner app.
- -Owner replies are relayed to WhatsApp through the bot.
- -State-machine order flow, integer paise, Supabase row-level security.
Architecture
A Node.js WhatsApp bot under a crash supervisor, reading the shop catalogue from Supabase and reporting health to the owner app.
- user
- external
- service
- guard
- data
- client
- call
- logical link
- ← scroll →
- 01Buyer sends a WhatsApp message
- 02Bot parses the intent and looks up the live catalogue
- 03Order moves through a state machine in Supabase
- 04Owner app shows orders and bot heartbeat; owner replies are relayed back
Decisions
+ Rule-based parsing for now- Adding an LLM before the channel is reliable Reliability of the WhatsApp channel was the bigger problem; an AI parser is the planned next step.
Failure handling
Bot process crashes
Supervisor restarts it; missed heartbeats show in the owner app.
- user
- external
- service
- guard
- data
- client
- call
- logical link
- ← scroll →
- user
Customer on WhatsApp
no app install
- external
whatsapp-web.js session
linked to the shop's number by QR
- service
Bot process (Node.js, BuilderBot)
runs under a crash supervisor
reads + writes
dataSupabase Postgres
shops · items · orders · RLS
clientOwner app
React + Vite · Clerk · orders, chats, inventory
- user
Message arrives
group or channel message → ignored
- service
Normalise the phone number
- data
Look up the shop in Supabase
no shop linked → reply "not linked yet", stop
- service
Classify: greeting · hours · address · delivery · item
- data
Item request: search the live catalogue
partial name match · up to 5 results · live price and stock
- service
Compose and send the reply
lookup fails → log it, still send a short apology
- guard
Order status changes go through the state machine
- service
Supervisor starts the bot
- data
Heartbeat every 45 s
owner app shows the bot as live
- service
Bot crashes
restarted automatically
- guard
5 crashes within 30 s
supervisor stops restarting; missed heartbeats show in the owner app
- ● draft
- pending_payment
- placed
- confirmed
- ready
- completed
cancelled → refunded
cancelled orders move to refunded once money is returned
Adding an LLM before the channel is reliable
Rule-based parsing for now
Reliability of the WhatsApp channel was the bigger problem; an AI parser is the planned next step.
Bot process crashes
Supervisor restarts it; missed heartbeats show in the owner app.
Numbers
45 s
Heartbeat interval
Next
- ○ Hinglish message → structured, priced order with an LLM
- ○ Eval set of real order messages