Optimal Lab

E-commerce

A UK research-use peptide brand — a full storefront and back-office, then Pep: the AI assistant the team runs the operational side through, in plain English.

Optimal Lab catalogue — the research-use range grouped by pathway, headed 'Structural Peptides · 12 compounds'
The challenge

Optimal Lab sells regulated, research-use-only compounds, and in that market a verb is a regulatory exposure rather than a style choice. A description saying a compound boosts, supports, aids or treats anything has made an implied medicinal claim, and the brand carries that claim — not whoever typed the sentence.

Copy is not the only exposure. Every purchase has to clear an age check before it can complete, and the checkout has to record what the customer actually agreed to, in a form that still means something when someone asks months later.

Underneath the compliance sits an inventory problem most shops do not have. Optimal Lab tracks its vials by lot with expiry dates and allocates the earliest-expiring lot first, so an on-hand figure on those lines is a lot-by-lot question rather than one number sitting against a product name.

Reviewing all of that by eye does not hold. A human reviewer catches the obvious claim and misses the one buried in a paragraph of otherwise clean copy, and the miss looks exactly like the catch until a regulator finds it.

Every bit of that load lands on a small team, on top of the ordinary grind of running the shop — orders, stock, customer messages, reporting. Clicking through admin screens one task at a time was the cost that kept growing as the catalogue did.

What was built, and why it was built that way

A full storefront and back-office on Next.js and Firebase — catalogue, PayPal checkout, Sendcloud/DPD shipping, and an admin suite covering orders, stock, discounts and wholesale.

Then Pep — an AI assistant wired into the back-office as a natural-language command line. The team asks it to check orders, adjust stock, run a stock count, draft a customer reply or pull a sales report, and it acts through a defined set of tools. Every morning at eight it writes the team a briefing on the day before — what was paid, what is waiting on a reply, what is running low and what is stuck.

Nothing Pep does to the business happens on its own say-so. Anything that writes is held behind a confirmation card setting out exactly what is about to happen, and the only tools it runs unattended are the ones that just look something up — 19 of its 42, every one a lookup. The approval is a signed token carrying a fingerprint of the exact arguments shown on the card: change one of them and the fingerprints diverge and the call is refused, and the token is spent the first time it is used, so a replay is refused too. A tool has to opt out of that gate to escape it, which means a new one arrives gated.

The tools also treat customers as potentially hostile. Any free text a customer wrote — a name, a subject line, the body of a message — is wrapped in trust markers before it reaches the model, and the assistant is instructed to read everything between those markers as inert data rather than as instructions. Without that fence, a customer could type an instruction into their own name and have the back office act on it.

Pep also brings the stock count to the team rather than waiting to be asked. Each morning it picks three lot-tracked lines — the ones counted longest ago, so the catalogue cycles instead of repeating — and asks for the on-hand figures in conversation. It works out the correction itself and writes it back through the same audited adjustment a person would use, against the earliest-expiring lot, leaving the same audit row behind. That last part was a finding, not a design: an early adversarial pass caught Pep changing order statuses without writing the audit rows the human screens wrote, and every status change it makes now goes through the same guarded transition.

The compliance rules run as code at the moment work is committed, rather than as a policy document somebody is meant to have read. One guard scans the staged customer-facing files against a blocklist of banned marketing wording and refuses the commit when banned wording reaches rendered copy. The blocklist states the trade-off it was tuned to: it is deliberately stricter than the regulator's minimum, because a false positive costs ten seconds at commit time and a false negative costs the business. The override exists, but it has to name the single term it excuses and give a reason in writing.

A second guard covers the claims that are allowed. A claim in the source carries a tag naming its evidence, and the commit fails unless the matching evidence file is in the repository. That closes the gap where a defensible claim and an unevidenced one look identical on the page.

The age check moved off the honour system. MAST replaced the I-am-18-or-older tick-box with a typed date of birth and put the decision on the server rather than in the browser, then had the server keep only the month, the year and the age at signing — it discards the day, because storing it would collect more than the check needs. Checkout then records four versioned consent documents against a signature, and swaps the document set to match what is actually in the cart.

Screenshot walk-through

What it actually looks like, running.

Pep, Optimal Lab's back-office assistant — its morning briefing above, and below it a proposed action, 'Send 2 collection reminder emails', held behind a Confirm button
Pep's morning briefing, and under it an action it wants to take. It writes out exactly what would happen — which orders, which email template, which ones it is skipping and why — and then stops. Nothing is sent until a person presses Confirm. That gate is the default rather than a special case: the only tools Pep is allowed to run unattended are the ones that just look something up.
Optimal Lab certificates-of-analysis page — 19 certificates across 12 compounds, and the page's own statement of what the certificates do and do not cover
The certificates page — 19 lab reports across 12 compounds, and the page's own account of what they do not cover: certificates issued to the raw-material manufacturer rather than to Optimal Lab, testing quantity and HPLC purity but not identity. A compound missing from this page carries no certificate, and the page makes no claim about it.
Optimal Lab storefront on mobile
The same storefront on mobile — where most of Optimal Lab's customers actually land.
What it meant

A small team runs a compliance-heavy e-commerce business largely by talking to it — checking orders, taking stock counts and drafting customer replies in conversation — while the age check and the regulated-claim wording are enforced automatically instead of resting on memory.

The compliance work moved out of people's heads and into the build. Banned wording and an unevidenced claim both fail at the moment the work is committed, which is hours before a customer could see either, and the age check and the consent record are produced by the checkout rather than remembered by whoever took the order.

The stock count changed shape too. It arrives as three questions in the morning instead of an afternoon nobody has, and the answer lands against the right lot with the audit row already written.

The stack
Next.js 16 + FirebaseFirestore + Cloud FunctionsGemini (Pep, natural-language ops)PayPal + Sendcloud/DPDAI product imagery pipelineMHRA-lexicon + age-verification gates

Half an hour to see what an exacting fit looks like for your business.

Start a conversation
MAST
consulting
MAST Consulting · Applied AI for real workflows
matt@mastconsult.co.uk · MAST Consulting is a sole trader.