Margin.Club
Designing a business detective — an analytics product that reads like an investigative magazine and shows its working like an auditor.
- BombayCoder
- Self-initiated concept
- 2026
- None — fictional
- Creative direction, product design, frontend, analytics engine
- Next.js 16 · TypeScript · Tailwind v4 · SVG/Canvas
The fictional problem
Ordinary Objects is an invented Mumbai D2C brand selling mugs, throws and dinner sets across a website, Instagram, a marketplace and quick commerce. Its revenue dashboard looks great. Its bank balance doesn't.
We generated 5,127 deterministic orders that encode one coherent business problem: as promotions got deeper and more frequent, and ads pushed two thin-margin products, revenue climbed while contribution profit fell. From Feb to Sep, monthly revenue moved +48.0% and contribution profit −32.2%.
Nothing is staged in the UI: every figure on every screen — including the investigator's answers — is calculated from that dataset at runtime.
Product concept
Not a dashboard. A case file.
Evidence first
The canvas is a pinboard of exhibits — revenue against profit, every order as a dot, every product against its margin — not twelve KPI tiles.
Every number opens
Click a bar, a dot, a row or a product and the records behind it come up in a drawer you can search and export as CSV.
An honest investigator
Questions are answered by a transparent local engine that shows each step. It never claims to be an LLM.
Lenses, not tabs
Discount Trap, Products, Customers and Channels each get their own composition and visual language.
Creative direction
An independent investigative magazine, a financial-crime documentary and an experimental studio, sharing one desk. Swiss grids and hairline rules carry the information; stamps, scribbled circles and handwritten notes carry the suspicion.
- Archival cream#F2EBDDThe paper. Primary background.
- Ink black#161616Type, rules, the evidence itself.
- Signal red#E74732Suspicious patterns, money lost, warnings.
- Electric blue#244BFFSelection and interactive data.
- Paper grey#D7D2C8Evidence boards, secondary surfaces.
AI architecture — free by default
The investigator runs entirely in the browser. A rules-based parser turns a question into an intent and entities (product, month, channel, coupon). A handler pulls exactly the metrics it needs from the analytics library and writes an answer whose every figure is computed — not generated.
It is labelled Local analysis engine, everywhere. No OpenAI, Anthropic or Gemini keys; no hosted calls; no simulated connection.
Optionally, a user can connect Ollama on their own machine. The model only re-words the engine's facts; any number it writes that isn't in those facts is flagged in red. Switching requires a real, successful connection test.
“Why is my profit declining?”
- 01Read the question — Rule matched: asks about profit / margin decline.
- 02Scoped the books — 5,127 orders, Feb–Sep 2026.
- 03Split the timeline — Opening window Feb–Apr 2026 (1,551 orders) vs closing window Jul–Sep 2026 (2,244 orders).
- 04Rebuilt the profit bridge — Split every ₹ of list value into discount, COGS, shipping, packaging, fees and profit.
- 05Ranked the cost lines — Largest mover: Discounts (+19.8 pts).
- 06Checked product mix — Thin-margin SKUs: 23.7% → 46.3% of list sales.
- 07Pulled supporting orders — 228 loss-making orders in the closing window.
Revenue rose 44.4%, but contribution profit fell 22.0%.
Comparing the opening window (Feb–Apr 2026) with the closing window (Jul–Sep 2026): net revenue went from ₹34.6L to ₹49.9L (+44.4%), while contribution profit went from ₹14.6L to ₹11.4L (−22.0%). Margin moved from 42.2% to 22.8%.
Follow the rupee. Out of every ₹100 of list-price value, discounts took ₹3.6 in the opening window and ₹23.4 in the closing window — the single biggest change in the cost stack. Product cost also rose from ₹42.6 to ₹47.8. Unit costs and list prices are fixed in this dataset, so that increase comes entirely from selling a different mix of products.
Discounted orders went from 444 (29% of orders) to 1,736 (77%), while full-price orders went from 1,107 to 508. Discounted orders grew faster than full-price orders.
Mix is the second leak. Indigo Percale Bedsheet Set and Everyday Dinner Set, 12 pc — the only products with a list margin under 45% — went from 23.7% to 46.3% of list-price sales. Contribution margin fell on all 6 best-selling products.
Technical implementation
app/
page.tsx landing
investigation/ workspace route
case-study/ this page
components/ brand + landing sections
features/
investigation/ workspace, store, canvases,
drawer, investigator UI
analytics/ custom SVG + canvas exhibits
lib/
analytics/ types, metrics, bridge,
cohorts, rules, CSV
ai/ parser, handlers, engine,
optional Ollama narrator
data/
catalog.ts products, channels, codes
generate.ts seeded simulationDeterministic data
A seeded PRNG and integer-only arithmetic produce identical orders on server and client, so pages prerender statically and hydrate cleanly.
Calculations apart from UI
lib/analytics is pure TypeScript. The same functions power the canvas, the investigator, the landing page and this case study.
Exact profit bridge
Each ₹1 of list value splits into discount, COGS, shipping, packaging, fees and profit — so margin changes are explained with no residual.
Fair cohort maths
Repeat rates only count customers observable for the full window, so newer cohorts aren't mistaken for churn.
No chart library
Every exhibit is hand-built SVG, plus a canvas layer for 5k+ order dots with nearest-point hit testing.
State & persistence
A tiny external store (useSyncExternalStore) keeps range, lens, engine settings and investigation history in localStorage.
Product previews — live, not screenshots
These are the production components rendering the case data in place. Hover and click them. Revenue shown: ₹11.0L → ₹16.3L a month.