Web AppProjects

A coach for live sellers

A coaching and analytics system for live-commerce sellers that turns the vague feeling at the end of a live into real signals — it reads the host's mood and live comments with on-device ML, flags what matters, and sends only encrypted derived signals to a cloud data plane designed PDPA-first from the architecture up.

11 min read

A coaching and analytics system for live-commerce sellers: an Electron desktop app with a built-in browser for watching the live, reading the host's mood, smiles and attention with on-device ML while pulling live comments, then sending only derived signals to a cloud data plane (NestJS) that is encrypted and fully PDPA-compliant.

ElectronReact + TailwindNestJSPython MLMediaPipeDrizzle + PostgresJSON Schema / OpenAPIPDPA
Empathize · Define

The problem

A live seller has to talk, sell and read a fast-moving comment stream all at once. How do they know what to do right now?

The Insight rail during a live, showing a live quality score of 22 with a Needs attention status
Mid-live, the quality score drops to "Needs attention" — something the host can't see while they're talking

During a live, the host can't see themselves. They don't notice their energy dropping, their face looking tired, or the same price question coming up again and again without an answer. Comments move faster than anyone can read. When the live ends, all that's left is a vague feeling about how it went, with no real data to review or coach from.

— The starting brief, before building the seller coach

Comments move too fast to read

At peak, hundreds of comments come in per minute — price questions, objections and product questions all mixed together. A host who is mid-sentence can't pick out what matters.

The host can't see themselves

Energy dips, the smile fades, eye contact with the camera drops. These hurt sales, but the person in front of the camera is the last to notice.

Nothing to review after the live

There's no record of when viewers were engaged, when they dropped off, or how mood and comments relate — so coaching across sessions runs on gut feeling.

Sensitive data, no room for error

The system touches faces (biometrics) and viewer comments. That data needs consent, encryption and deletion on request under PDPA — doing it halfway isn't an option.

Scattered data, no way to build on it

Signals from each live sit on whichever machine ran it. With no central store, there's nothing to build reports, cross-session coaching or integrations on.


Ideate

The solution

Make the app a "silent coach": it watches the live, reads the signals people miss, and only flags things the host can act on within 60 seconds.

Overview screen: paste a live URL to start analysis, with followed channels and recent sessions
The real overview screen: paste a live URL → it opens in the built-in browser (demo data)

Desktop app with a built-in browser and comment capture

Electron with embedded Chromium opens the live inside the app and pulls comments and engagement in real time through a live-comment connector — link channels and watch several lives in one place.

Reads the host's mood with on-device ML

A local ML server (Python/FastAPI) reads the face — emotion, smiles, talking and eye contact — in real time. The video never leaves the machine; only numbers are passed on.

A live HUD that stays out of the way

A sidebar shows live KPIs and only flags things that can be acted on right away (e.g. "price asked repeatedly", "energy dropping") — a silent advisor, not a flood of notifications.

Cloud data plane for signals and compliance

The NestJS backend receives AES-256-GCM encrypted derived signals and handles consent, audit, erasure and k-anonymity — ready for reports and cross-session coaching.

Data agreements locked down with contracts

The @live-ai-avatar/contracts package defines F1–F5 with JSON Schema 2020-12, OpenAPI 3.1 and Ajv — desktop and cloud speak the same schema and never drift out of sync.


Prototype

How it works — 4 steps

From opening a live to live signals plus a record you can coach from later

Dialog for naming a session before recording starts
Step one: name the session and start recording
1

Open the live in the app

The embedded browser plays the live and captures comments and engagement in real time

2

ML reads the signals

A local server reads the host's face and classifies comment intent, all on the machine

3

Live HUD alerts

Shows KPIs and advisor nudges · an encrypted offline buffer holds data first

4

Send to the cloud

Push signals (idempotent) → historical reports and compliance


Prototype

Tech Stack & Architecture

A monorepo (pnpm + turbo) with 3 apps and 1 contracts package — video is processed on the machine; only encrypted signals go to the cloud

Table of recorded sessions with channel, platform, duration and comment count
Recorded sessions — the basis for historical reports and cross-session coaching
Live page (live-commerce platform) + seller/host
embedded browser comment stream engagement
↕
Desktop App (Electron + React) + Local ML Server (Python)
MediaPipe FaceMesh FaceNet / ViT-FER FastAPI + WebSocket HUD / report
↕
Cloud Data-Plane (NestJS) — ingest / crypto / compliance
ingest + high-water-mark AES-256-GCM consent / audit / erasure k-anon
↕
Postgres + Drizzle · @live-ai-avatar/contracts (JSON Schema / OpenAPI) · Zitadel SSO
F1–F5 schemas Ajv validators JWT (jose)
Why this stack?

Monorepo (pnpm + turbo) keeps desktop, backend, web and contracts in one place with shared types · Hexagonal NestJS (ports/adapters) — separates business logic from the store, KMS and alert sink, so testing and swapping implementations is easy · Local ML server processes video on the machine — fast and private (no images go to the cloud) · Contracts-first — the schema is the source of truth, so desktop and cloud can't drift apart, caught at compile time


Prototype

What I built — 8 core capabilities

The full loop, from capturing signals on the live page to compliance in the cloud

Post-live report showing KPIs and the live quality score
Post-live report: KPIs plus a quality score broken down by component

Embedded Live + Comment Scrape

Electron embeds a browser to open the live and pull comments and engagement in real time. Link the channels you follow and open several lives in one app.

Local Emotion / Identity ML

MediaPipe FaceMesh (52 blendshapes) + MTCNN/FaceNet enrollment + ViT 7-class emotion — reads smiling, talking and looking at the camera in real time, on the machine

Live KPI HUD

The sidebar shows emotion, energy and smile live, with 1-minute and 5-minute rolling windows per track — trends are visible during the live

Silent Advisor (60s nudge)

Catches signals that can be acted on right away, such as a price cluster in the comments or an energy drop — alerts are suppressed so notifications never pile up

Encrypted Offline Buffer

Signals are buffered offline-first on the machine, then pushed to the cloud with a high-water-mark — resends are idempotent, so a dropped connection loses nothing

PDPA Consent + Erasure

A dual-layer consent gate before anything is stored, plus an erasure worker that deletes data from every store on request — biometrics must be encrypted and truly revocable

Tamper-Evident Audit

A WORM sink + hash chain makes an audit log that can't be edited after the fact, plus provenance export — data origin can be proven during an audit

F1–F5 Data Contracts

JSON Schema 2020-12 + OpenAPI 3.1 + Ajv validators + fixtures — versioned with a compat check to prevent breaking changes between services


Prototype

The interface — Live Session HUD

During a live, host signals, comments and actionable alerts on one screen

HUD showing neutral mood 77%, energy 77, talking and looking at the camera
The real HUD: mood · energy · talking · looking at the camera
Chart of the host's mood and energy across the live
The host's mood and energy across the live, in the report
▶ Live Report Consent 214 comments
Silent Advisor — signals you can act on in 60 seconds
Host energy is dropping · price asked 3 times, still unanswered
Restate the price Smile + greet viewers
SignalValueDetails
Emotion Happy 0.71 smile · looking HUD
Comment Price asked ×3 intent: price · cluster alert
Energy ↓ 0.48 5m rolling window report
# derived signals → cloud (AES-256-GCM encrypted, no video frames)
POST /v1/ingest · { emotion:'happy', energy:0.48, intent:'price' } → 202 buffered

Test & Iterate

Hacks and problems

6 problems I had to solve myself — real-time ML, privacy engineering and contracts across services

Engagement over time chart for the live
Engagement over time — used to find when viewers were engaged and when they dropped off

Raw emotion from live video is jittery and noisy

Raw FER output jitters every frame — a slight smile jumps to "happy 0.9" and snaps back to neutral. You can't trigger alerts from it directly.

Fix: calibrate with neutral_bias / smile_boost / frown_gate, then filter with EMA smoothing and 1m/5m rolling windows — the signal becomes stable enough to trust and alert on, with the limits (FER+ class imbalance) known from the start

Read the host's face without letting video leave the machine

A face is the most sensitive kind of biometric — sending frames to the cloud for processing is a risk for both privacy and latency

Fix: a separate local ML server (FastAPI + WebSocket at localhost:8765) processes on the machine and sends only numbers (emotion/energy/intent) to the cloud — 0 video frames leave the machine, a principle decided at the architecture stage

Desktop and cloud easily drift out of sync

The two sides use different stacks (TypeScript/Electron ↔ NestJS) — when a payload changes on one side, the other breaks silently at runtime

Fix: move the contracts into a shared package, @live-ai-avatar/contracts — F1–F5 as JSON Schema 2020-12 + OpenAPI 3.1 + Ajv validators + fixtures + a scripted compat check, so breaking changes are caught in CI, not in production

The ML detector is fast on Windows (GPU) but also has to run on mac

The YuNet detector on onnxruntime CUDA is very fast on Windows — but there's no CUDA wheel for mac arm64, so installing the requirements as-is fails

Fix: a pip env marker (sys_platform == "win32") installs onnxruntime-gpu only on Windows, while mac falls back to cv2.FaceDetectorYN (CPU) automatically — one codebase runs on both OSes without branching

A dropped connection mid-live means lost or duplicated signals

A live sends signals continuously, but connections during a live are unreliable — a failed send loses data, a resend duplicates it

Fix: an offline-first buffer on the machine, pushed to the cloud with a per-session high-water-mark — ingest is idempotent and drops batches below the watermark, so resends are safe: nothing lost, nothing duplicated

Biometric data must be truly deletable and provable

PDPA isn't just "having a delete button" — data has to be deleted from every store, with tamper-proof evidence of who did what to the data and when

Fix: an erasure worker that deletes through every adapter via all-stores-registry + a WORM audit log with a hash chain (no retroactive edits) + provenance export — consent, deletion and proof work as one system, not a bolted-on feature

Define

Deliberate design decisions

What I chose not to build matters as much as what I built — especially around sensitive data

Consent screen before use, with options for reading facial expressions, keeping data for 90 days, and listening to speech
Consent before anything is stored — each item opted into separately, processed on the machine (brand name blurred)

The rule set at the start: video and faces are processed on the machine only — the cloud receives only encrypted derived signals, no frames and no raw images. Everything requires consent first, is encrypted in transit, and can actually be deleted. A sharp privacy boundary makes implementation decisions easy and defensible.


On-device inference

Faces are read on the machine; only numbers go to the cloud, no frames


Consent before capture

A capture gate comes first: no consent, no data


Encrypted from the buffer

AES-256-GCM from the machine all the way to the cloud


Contracts-first

The schema is the source of truth, not either side's code


Level Up · Reflect

Knowledge domains I grew in

5 areas where this project genuinely raised my level

Comment report showing sentiment and request types
Comment intent categories and sentiment in the report
1. Real-time computer vision / emotion ML — from demo to a signal you can trust:

I wired up a real pipeline — MediaPipe FaceMesh (blendshapes + head pose) + MTCNN/FaceNet enrollment + ViT-FER — and learned that raw output can't be used directly. It needs calibration (neutral_bias/smile_boost), EMA, rolling windows and an understanding of model bias. Lesson: in production ML, 20% is the model and 80% is calibration and knowing its limits.

2. Hexagonal architecture in NestJS — separating domain from infrastructure:

I structured the backend as ports and adapters — business logic (ingest/consent/erasure/audit) doesn't know about Postgres, KMS or the alert sink directly; it talks through ports, so it can be mocked in tests and implementations can be swapped. Lesson: hexagonal design makes compliance logic testable without real infrastructure.

3. Privacy / PDPA engineering — compliance is architecture, not a feature:

I implemented two-layer consent, AES-256-GCM with a KMS port, erasure across every store, a WORM audit log with a hash chain, k-anonymity and breach detection — and came to understand how data law translates into code. Lesson: "truly deletable and provable" has to be designed into the data model, not added later.

4. Contracts-first / schema-driven development — keeping services in sync:

I built a versioned contracts package (JSON Schema 2020-12 + OpenAPI 3.1 + Ajv + fixtures + compat check) as the shared agreement between desktop and cloud. Lesson: with the schema as the source of truth, breaking changes are caught in CI — many times cheaper than finding them in production.

5. Monorepo + Electron delivery — shipping across operating systems:

I managed a pnpm + turbo workspace of 4 packages, electron-vite builds, cross-platform ML (env markers), and electron-builder for dmg/nsis-web with auto-update. Lesson: shipping a desktop app with native and ML dependencies is harder than it looks — the env matrix, packaging and fallbacks need planning from the start.

4
Workspaces in the monorepo (3 apps + contracts)
5
F1–F5 data-plane contracts
10
Compliance (PDPA) modules on the backend
0
Video frames that leave the machine

Tan · Natpakan Sirirat

Product Designer & AI Builder — designing user experiences and building AI tools that actually work.

0%