Skip to content

docs: plan for a self-serve ad network - #1075

Closed
obro79 wants to merge 8608 commits into
mainfrom
claude/self-serve-ad-network-plan-hgxgwu
Closed

docs: plan for a self-serve ad network#1075
obro79 wants to merge 8608 commits into
mainfrom
claude/self-serve-ad-network-plan-hgxgwu

Conversation

@obro79

@obro79 obro79 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Adds docs/self-serve-ad-network.md — a component-by-component plan for owning the demand side of our own ad slots, so an advertiser can sign up, write a text ad, target it, pay, and have it serve without a salesperson or a third-party network in the path.

Docs only. No code changes.

Scope

  • First-party inventory only, with the ad-request API shaped as if it were external so a later multi-publisher expansion is configuration rather than a rewrite.
  • Gravity / Carbon / ZeroClick stay as backfill below our own demand, so fill rate and user credit payouts never depend on direct demand ramping fast enough.

What the plan is built on

Two systems already exist that this connects:

  1. Publisher side. cli/src/hooks/use-gravity-ad.ts requests from three providers that the server already normalizes onto one AdResponse shape. That boundary means a first-party network is one more AdProvider value behind the same contract — no client changes needed to introduce it.
  2. Advertiser side. common/src/constants/freebuff-ads.ts is a complete self-serve marketplace (advertiser accounts, approval gates, campaign lifecycle, $5-ladder daily budgets, Stripe, admin queue) pointed at social-post boosting. It's roughly 60% of the advertiser-facing work here, and the plan extends that schema rather than standing up a parallel one.

What's actually missing: an ad server, a creative/targeting model for text ads, mediation with a floor price, measurement an advertiser will pay for, and invalid-traffic defense on inventory with no browser and no viewport.

Contents

  • Current state and what's reusable as-is
  • 11 components: placement registry, advertiser console, creative policy, ad server pipeline, pricing and allocation, targeting and data, mediation and backfill, the user credit loop, measurement, invalid traffic, admin and client changes
  • Data model sketch
  • 11 open decisions with a recommendation on each
  • Six phases, Phase 0 through general availability
  • Open questions

Three things worth arguing about before this merges

  • The floor price is the whole project. Ad revenue pays users as credits (GrantType = 'ad'). If first-party demand doesn't clear what the backfill networks net us per placement, launching this quietly cuts user payouts and shortens free sessions. That's why Phase 0 is pure measurement with no product work.
  • Flat pricing externally, eCPM internally. The plan keeps the existing stance against auctions (and the reasoning already written down in freebuff-ads.ts) for what the advertiser sees, but adds an internal eCPM ledger — mediation has to compare our demand against networks that quote in CPM, and without that number the floor price is guesswork.
  • ANSI escape stripping in creative text is a security control, not a lint rule. An unescaped \x1b[ in adText can rewrite the user's terminal. Enforced server-side on ingest and on serve, with client-side stripping as defence in depth.

Unresolved

Prepaid balance vs. the daily-subscription billing the boost marketplace uses. The plan recommends prepaid, but it diverges from existing billing and needs a deliberate call.


Generated by Claude Code

Source: CodebuffAI/freebuff-private@06dca34ab900cd04c1792df5030e40f47d22fdb1
Source: CodebuffAI/freebuff-private@ee81021bffde21edb024b65c3d6870b631508c9e
Source: CodebuffAI/freebuff-private@967168ac4f05aa21e674f17dd49082a83a4964d0
Source: CodebuffAI/freebuff-private@13494bacf967254f3c1b6954c3cc4d03a5cec0ab
Source: CodebuffAI/freebuff-private@5c3e9752d2089dd12141f643c0721106626e7d55
Source: CodebuffAI/freebuff-private@cecb6728ca23decbeacc088046c563ab4f933133
Source: CodebuffAI/freebuff-private@91671e57546da5f859d73da62ecbcd4af1e5ea07
Source: CodebuffAI/freebuff-private@ec0fac30164adae2a0bf96338f49a849ebdbd4aa
Source: CodebuffAI/freebuff-private@437bdb0dd8b6bb79f7feacc589b2891c4802833a
Source: CodebuffAI/freebuff-private@1d045ba0910424fd33bb53ecaba63bf3d83ba61e
Source: CodebuffAI/freebuff-private@969a2ca9a8424639d43d6e1b4e97b7ab94d8be05
Source: CodebuffAI/freebuff-private@850b2228e43adad840e7c9c3d0b5c99a4926ff67
Source: CodebuffAI/freebuff-private@41af6667d3f2f91f98f111035a39abf95bea83b4
Source: CodebuffAI/freebuff-private@f96574d26a2110374c5904e701b4281ee90fee10
Source: CodebuffAI/freebuff-private@b74efead159ca5247025ebe64eb8f10d238f39d1
Source: CodebuffAI/freebuff-private@c5fd5a5c2b0059bc588860221374a44bdbe13902
Source: CodebuffAI/freebuff-private@4d97322de6d29571c272bcd9d5133d13818ae2e4
Source: CodebuffAI/freebuff-private@9e6ce2cb45408bd14598d56456a1eabe3f1d4444
Source: CodebuffAI/freebuff-private@7fda829937e1bbc6b9b9be8cb637f6ccf9151165
Source: CodebuffAI/freebuff-private@6576abd8cd2feeeee2c073cde2159514f7712488
Source: CodebuffAI/freebuff-private@dd3680f1b1b8d79b49dca52523920c8ff85afef8
Source: CodebuffAI/freebuff-private@8c6907aebc7953fbbfd2c7c3208452f742ba6801
Source: CodebuffAI/freebuff-private@ede400dd89d0d1dbc36dce2237898356e8770db8
Source: CodebuffAI/freebuff-private@b1145965ff7f4559c1982c827e883448b75416e8
Source: CodebuffAI/freebuff-private@c9568c2cc9c9a84e1459f805b55dc8040e3a31eb
Source: CodebuffAI/freebuff-private@e0d6281c2ff5d798918a8d49fe8af155d1570e66
Source: CodebuffAI/freebuff-private@46756dc01614f78b323750ec1da00b95ca3c1d37
Source: CodebuffAI/freebuff-private@0ded252e2e496c6cce47743c6e1b5cfd085ee273
Source: CodebuffAI/freebuff-private@c333ff47d4bb92c9dbf6bea0e497c88499551d70
Source: CodebuffAI/freebuff-private@47ae9f2dd26749c0a219ac5c472e1d423f34c65f
github-actions Bot and others added 27 commits August 20, 2026 00:11
Source: CodebuffAI/freebuff-private@5720ef36ed9e8ed03feac155a528d4e210778f99
Source: CodebuffAI/freebuff-private@21d1b8dbfdc437b857f751cb71d33aefd5a9b586
Source: CodebuffAI/freebuff-private@f496b0de4478d19ce64daa3b25d063a38f6b7cfb
Source: CodebuffAI/freebuff-private@5c09ea46e6370730b3a6a441bdc199fd189eb375
Source: CodebuffAI/freebuff-private@3bfc7d2933bd5a36a683ad8fe5d4068c01d3bf1b
Source: CodebuffAI/freebuff-private@454bfe56eec426f65ca1fdaacf2b9e950982b7a2
Source: CodebuffAI/freebuff-private@a4bda118b203246d6e741ad683734d8f79cfd53a
Source: CodebuffAI/freebuff-private@0c91849a1fabe597cd829b0b12ed42e1f9e008c3
Source: CodebuffAI/freebuff-private@7816c56563cb000475f6994475a562ef80ea9b94
Source: CodebuffAI/freebuff-private@e99241028c389bdb0fb1b0e96e963ed872dbf231
Source: CodebuffAI/freebuff-private@1ed1dbdb3f4fcb32cdc3b5558dca85354e9bf200
Source: CodebuffAI/freebuff-private@a5499d6f775ea401d5324370c6820d82f0c4f11c
Source: CodebuffAI/freebuff-private@7ba3103d85e0837478513885e498b51a4d185a57
Source: CodebuffAI/freebuff-private@715be3f2e7a4a95c31cc2934d1dceed4b7b0fad4
Source: CodebuffAI/freebuff-private@8b34dae306f0c42ac37cc56d6b9b2c073dfcd642
Source: CodebuffAI/freebuff-private@5f6d7ee872a4dc3b47e4d6035414c0c1a51f4e2b
Source: CodebuffAI/freebuff-private@c0196618ae634c9c370f5c2896a9a78fee631cac
Source: CodebuffAI/freebuff-private@28c38059cb17918d7ed2178259ce9fb85d65a20a
Source: CodebuffAI/freebuff-private@297a65234791e565daa8ed3daf716590deb7e168
Source: CodebuffAI/freebuff-private@52395ac9745a80a9bf7f7f494809a81556040ac7
Source: CodebuffAI/freebuff-private@b456fe3007641549ae8a339d61983ee1ae9caee7
Source: CodebuffAI/freebuff-private@099f00e4d912c509c07ebfaf7505f846a07af99e
Source: CodebuffAI/freebuff-private@c495f1fef4f04159c1698ca1796af08b8c4a88b5
Source: CodebuffAI/freebuff-private@3c7ed1866cb560021d75636337903bc788db6b67
Source: CodebuffAI/freebuff-private@d9bda84eb664116967ab82fcc8d30fad3cdd8891
Source: CodebuffAI/freebuff-private@4e841546cd7202c516eacd79740753fca6f0a51d
Adds docs/self-serve-ad-network.md, a component-by-component plan for
owning the demand side of Freebuff's own ad slots.

Scope: first-party inventory only, with the ad-request API shaped for
later multi-publisher expansion, and the existing providers kept as
backfill below our own demand.

Covers the placement registry, advertiser console, creative policy, ad
server pipeline, pricing and allocation, mediation floors, the user
credit loop, measurement, invalid traffic, admin tooling, a data model
sketch, the open decisions with recommendations, and phasing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015w3TQVmdCS1SeSCSXsEAzX
@victorxheng
victorxheng force-pushed the claude/self-serve-ad-network-plan-hgxgwu branch from 3a5ffe2 to 62623d9 Compare August 31, 2026 21:01
@victorxheng

Copy link
Copy Markdown

Apologies — this PR was auto-closed by GitHub when we force-pushed a history rewrite of this repository (repository maintenance; every commit SHA changed). That was not a judgment on this PR, and GitHub does not allow us to reopen it because the commits it was based on no longer exist in the new history.

If you'd like to continue with this change: rebase your branch onto the new main (or recreate it from a fresh clone) and open a new PR — feel free to link back to this one for context, and we'll pick up the review there.

Sorry for the churn, and thanks for contributing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants