Freelance · in production 2025
Distribuidora Flow
Point of sale, inventory and orders for a beverage distributor. A chatbot takes orders on WhatsApp, a board shows each one in real time and the driver gets the route on their phone.
- Role
- Full-stack developer
- Stack
- React, TypeScript, Supabase, OpenAI, WhatsApp API, Redis, XState, Google Maps.
Context
A system for a beverage distributor: point of sale, inventory and WhatsApp customer service. The chatbot talks to the customer, builds the order and reports every step through the official WhatsApp API. On the board, orders move across a Kanban1 in real time, and drivers get their route from Google Maps.
1 A board in columns, like new, preparing and out for delivery, where each order moves from one column to the next.Decisions
- A chatbot that invents products or prices costs money.
- Every reply goes through Zod2 validation, a confidence threshold and anti-hallucination guardrails3.2 A library that checks whether data has the expected shape before it's used.3 Checks that block the AI's answer when it mentions something that isn't in the data.
- Conversations and orders have many steps, and it's easy for one to get lost halfway.
- An XState state machine4 drives the conversation flow and the order stages.4 A map of every possible step and how to get from one to the next. An order can never sit in a step that doesn't exist.
- WhatsApp, the board and the driver need to see the same order at the same time.
- Supabase Realtime5 on every screen and bot sessions in Redis with expiry.5 A feature that tells every open screen the moment a piece of data changes, with no reload.
- Returnable bottles disappear when nobody tracks them.
- Returnables tracking with automatic reminders.
Results
- Used daily for sales, stock and orders.
- Real customer orders come in through the chatbot without anyone typing.
- Every order is tracked from the WhatsApp message to the doorstep.