Py’otrMuhammad Toheed Sahar

ProfitPilot: ad-spend calculator for COD sellers

A browser-only calculator that tells cash-on-delivery sellers whether a product can pay for its ads before they spend money on ads.

Client
My own product, for online sellers
Year
2026
Type
E-commerce & business

The problem

A cash-on-delivery seller pays for ads on every order placed, but only gets paid on orders that are delivered and kept. Most calculators ignore the gap between the two (fake orders, cancellations, refused parcels, returns), so a product that looks profitable loses money once ads are running.

How I built it

I wrote a calculation engine that models the whole funnel from placed to kept orders and derives break-even cost per order from unit economics. The interface sits on top of it: live KPI cards with a traffic-light status, seven charts, saved scenarios with a side-by-side compare, eight mini calculators, seven currencies, and PDF, Excel and CSV export. It is built with Next.js and shadcn/ui, has no backend, and keeps its state in the browser.

What got hard

  1. Break-even cost per order cannot be both an input and an output, and most tools quietly make it both.

    Cost per click and cost per thousand views are funnel inputs, and the effective cost per order is derived from them. Break-even and the safe, good and excellent bands are always outputs of the unit economics, never typed in.

  2. Counting cost per placed order hides the real economics, because revenue lands only on kept orders.

    The engine charges ads on placed orders, shipping on every dispatch (wasted on refused or returned parcels), product cost on kept orders and fees on collected orders, so the headline number is cost per delivered order.

  3. Keeping the numbers trustworthy while an AI assistant built the screens.

    I locked the engine in one folder, wrote six build phases each with a done-checklist, and kept every formula and its plain-English meaning in one catalog that the info icons read from, so no screen re-derives a number.

  4. The first deploy attempt failed on Railway.

    The lock file did not install cleanly with the host's strict install. I regenerated it and the build passed.

The result

A finished client-side tool: live KPIs and traffic lights, seven charts, saved scenario comparison, eight mini calculators and exports in three formats.