link-in-bio-foundation — Handoff¶
URL: https://mkdocs.justinsforge.com/memory/handoffs/link-in-bio-foundation-2026-07-08/
Date: 2026-07-08 Owner: whichever agent/session picks this up next Parent session: this one (planning + Phase 1 Tasks 1-2, partial 3-4)
The Goal¶
Build the full creator/affiliate stack for JustinWieb and Gus the Bass (replacing Beacons/Linktree with owned infra). The master plan covers 11 layers (bio page, storefront, brand websites, click tracking, affiliate networks, analytics, email, CRM, community, course/paywall, payments) — see the plan doc, which is the source of truth for scope and phasing:
memory/plans/affiliate-click-foundation-2026-07-08.md ← read this in full before doing anything. It has the master stack table, the access-control rule (Michael only ever touches CreatorTrack apps; the brand websites are hand-built by Claude/Justin and NOT Michael-accessible), and Phase 1's 13 fully-decomposed tasks plus an 8-phase roadmap.
Right now we're mid-Phase-1: standing up the always-on Cloudflare edge (Pages + Workers + D1 + KV) that survives a home-internet outage, so gusthebass.com/links click tracking and email capture never depend on Console being up. CreatorTrack (home) is only the editor + reporting + Mautic sync layer, added in Tasks 7-11.
Current State¶
Done and committed (branch feat/codex-chat-surface in /home/justinwieb/forge, NOT main — that's just where the session happened to be, not a deliberate choice, worth noticing):
- ecc2e0b — Listmonk fully scrubbed from Forge (unrelated cleanup, done earlier this session)
- 4a6a9f1 — creator-stack tool briefing + the master plan doc
- c1a8861 — Task 1 done: Cloudflare KV namespace links-map (eaca8ca562c3454885f2c7e3327a4f14) and D1 database links-events (4da9b1d3-99c3-47fd-8ce3-33413372bdc4) provisioned and recorded in infra/links-edge/README.md
Task 2 done, NOT yet committed: Worker project scaffolded at /home/justinwieb/forge/infra/links-edge/ — wrangler.toml (KV+D1 bindings, production routes commented out pending Task 5 domain cutover), package.json, tsconfig.json, .gitignore, schema.sql. Verified: npx wrangler deploy --dry-run compiles clean (4.44 KiB), both bindings resolve.
Task 3-4 code written, NOT yet verified or committed: src/index.ts (router), src/redirect.ts (/r/<id> — KV lookup, fail-open async click log to D1, 302), src/capture.ts (/c — email validation, per-IP rate limit via KV, D1 insert), src/cors.ts, src/ulid.ts. Schema applied to both remote and local D1 (wrangler d1 execute links-events --remote/--local --file schema.sql --yes, both succeeded). A local KV test key was just seeded (testseed → {"destUrl":"https://example.com/rod","brand":"gus","label":"Rod"}) when the session was interrupted — the actual /r and /c HTTP verification (Task 3/4's verification commands in the plan) has NOT run yet.
Not started: Task 5 (deploy Worker + production routes — needs Justin confirmation before touching the live gusthebass.com domain), Task 6 (Pages project), Tasks 7-13 (all CreatorTrack-side: DB schema, the "Link In Bio" app itself, editor, publish pipeline, sync cron, e2e smoke test, register/document).
A git worktree dev slot is already up for the CreatorTrack side of this work (not yet used): feat/link-in-bio at /home/justinwieb/forge-suite-wt/feat/link-in-bio/, DB ct_feat_link_in_bio, preview port 3068 (no dev server running — bootstrap ran with --no-server). Recreate with bash scripts/forge_creatortrack_agent_bootstrap.sh feat/link-in-bio 3068 if the dev-slot reaper has cleaned it up by the time you read this (idle 45m / cap 4 — check first, see reference_creatortrack_dev_slot_reaper.md).
Files You'll Work With¶
| File | Purpose |
|---|---|
memory/plans/affiliate-click-foundation-2026-07-08.md |
Read first. Master plan, all 13 Phase-1 tasks with exact files + verification commands, 8-phase roadmap |
infra/links-edge/wrangler.toml |
Worker config: KV/D1 bindings, commented-out prod routes |
infra/links-edge/src/{index,redirect,capture,cors,ulid}.ts |
The Worker source (written, unverified) |
infra/links-edge/schema.sql |
D1 schema (clicks, captures tables), already applied remote+local |
infra/links-edge/README.md |
Resource ids (KV/D1), auth notes, route plan |
~/.forge-secrets/cloudflare.env |
CLOUDFLARE_API_TOKEN — has Workers/KV/D1/Pages edit scope, but is missing Account Settings: Memberships Read, so wrangler *list* subcommands fail with auth error 10000. Use the REST API directly (or wrangler create/deploy/execute commands, which work fine) to verify resources exist — don't trust a list failure as "nothing exists." |
/home/justinwieb/forge-suite-wt/feat/link-in-bio/ |
CreatorTrack worktree dev slot for Tasks 7-13 (Next.js app, app/(suite)/link-in-bio/ route to be created) |
/home/justinwieb/forge-suite/lib/apps.ts |
App catalog — Task 8 adds {id:"link-in-bio", name:"Link In Bio", route:"/link-in-bio"} here |
/home/justinwieb/forge-suite/db/schema.ts + db/migrations/ |
Task 7 adds the links.* Postgres schema (pages, blocks, contacts, clicks mirror, captures mirror) |
Likely Approach¶
- Finish Task 3/4 verification (where this session left off): run
npx wrangler dev --localdetached (background, don't let it hold the shell — seefeedback_no_threads_with_subprocess_run.mdand thebackgrounded_daemon_holds_caller_pipegotcha for why detachment matters), then hitGET localhost:8787/r/testseed(expect 302 tohttps://example.com/rod) andPOST localhost:8787/cwith a valid/invalid email (expect 200/400). Use Python'surllibor the sandboxed HTTP tool, notcurl(blocked in this environment). - Commit Tasks 2-4 together once verified (they were built as one unit):
feat(links-edge): /r redirect + /c capture workers, verified locally. - Task 5: before touching the live domain, confirm with Justin exactly which routes go live (
gusthebass.com/r/*,/c) — the plan flags this[JUSTIN]because it changes production DNS/routing behavior on a domain currently serving a live static site. Don't deploy routes without that check-in. - Task 6: Pages project
gus-links, placeholder page, custom domain mapping for/links— same domain-touching caution as Task 5. - Tasks 7-13: switch into the
feat/link-in-bioCreatorTrack worktree, follow the plan's file list exactly (it already names every path). Usefrontend-designskill for the editor UI (Task 9). - Read
memory/general/reference_creatortrack_dev_testing.mdbefore touching the CT dev server (dev-auth gotchas) andreference_creatortrack_worktree_dev_turbopack_symlink.md(worktree dev needsnext dev --webpack, already correctly used by the bootstrap script).
Don't Do¶
- Don't deploy Task 5/6 production routes without Justin's explicit go — they touch a live revenue-adjacent domain (
gusthebass.com) mid-flight. - Don't use Dub, PostHog, Affilimate, or any Phase 2+ tool yet — Phase 1 is deliberately just the owned
/r+/c+ Pages foundation. Those are separate future plans per the roadmap section. - Don't build the CreatorTrack "Link In Bio" UI as a generic "Links" app — it's user-facing named Link In Bio specifically (Justin corrected this once already); the Postgres schema namespace stays
links.*internally, only the display name/route changed tolink-in-bio. - Don't give Michael any access to the brand websites (gusthebass.com/justinwieb.com full sites) — those are Claude/Justin-built only, per the access-control rule in the plan. Michael only ever gets CreatorTrack apps (Link In Bio, Storefront), scoped to the Gus workspace.
- Don't trust a
wrangler ... listfailure as "the resource doesn't exist" — this token's scope makeslistfail whilecreate/deploy/executeall work. Verify via REST API or by the create/execute commands themselves. - Don't work directly on
forge-suitemain for the CT-side tasks — use thefeat/link-in-bioworktree slot. - Don't add Listmonk back, anywhere — it was deliberately and fully removed earlier this session (see
reference_forge_mail_mautic.md). Email = Mautic + Resend, no exceptions.
Deliverables¶
- Verified, committed
/r+/cWorkers (Tasks 2-4 closed out). - Justin's go-ahead + live Worker deploy + Pages project (Tasks 5-6).
- CreatorTrack
links.*Postgres schema + the Link In Bio app (editor, publish pipeline) (Tasks 7-10). - D1→CT sync cron with Mautic fan-out (Task 11).
- End-to-end smoke test proving the outage-resilience property: kill the sync timer, confirm
/r+/cstill work on the edge, restart, confirm catch-up (Task 12). - Registered + documented: MEMORY.md index entry,
reference_links_module.mdtopic file, eval harness green (Task 13).
Done When¶
gusthebass.com/linksis live on Cloudflare Pages, editable by Michael (Gus-scoped) through the CreatorTrack "Link In Bio" app.- A real tap on an affiliate card logs to D1 and lands in CreatorTrack's
links.clickswithin one sync cycle. - A real email capture lands in Mautic's Gus segment and in
links.contacts, within one sync cycle. - Killing home internet does NOT take down the live page or break click/capture logging (only pauses the CT-side sync, which catches up on reconnect).
- Phase 1 is fully committed, task-by-task, each with its own commit per the plan's sizing rules.
- The plan doc's Phase 1 section is marked done and the roadmap phases (2-8) remain for future
/feature-planrounds.