Tai Lam
Full-stack Operations SystemLive2025 - 2026

Leaf Creme

A live bakery storefront and operations system with batch-based inventory, FEFO allocation, order/payment consistency, SePay bank-transfer integration, and Leafie catalog assistance.

Problem

A bakery needs to know which batch can fulfill an order, when it expires, and whether payment has actually completed. A storefront and a single stock count cannot preserve those relationships across sales, cancellations, and reporting.

Users

Bakery customers browsing and ordering cakes, plus staff and managers handling POS, online orders, pre-orders, batches, and reporting.

My role

Business rules, data model, backend, frontend, and deployment

Product evidence

Screens captured from the deployed product and its verified architecture documentation.

Live Leaf Creme catalog with product search, category filters, and cake prices
Public catalog captured from the live application on October 26, 2026, using the in-app browser. Backend data loaded 20 products.
Chocolate cake detail showing size options and disabled purchase controls for sold-out stock
Product detail from the live app: size selection, current price, and sold-out purchase controls. Stock reflects the capture time.
Leafie answering a public product question in the live Leaf Creme storefront
Live Leafie conversation captured on October 26. This demonstrates a real provider-backed response, not a general evaluation of model quality.

System path

The system is described as a sequence of responsibilities, not a list of frameworks.

  1. 01

    React + Vercel

    Customer storefront, product variants, cart, account and admin workflows

  2. 02

    FastAPI + Railway

    Authentication, role-aware APIs, validation, and business-service orchestration

  3. 03

    Orders + inventory

    FEFO source-lot allocation, ledger movements, vouchers, cancellation restoration

  4. 04

    PostgreSQL

    Products, variants, batches, orders, payments, and Alembic-managed schema

  5. 05

    External services

    SePay/VietQR confirmation; backend-owned catalog context for DeepSeek Leafie; optional Langfuse tracing

Outcomes

  • Models products, components, and gift boxes as expiry-aware batches. Order allocation records source lots and inventory-ledger movements; cancellation or eligible failure restores those same lots.
  • Implements POS, online, and pre-order workflows with vouchers, payment-state transitions, and SePay/VietQR webhook confirmation. Provider webhook validation and idempotency are implemented; no real transfer was made during the portfolio check.
  • Includes backend APIs for products, variants, vouchers, batches, inventory, orders, reports, analytics, and authenticated Operations Agent actions. Categories are product attributes, rather than a missing standalone CRUD module.
  • Serves the React frontend on Vercel and FastAPI/PostgreSQL on Railway. On October 26, both Railway services were online; public browser checks loaded a 20-item catalog, product sizes and prices, sold-out controls, and a live Leafie reply.
  • A paired PostgreSQL service experiment eliminated expired-lot allocation in 20 targeted cases with 10 unaffected controls, and unpaid POS completion in 30 synthetic pairs. These are regression results, not measured business savings.

Technology

FastAPIPostgreSQLSQLAlchemyReactTypeScriptSePay / VietQRDeepSeekRailwayVercel

Decisions and trade-offs

Preserve the source batch

Stock movements retain their source lots so fulfillment and reversal can use the same inventory history. FEFO orders eligible stock by expiry instead of treating every unit as interchangeable.

Keep payment and order state coordinated

Payment completion advances an order only when the recorded amount reaches its total. SePay webhook authentication and idempotency protect confirmation from unauthenticated or repeated delivery.

Give Leafie a bounded catalog role

Leafie reads public catalog data through the backend and returns server-validated product references. It cannot read private orders or execute business actions; the authenticated Operations Agent is a separate integration.

Model categories where the product uses them

Category filters derive from product data and are edited with products. A separate category lifecycle is a future modeling choice, not a prerequisite for the current catalog.

Current boundaries

  • The October 26 browser check covered public catalog, product detail, sold-out behavior, and Leafie. Authenticated admin workflows, full checkout, and a real SePay transfer were not revalidated in that check.
  • Leafie advice is model-generated. Server-owned product cards do not guarantee every sentence, ingredient claim, allergy answer, or delivery promise; availability is a snapshot and does not reserve stock.
  • The operational benchmark uses deliberately constructed synthetic cases. It does not establish real customer error rates, revenue recovery, or end-to-end processing latency.
  • Dedicated category ordering/media, seeded full-stack browser coverage, and backup/restore rehearsal remain documented follow-up work. Railway being online alone does not prove those recovery workflows.

What I learned

Full-stack correctness depends on keeping business rules, database transactions, API contracts, and interface states aligned. For perishable inventory, the source batch and payment evidence matter as much as the checkout button.