Skip to content
Chapter five

Chapter fiveCommerce, multi-tenant SaaS

Elizabeth.ai

AI-powered commerce automation for micro-businesses. Messenger ordering, live inventory, and CRM in one multi-tenant SaaS.

Year
2026
Role
Solo build
Stack
Next.js, Supabase, Claude
Status
Early access, waitlist

Built for Filipino sellers. Taglish-native. Built to run 24/7 so the owner doesn't have to.

起 (Setup)01 / The problem

Orders arrive as messy Taglish, while the owner sleeps.

Small Filipino sellers take orders in Messenger threads and post comments. Messages land while the owner is cooking, delivering or asleep, stock lives in a notebook, and a slow reply means the customer has already moved on.

Elizabeth.ai branded splash art
myelizabeth.studio
承 (Development)02 / What I built

A multi-tenant SaaS that takes the Messenger orders for them.

Facebook comments and Messenger in, a regex-first Taglish parser with an LLM cascade behind it, atomic inventory, returning-customer memory and a persona per merchant. Solo-built on Next.js, Supabase and Claude.

転 (Twist)03 / The hard part
1→3

One ~1,900-line state machine, rebuilt as three pipeline stages

Taglish, two buyers and one last item, and a monolith that fought back.

Parsing "2 pcs chicken, extra rice, yung spicy ha" cheaply. Deducting stock inside one Postgres transaction so concurrent webhooks can't oversell. Then breaking the conversation handler into Providers, Actions and Evaluators before it ate the project.

結 (Conclusion)04 / The result
Early access

Built and deployed. Open to a waitlist, no paying merchants yet.

  • ParserRegex first, then LLMs
  • Bots on one pipelineOrdering and Sales
  • TenancyMerchant-scoped, plus RLS
  • Sitemyelizabeth.studio
実機 (Real product)Product walkthrough
起源 (Origin)

The origin.

I started noticing a pattern on Facebook. Pages I was ordering from, and my uncle’s small business, were drowning in Messenger threads. Every order meant someone on the other end typing out confirmations, checking stock in their head, and trying to remember which customer had asked about what.

Generic auto-reply bots already existed. They were fine for basic FAQs but useless for actual ordering. I wanted to build something that could take the full weight of customer ordering off the owner’s shoulders without making customers feel like they were talking to a machine.

  • 01 / Wedge

    Personality

    So it wouldn't sound like a chatbot.

  • 02 / Wedge

    CRM

    So returning customers would be recognized.

  • 03 / Wedge

    Inventory

    So the bot would always know what's in stock mid-conversation.

問題 (Problem)

The tito problem.

My tito ran his business from a PC. Orders came in at random times during the day. Orders came in while he was asleep, while he was cooking, while he was out on a delivery. By the time he saw a message, the customer had moved on to a competitor or the conversation had grown into a five-message thread that had to be untangled before he could respond.

Stock was tracked in his head, in a notebook, or not at all. Customers would ask, “meron pa ba?” and he’d guess. Returning customers were treated the same as strangers because there was no way to remember who had already ordered ten times that month.

性格 (Personality)

Why personality was the wedge.

Existing bots sound like bots. Customers notice within two messages. For a small business whose brand is built on the owner’s voice, sounding corporate is worse than not responding at all.

Elizabeth.ai lets every merchant configure a persona: the bot’s name, tone (formal, casual, warm, playful), language preference (pure Filipino, Taglish, English), and emoji usage. The same underlying engine ships to every merchant. The voice on top is theirs.

  • Name
  • Tone
  • Language
  • Emoji
Elizabeth.ai merchant dashboard: persona configuration page with bot name, tone, language, and emoji usage controls
性格 (Personality)Merchant picks name, tone, language, emoji usage
言語 (Language)

Taglish parsing and intent routing.

Filipino customers don’t write orders in English. A real message looks like “2 pcs chicken, extra rice, yung spicy ha”. Off-the-shelf NLP stumbles here. LLMs handle it but cost money on every parse.

Elizabeth.ai runs a regex-first pass tuned for Taglish ordering patterns. The design goal is for that pass to handle the predictable orders at zero AI cost. When regex is confident, it wins. When it’s not, the message escalates. Every parse attempt is logged with the method that handled it, so the real regex-to-AI split can be measured once real merchants are on it.

The escalation is a three-provider cascade: Claude Sonnet 4 first, Gemini 2.5 Flash second, GPT-4o third (the defaults; each slot is swappable in config). A per-provider circuit breaker tracks failure rate and skips degraded vendors automatically. Intent classification (distinguishing an order from a status inquiry from a price question) has its own cascade: regex, then a semantic router using embeddings, then an LLM classifier. Clarification loops replace silent failure: if the parser cannot confidently extract an order, the bot asks a targeted follow-up instead of guessing.

Provider cascade連鎖 (Chain)

  1. Primary Claude Sonnet 4
  2. Fallback Gemini 2.5 Flash
  3. Tertiary GPT-4o
在庫 (Inventory)

Real inventory, real sukis.

Inventory has to be atomic. If two customers order the last three of something at the same time, at most three units can sell. Elizabeth.ai does the deduction inside one Postgres function that row-locks each item before checking stock, so two webhooks racing for the same stock can’t both take it.

When stock runs short mid-conversation, the bot offers partial fulfillment (“we only have 3 left, want to take what we have?”) instead of failing the whole order. Out-of-stock items trigger a restock waitlist so customers get a message when the product is back. Product variants (size, color, flavor) are tracked per SKU with their own stock levels.

Elizabeth.ai merchant dashboard: inventory page with live stock levels, SKU variants, and low-stock indicators
在庫 (Inventory)Live stock, variants, low-stock flags
Elizabeth.ai merchant dashboard: customer CRM showing order history, tags, and returning-customer recognition
常連 (Regular customers)CRM: suki history per customer
流れ (Flow)

Scaling past the monolith.

About 1,900 lines, retired

The original conversation handler was a state machine of about 1,900 lines. It worked. It also made every feature addition an archaeological dig, and every bug risked collateral damage in an unrelated part of the flow.

Inspired by elizaOS, I rebuilt it as a Provider, Action, Evaluator pipeline.

  • 01 / Providers

    Context

    Merchant config, conversation state, product catalog.

  • 02 / Actions

    Discrete steps

    Parse an order, ask a clarifying question, escalate to a human, confirm and create the order.

  • 03 / Evaluators

    Fire and forget

    Telemetry, parse-attempt logging, error reporting, suki memory extraction.

The payoff is character-as-config. Per-merchant flow overrides live in data, not code. The same pipeline runs two different bot personas (Ordering and Sales) with different action sets. Adding a new intent now means adding one action, not editing the monolith.

仕組み (How it works)

How it works

One order, end to end: from a Taglish message on Messenger, through the pipeline and the parser cascade, to a row-locked stock deduction and the merchant's dashboard.

  • Built by me
  • Platform, team or vendor
Fig. 5A Messenger order through Elizabeth.ai. Regex goes first and the model cascade only gets what regex can't read. Stock is deducted inside one row-locked Postgres function, and every query is scoped to the merchant.
基盤 (Foundation)

The infrastructure underneath.

01 / Tenancy多店舗 (Many stores)

Every tenant table carries the merchant’s ID, and every application query is scoped to the merchant from the authenticated session. Row-level security enforces the same boundary for anything the browser reads directly. Server code runs with the Supabase service role, which skips RLS, so on those paths the explicit merchant filter is the boundary. The platform role (staff, admin, super-admin) lives in server-only metadata signed into the JWT, so it cannot be edited from the client.

02 / Billing課金 (Billing)

Pro tier gating uses a runtime-derived effective tier with grace windows and auto-restore on re-subscription. A merchant whose subscription lapses gets a grace period, then graceful degradation, instead of an immediate hard cutoff. Manual billing (the dominant local payment rail) has its own review flow: merchants upload a payment proof screenshot, super-admins approve, and the system activates.

03 / Observability監視 (Monitoring)

Every AI provider call goes through a circuit breaker. Token usage is logged fire-and-forget so it never blocks a customer response. Pipeline errors land in a dedicated table with the context needed to debug them. Parse failures land in a review queue that I use to tune the regex by hand. The goal: notice a failure once, and not fail the same way twice.

Elizabeth.ai super-admin dashboard: pipeline health, AI usage costs, payment submission review queue
管理 (Admin)Super-admin: pipeline health, AI usage, payment review
次 (Next)

What's next.

Early access first, then these
  1. Mobile (idea) A companion mobile app so merchants can manage orders from the phone they're already on. Expansion past one messaging platform into WhatsApp and Instagram so the same pipeline covers every surface micro-businesses actually use.
  2. Memory (idea) Deeper returning-customer memory beyond the current pre-fill: preferences, allergies, usual times of ordering. Once real merchants are on it, a fine-tuned Taglish model trained on their parse corrections, so the regex-to-AI handoff gets cheaper and faster over time.
反省 (Reflection)

What I learned.

  1. A regex pre-pass is cheaper than an LLM, where it fits

    The obvious first instinct was to send every message to an LLM and call it done. The smarter move was to catch the messages with predictable structure using tuned regex, and let AI handle the fuzzy minority. On paper, the cost and latency gains compound at scale; real traffic will tell me by how much.

  2. Monoliths tell you when they're done

    The state machine of about 1,900 lines was fine until it wasn't. The signal was specific: every new feature required threading edits through unrelated branches. Rebuilding as a Provider, Action, Evaluator pipeline wasn't premature, and it wasn't late. It was right when the monolith started fighting back.

  3. Multi-tenant safety needs two independent layers

    App-level filtering alone is one query away from disaster. Row-level policies back it up for everything the browser touches. The honest gap: server code runs with the service role, which skips those policies, so there the app filter is the only layer. Next on the list: tests for the policies, and a lint that flags any service-role query without a merchant filter.

  4. The localization is in the details, not the translation

    The hard part of serving Filipino sellers was never translating strings. It was understanding that customers write in Taglish, that sukis are a retail concept not a loyalty-program label, that manual bank transfers are the dominant payment rail, and that the owner is working from a phone with spotty wifi. Every technical decision rippled out from getting those right.

Thanks for reading.

Last chapter. Back toContents

Contents第五話 (Chapter five) Elizabeth.ai