Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
11 KiB
Build Log — 2026-10-24
Round 1
Picked up backlog item 4 from BUILD-LOG-2026-10-23.md ("Remaining from the backlog"):
"Launch as paid ad" action on /ad-studio/[id] wiring the existing Meta/TikTok clients
into the /ads/new -> /ads/[key] -> /ads/report flow.
Item 4 — "Launch as paid ad" entry point on the Ad Studio project page (BUILT, full)
Audited first: the paid-ads backend (app/domains/ads/{service,store,reporting,router}.py,
controllers/v1/ads.py) and the /ads/new web flow (LaunchForm.tsx, already supports a
?project=<id> prefill that preselects the Ad Studio project and lets the creator pick which
finished variants to run) were both already fully built and tested (23 passing tests in
tests/reelforge/test_ads_paid.py). The real, confirmed gap: nothing on /ad-studio/[id]
(ProjectView.tsx) ever told a creator this flow existed or linked to it — a finished ad
project had an organic "Publish and test" section but no way to discover paid launch short of
manually guessing the /ads/new URL and re-picking the project from a dropdown.
apps/api/app/domains/ads/reporting.py—campaign_view(and thereforecampaign_summary, used byGET /ads/campaigns) now reportsproject_idper campaign. Every creative in a campaign is launched from one project (service.creatives_forresolves allvariant_idsagainst a singleproject_idand 404s otherwise — confirmed by readingservice.launch), so the first row'svariant.project_iddescribes the whole campaign; no new query, no schema change (campaigns are already stored onAdVariant.spec, not a separate table).apps/web/src/features/ads/api.ts—CampaignSummary.project_id: stringadded to match.apps/web/src/features/ad-studio/LaunchPaidAd.tsx(new) — loads the ads gate (GET /ads/status) and the caller's campaigns, filters to this project, and renders: any paid campaigns already launched from this project (reusingads/CampaignList.tsx, so the card is identical to the one on/ads) plus a "Launch as paid ad" button to/ads/new?project=<id>(reusingads/GateNotice.tsxwhen Meta/TikTok app review is still pending, so the gate message is identical everywhere it appears). Disabled, with an inline reason, when the project has zero finished (done) ads yet.apps/web/src/features/ad-studio/ProjectView.tsx— new "Paid ads" section between "Publish and test" (organic) and the Rally "Find buyers" bridge, passing the already-computedreadyCount.- No icon/label literally says "Enter"; the launch action uses a Rocket glyph (matches
LaunchForm.tsx's own "Create campaign" button), no emoji anywhere.
Verification
npx tsc --noEmit(fullapps/web) — clean, 0 errors, both before and after.npx eslinton the 3 changed/new web files — clean..venv/bin/python3 -m pytest tests/reelforge/test_ads_paid.py— 23 passed (the additiveproject_idkey does not break any existing assertion, confirmed by reading everycampaign_view/campaign_summarycall site in the test file first)..venv/bin/python3 -m pytest tests/reelforge -k "ads or adstudio"— 228 passed, 3 skipped.ruff check apps/api/app/domains/ads/reporting.py— clean.- Ran the real Next.js dev server (
npm run devinapps/web) and requested/ad-studio/test123directly: compiled with no build error,GET /ad-studio/test123 200, response HTML has no error boundary /Application errormarkers. Full interactive click-through needs a real Clerk-authenticated session with an Ad Studio project, which this sandbox does not have credentials for — not attempted further than the compile+200 check above. No automated test files were added, per the owner's standing instruction.
Not started this round (still open from the 2026-10-23 backlog)
- Item 3 — launch-offer / discount-code billing primitive.
- Item 6 — Template Marketplace remix attribution + revenue-share ledger.
- Item 7 —
/from-app-store/[category]programmatic pages.
No owner-only blockers hit this round.
Round 2
Picked up backlog item 3: the launch-offer / discount-code billing primitive
(discount_codes table + redemption + /pricing banner), built end to end.
Item 3 — Discount codes: catalog, redemption, /pricing banner + apply field (BUILT, full)
Audited first: plan prices/provider product ids are config-driven, fixed-amount
products per provider (app/services/billing/plans.py) — there is no generic
"charge a dynamic amount" path across the 6 payment rails. Dodo Payments is the
one ACTIVE provider (payments_mode.active_provider(); every other MOR
provider is blocked at _require_active_provider already) and Dodo's own
checkout API accepts a discount_codes: string[] parameter that it resolves
authoritatively server-side (confirmed via the dodopayments:discounts-and- promotions skill) — so the real price-off is forwarded to Dodo, never
computed by us, while this round's new local catalog exists purely for
preview/banner/redemption-tracking.
Backend (Python):
apps/api/app/models/db/discount.py(new) —DiscountCode(code, percent/ flat amount, plan scope,max_redemptions/redemption_count,is_public_banner+banner_text, date window) andDiscountRedemption(one row per user per code,UNIQUE(discount_code_id, user_id)— the entire "one use per customer" + idempotency story, exactly like the existingmetered_usage.idempotency_keypattern). Registered inmodels.py.migrations/versions/20261024_1100_c3d5e7f9b1a2_discount_codes.py(new) — both tables, purely additive. Verified by running the real upgrade AND downgrade against a seeded sqlite DB stamped at the prior head (a full from-scratchalembic upgrade headreplay is broken on sqlite by an unrelated pre-existing Postgres-onlyALTER COLUMNmigration — not touched).apps/api/app/services/billing/discounts.py(new) —validate_code(unknown/inactive/expired/scope/already-used, all raising one client-safeDiscountError),preview(priced before/after for a plan),active_banner(the current public/pricingpromo, never raises),redeem(race-safe: the global cap is enforced by an atomic bounds-checkedUPDATE ... WHERE redemption_count < max_redemptions, and a concurrent/replayed redemption for the same user+code is swallowed via the unique constraint, mirroringcard_check.fulfill's idempotency style).apps/api/app/services/billing/dodo_client.py—create_checkoutgained an optionaldiscount_codeskwarg, forwarded to Dodo's/checkoutsbody only when non-empty (byte-identical request when omitted).apps/api/app/services/billing/dodo_billing.py—open_pack_checkoutgaineddiscount_code, forwarded to Dodo's checkout AND into our ownmetadata(so fulfilment can redeem later, never at checkout-creation since the buyer may abandon the page);fulfill_payment's pack branch now callsdiscounts.redeem(...)after crediting, best-effort (never blocks the grant).apps/api/app/services/billing/service.py—create_checkoutgaineddiscount_code; validated viadiscounts.validate_coderegardless of provider (so a bad code always raisesValueErrorbefore any provider call), but only forwarded onprovider="dodo"— any other provider with a code raises a clearValueErrorrather than silently charging full price.apps/api/app/controllers/v1/billing.py—POST /billing/checkoutpassesdiscount_codethrough only when present (so the pre-existing_CapturingServicetest double's narrower signature keeps working unchanged); two new endpoints,GET /billing/discount/active(public promo for the banner, degrades to{"active": false}on any failure, never 404/ 500) andPOST /billing/discount/preview(validates + prices a code, optionally per-user viax-api-key).apps/api/app/models/schema.py—CheckoutRequest.discount_code(optional, case preserved) + newDiscountPreviewRequest/ResponseandActiveDiscountResponseschemas.
Frontend (web):
apps/web/components/marketing/DiscountBanner.tsx(new) — fetches the active banner on/pricing, renders nothing on any failure/no-promo, has a copy-to-clipboard affordance (Tag/Copy/Check glyphs, no emoji, no literal "Enter" button).apps/web/components/marketing/DiscountCodeField.tsx(new) — inline "promo code" input + Apply glyph (ArrowRight), validates via the new preview endpoint before checkout, shows the real $/% savings or a friendly error.apps/web/components/marketing/CheckoutPlans.tsx— renders the banner (when checkout is open) and the apply field (only whenprovider === "dodo", since that is the only provider the backend will forward a code to); forwards the applied code intocreateCheckout's body.apps/web/lib/types.ts/apps/web/lib/api.ts—CheckoutRequest. discount_code,DiscountPreview(Request),ActiveDiscount,getActiveDiscount,previewDiscount.
Verification
.venv/bin/python3 -m alembic heads— single head (c3d5e7f9b1a2); seeded a throwaway sqlite DB at the prior head and ran the REALupgrade headthendowngrade -1— both succeeded,PRAGMA table_infoconfirms the exact column set on both new tables.- Ad-hoc functional script against an in-memory sqlite ORM session (no new
test files added, per standing instruction) exercising
discounts.pydirectly:preview(valid + plan-scope-rejected + unknown-code-rejected),redeem+ idempotent retry (same payment id) + already-used-by-this-user rejection + a different user still succeeding, and themax_redemptions=1cap correctly blocking a second user while leaving exactly 1 redemption row — every assertion passed. - A second ad-hoc script monkeypatched
dodo_client.requestand confirmed: nodiscount_codeskey in the body when no code is given (unchanged request shape), the key present and correct when a code is given, anddodo_billing.open_pack_checkoutthreads the code into both the Dodo parameter and our own metadata. service.create_checkout(..., provider="stripe", discount_code="X")raises the expected clearValueErrorbefore any provider call.ruff checkon all 7 changed/new Python files — clean.pytest tests/reelforge/test_billing.py tests/reelforge/test_billing_api.py tests/reelforge/test_billing_providers.py— initially 4 failures (a pre-existing test double'screate_checkoutsignature didn't acceptdiscount_code); fixed by only passing the kwarg when non-empty rather than editing the test — rerun: 57/57 passed. Broaderpytest tests/reelforge -k "billing or dodo or discount"— 158 passed, 1 skipped.npx tsc --noEmit(fullapps/web) — clean.npx eslinton the 5 changed/ new web files — clean.npx vitest runon the 3 existing/pricingtest files — 16/16 passed.- Ran the real Next.js dev server and requested
/pricingdirectly: compiled (1539 modules),GET /pricing 200, no error-boundary markers.
No owner-only blockers hit this round. Next up: Item 6 (Template Marketplace
remix attribution + revenue-share ledger), Item 7 (/from-app-store/[category]
pages), and an owner-side step this item still needs — actually CREATING the
matching discount object in the Dodo dashboard/API for any code inserted into
discount_codes (the two catalogs must share the same code string; this
round only built the primitive, not a specific live launch code).