ToolingProjects

UGC Extension — UGC video prompt builder

A Chrome extension (MV3, Side Panel) + full-stack CMS that chains 3 jobs into one pipeline: scrape a product, build a video prompt (BYOK LLM), then feed it automatically via CDP into an AI video site that has no public API · Prompts and options are edited in the backoffice without shipping a new extension

12 min read

A Chrome extension (MV3, Side Panel) that works as one pipeline: pull product data from the page (passive scrape) → build a system prompt from the CMS and call the user's own LLM (BYOK) → type the prompt, attach images and press generate on an AI video site with no public API, automatically via CDP · The back end is a NestJS API + CMS where prompts and options can be edited without shipping a new extension

Manifest V3Side Panelchrome.debugger (CDP)NestJSPrisma · PostgreSQLNext.js 15S3BYOK LLMVanilla JS
Empathize · Define

The problem

Why does making a UGC product review video with AI still take a dozen steps of copying, pasting and typing by hand?

A woman scrolling a web page on a laptop and taking notes
Before the tool: open a product page, copy the name, price and images one field at a time, then write a prompt by hand for every product · Photo: Tran Mau Tri Tam / Unsplash

The best-quality AI video tool for Thai creators has no public API. You go to the site, type the prompt, upload reference images and press generate, one scene at a time. Before that you still have to find product info and write a good English prompt, for every product and every scene. It takes a huge amount of time and the results aren't consistent.

— The starting brief, before building UGC Video-Prompt Studio

Product info typed in by hand every time

Name, price and images are scattered across the page. Copy one field at a time, repeat for every product · Many e-commerce sites also have anti-bot protection that blocks automated scraping

Writing a good video prompt isn't easy

Video prompts that look good need to be in English, with framing, lighting and camera angles covered. Content creators shouldn't have to write them for every scene and every mode.

The AI video site has no API to connect to

The best-quality option can only be driven through its web page: type the prompt, upload images, press generate, press + to add a scene, by hand every time. There's no way to send a request directly.

Every prompt or option tweak meant a new release

With prompts and options (themes, selling angles, effects) baked into the extension code, every prompt tweak meant building and distributing a new extension. Slow and inflexible.

Holding LLM keys for users is a liability

If the system holds AI keys for users, we carry the cost and quota and the risk of keys leaking on our side. A burden I didn't want from day one.


Ideate

The solution

Have the extension chain 3 jobs into one pipeline (scrape → generate prompt → feed the AI video site), so all that's left is "pick, then press Auto"

The side panel home screen: pull from this page, paste a link, upload your own images, and presenter, short drama and viral modes
The real side panel: it opens next to the product page and pulls data in one click, or you pick another mode (company logo blurred)

Passive scraping that gets past anti-bot

The content script runs on the page the user opened themselves, pulling the name, price and images from the Shopee API, JSON-LD or __NEXT_DATA__ without triggering anti-bot systems that block automated navigation

Prompts built from the CMS + the user's own LLM

The system prompt is assembled from Tab.systemPrompt + Option.promptFragment pulled from the back end, then sent to the user's own LLM (BYOK) → an editable English prompt card plus a Thai script

A flow executor via CDP

Uses chrome.debugger to type the prompt as trusted keystrokes, attach reference images via DataTransfer, and press generate and add-scene, feeding work into an AI video site that has no API, automatically

Config-driven: edit in the CMS, no new release

All prompts, options and cover images live in the back end and are edited in the backoffice CMS → the extension fetches GET /config and renders it. Prompts can be tuned instantly without rebuilding the extension.

BYOK: no one else's keys held

Users enter their own LLM key, stored in that machine's chrome.storage.local and never sent to the back end. No proxy, no cost or quota to carry, no risk of keys leaking on our side.


Prototype

How it works, in 4 steps

From opening a product page to the video starting to generate on the AI site

After pulling data: 3 product images, name, price, selling points and customer reviews ready to choose fromA Thai voiceover script and 2 video scene cards with English prompts, plus a button to send them to the video site
Left: product and reviews pulled from the open page · Right: the script and a prompt card per scene, ready to send to the video site (sample product data · product photos: Onur Binay, Kowon vn / Unsplash)
1

Pull product data

Open a product page as usual → press "Pull data" → passive scrape of name, price and images

2

Pick a mode + options

Choose presenter / product / short drama / viral, plus theme, selling angle and effects from the config

3

The LLM builds the prompt

The user's key → an editable English prompt card plus a Thai script

4

Auto → AI video site

CDP types the prompt, attaches images, presses generate and adds the next scene


Prototype

Tech Stack & Architecture

3-tier: clients (extension + CMS) talk only through the NestJS API, never to the DB directly

Settings screen: choose an AI provider, enter your own key, pick a model, voiceover language and Backend URL
The real settings screen. BYOK: the AI key stays on the user's machine · Backend URL points to the NestJS API (URL and company name blurred)
Chrome Extension — Side Panel (MV3) + Backoffice CMS
Presenter / Product Short drama / Viral BYOK LLM key CMS (Next.js)
↕
Background Worker — scraper · CDP executor · LLM router
scrapeProduct() typeInFlow() genLLM() clickGenerate()
↕
NestJS API — config · auth (JWT/bcrypt) · audit
GET /config (public) CRUD tab/field/option POST /upload GET /audit
↕
PostgreSQL (Prisma) + S3 (cover images/video)
Tab → Field → Option User + AuditLog cover S3
Why this stack?

MV3 + Side Panel keeps the UI pinned next to the target page (unlike a popup that closes when you click away) · chrome.debugger (CDP) is the only way to send trusted input into a site with no API · NestJS + Prisma + PostgreSQL gives the back end a clear module/guard/DI structure and safe migrations · Config-driven moves prompts and options into the CMS, editable without shipping a new extension · Vanilla JS in the extension: no build step, load it unpacked and go


Prototype

What I built: 8 core capabilities

The full loop, from pulling product data to feeding work into the AI video site

Viral mode: effect template cards such as zoom out to space, free fall, high-speed flight and night vision camera
Viral mode: effect templates whose prompts and cover images come from the CMS, no new extension release needed

Passive Product Scraper

Pulls name, price and images from the page the user opened: Shopee API, JSON-LD, __NEXT_DATA__, dom-scan · gets past anti-bot · unsupported sites = fill in by hand (editable)

Image Gatherer + Picker

Collects all images on the page and lets you pick reference images to attach on the AI video site as each scene's reference

Config-driven Prompt Engine

Builds the system prompt from Tab.systemPrompt + Option.promptFragment, replacing {{fieldKey}} with the chosen options and entered values

Multi-provider LLM (BYOK)

OpenAI / DeepSeek / Gemini / Qwen through one OpenAI-compatible endpoint + JSON mode. Adding a provider = adding one row to a table

Flow Executor (CDP)

Types the prompt (trusted keystrokes), attaches reference images (DataTransfer), presses generate and adds scenes, locating buttons and fields by text/role

Background Removal

Removes product image backgrounds with OpenAI image edit (falling back across several models) for a clean transparent PNG reference

Backoffice CMS

Prompts, options and cover images are editable at 3 levels (tab → field → option) with S3 cover uploads. Edit it and the extension follows, no release needed

Auth + Audit + Users

JWT + bcrypt (checked against the real DB, not env), an audit log of every mutation (who changed what), users CRUD + role guard


Prototype

The side panel

Open it next to the target page → pull the product → get prompt cards → press Auto

The script section of the side panel: a Thai script the AI drafted from real reviews, a character counter and a button to request another version
The real thing compared with the mockup above: a script drafted from real reviews, with a length counter to fit the scene duration
UGC Studio
Presenter Product Short drama Viral
Facial serum 30ml
฿590
via jsonld
1 Opening scene: product review
A Thai female creator holds the serum bottle to camera in soft daylight, close-up, natural glowing skin, warm tone…
Script: "My skin really started glowing in the first week."
2 Demo scene
Same creator applies the serum, macro shot of the texture absorbing into skin, shallow depth of field…
Script: "Light texture, absorbs fast, not sticky."
Edit prompt Auto

Test & Iterate

Hacking the problems

6 problems I had to solve myself: browser automation quirks and full-stack product architecture

Real code using chrome.debugger to send Input.insertText and dispatchMouseEvent to the site
Real code: using CDP (chrome.debugger) to send trusted input the target site's rich-text editor will accept

The target site ignored synthetic keystrokes

The prompt field is a rich-text editor (Lexical), and the generate button only enables after real human input. Events fired with plain JS went unnoticed by the editor, so the button stayed disabled.

Fix: use chrome.debugger (CDP). Input.insertText + dispatchMouseEvent count as trusted input, just like a person typing · The center of each field or button is found by injecting a function into the page that measures getBoundingClientRect()

E-commerce sites blocked scraping

Opening product URLs directly from automation usually gets blocked by a WAF or anti-bot, so no data comes through at all.

Fix: a passive scrape. The content script runs on "the page the user opened themselves" (searched or clicked through the store as usual), so it doesn't trigger anti-bot systems that detect automated navigation · Separate adapters per site (Shopee API / generic JSON-LD)

The target site's DOM was fragile and had decoy buttons

The target site uses random classes (sc-*) that change with every build, so fixed selectors can't locate anything · The "+" button (add source) and the generate button have similar labels, and clicking the wrong one breaks the flow

Fix: locate by-text/by-role instead of by class. Filter to buttons that are visible + enabled + whose text matches generate/create, then explicitly exclude the add button (if the right button isn't found, return null rather than falling back to some other button)

Hardcoded prompts and options = a release for every tweak

Originally the prompts for all 4 modes and every option were baked into sidepanel.js, so each prompt tweak meant building and distributing a new extension.

Fix: move prompts, options and cover images into a back end editable through the CMS → the extension fetches GET /config and renders it · A config-fallback.js (auto-generated from the seed) keeps it working even when the back end is down

Holding users' LLM keys = carrying the risk

If the back end stored AI keys for users, we'd carry the cost and quota, the risk of leaks, and need an extra proxy layer.

Fix: a BYOK policy in every phase. Keys live only in the user's chrome.storage.local and never reach the back end · No LLM proxy, no cost to carry, and the risk of keys leaking on our side is gone entirely

Supporting several LLM providers without bloating the code

Users might use OpenAI / DeepSeek / Gemini / Qwen. Writing a separate integration for each means duplicated code that's hard to maintain.

Fix: every provider speaks OpenAI chat/completions (Bearer + messages) → stored as a table with one row per provider (url + default model) · Adding a new provider = adding one row, without touching the LLM call logic

Define

Deliberate design decisions

What I chose not to build matters as much as what I built

The LLM_PROVIDERS table with 4 providers and the genLLM function that uses the user's key
BYOK + provider table: a new provider = one more row · No key, no call, and no server-side proxy

This extension is a "bridge", not a "factory". It speeds up scraping, building prompts and feeding work into the AI video site, but it stops at "press generate" · It doesn't edit the video (the user does), doesn't hold LLM keys, and doesn't touch the DB directly (API only). A clear scope from the start meant a direct implementation that's easy to maintain.


BYOK in every phase

Keys stay with the user only: not held, not proxied, no cost carried


Config-driven

Edit prompts and options from the CMS without shipping a new extension


Clients talk through the API

The extension and CMS never touch the DB directly: a clear structure with auth and audit under control


Stops at "press generate"

No video editing: a sharp scope, a small, focused tool


Level Up · Reflect

Knowledge domains that got stronger

5 areas where my skills actually moved up through this project

A camera operator holding a video camera in a red-lit studio
The whole system ends in a video clip. The tool just makes the way there shorter · Photo: Kyle Loftus / Unsplash
1. Chrome Extension MV3 + CDP automation: from a plain UI to controlling another site:

I learned the Side Panel lifecycle and event-driven service workers, and most deeply chrome.debugger (CDP): sending trusted mouse and keyboard events, injecting functions into the MAIN world to measure element positions, and driving a full flow on a site that has no API. Lesson: when there is no API, browser automation done properly is a bridge that actually works.

2. Full-stack 3-tier architecture: owning everything from client to DB:

I designed NestJS (module/DI/guard) + Prisma + PostgreSQL + JWT/bcrypt + audit log + S3 upload, and a Next.js CMS that communicates only over REST. It showed me how auth, migrations, audit and media storage fit together as a system. Lesson: the rule "clients talk only through the API" lets the system control security and audit in one place.

3. Config-driven product design: separating content from code:

I moved prompts, options and cover images from hardcode into the CMS, laid out a Tab → Field → Option data model that assembles into a prompt, and added a fallback strategy (bundled config when the back end is down). Lesson: things that change often (prompts) belong where they can be edited without a deploy.

4. Web scraping + DOM resilience: locate by meaning, not selectors:

I learned that a passive scrape gets past anti-bot because it runs on the page the user opened, that data can be pulled from several layers (API / JSON-LD / __NEXT_DATA__), and that buttons on a site whose classes keep changing can be located by text/role instead. Lesson: automation that survives change has to rely on what an element means, not its class name.

5. LLM integration & provider abstraction: connecting AI without locking into one vendor:

I used an OpenAI-compatible endpoint + JSON mode to cover several providers with one config table, designed two-layer prompt assembly (system template + fragment), and set BYOK as a constraint from the start. Lesson: deciding key ownership and provider abstraction on day one saves a huge rebuild later.

3
System layers: Extension · API · CMS
4
Video prompt modes
68
Options editable from the CMS (no release needed)
0
LLM keys stored on the server (BYOK)

Tan · Natpakan Sirirat

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

0%