Yefhamak (يفهمك)
24/7 Egyptian Arabic WhatsApp sales bot and order dashboard for online stores
· Oct – Nov 2026 · Next.js · FastAPI · PostgreSQL · AI Agents
Yefhamak v2 walkthrough: live Egyptian Arabic chat, variant lookup, human handoff, and order creation.
Recorded DemoWhat It Does
Online shops in Egypt lose sales every night when WhatsApp messages go unanswered until morning or chat orders get typed wrong. Yefhamak pairs a bilingual Next.js site and seller dashboard with a FastAPI and PostgreSQL backend. The AI reads Egyptian Arabic and Franco-Arabic messages and calls strict backend tools, while deterministic Python services handle stock holds, store policy lookup, and final order creation.
Egyptian Dialect & Franco-Arabic
Normalizes Arabic, English, and Franco-Arabic queries so shoppers can text the way they normally type on WhatsApp.
Concurrent Stock Holds
FastAPI and PostgreSQL enforce timed inventory holds, release expired carts, and update stock inside a single transaction.
Store Policy RAG
Pulls up to three 1,000-character passages from each seller's own docs using Arabic and English synonyms and cites the source.
Mock & Live Demo Modes
Try the scripted demo right in the browser at /demo, or hook it up to the Docker backend and watch orders land in /seller/orders.
Trade-Offs & Decisions
01 · Problem
Letting an LLM talk freely without guardrails leads to made-up prices, oversold stock when two buyers chat at once, and unverified orders.
02 · Approach
I locked the OpenRouter model to validated tool calls only. SQLAlchemy services handle short-lived inventory holds, idempotent checkout, per-seller lexical RAG with source links, and handoff to a human when confidence drops.
03 · Outcome
All core flows are verified by 45 unit tests, 29 real PostgreSQL integration tests covering concurrent holds and seller isolation, and 36 conversation eval cases.
Architecture & Build
- Frontend (yefhamak): Bilingual Arabic/English Next.js landing page (/), interactive chat simulator (/demo), seller orders page (/seller/orders), and /contact.
- Backend (yefhamak-backend): Python 3.12, FastAPI, SQLAlchemy 2.x, Alembic migrations, PostgreSQL, Pydantic, and an OpenRouter tool-calling loop.
- Docker Compose setup plus GitHub Actions CI running 45 unit tests and 29 PostgreSQL integration tests offline.
- 36-scenario eval suite testing product disambiguation, checkout, RAG answers, and human escalation.
Tech Stack
- Next.js
- Python / FastAPI
- PostgreSQL
- SQLAlchemy & Alembic
- Docker
- AI Tool Calling
- RAG
- GitHub Actions
Workflow & Commands
docker compose up -d --build --waitdocker compose exec api python -m app.demo.seedpython -m unittest discover -s tests/unit -vCrowd Anomaly Detection