When we set out to launch a partner program for NextBlock CMS, we didn't want to slap a third-party tracking script onto our site and ruin our 100/100 Lighthouse score. We also wanted to give creators more than a raw ?ref= link.
So we built a full-stack Affiliates & Creator Storefronts module natively inside Next.js 16 (App Router + RSC) and Supabase—and today we are releasing it as a new package while opening 50 Founding Ambassador spots at a 50% commission split!
Here is a look under the hood at how we engineered it, and how you can use it (or join our partner program).
1. Shadow-Draft JSONB Approval Workflow
Every partner (assigned the RTL Retailer role via Supabase Row-Level Security) gets strictly one co-branded storefront page on the merchant's domain (/partners/[handle]).
Because external creators are editing pages on your domain, you need admin oversight without downtime. On our affiliate_pages table, we store two separate PostgreSQL JSONB trees:
-
draft_content: Bound to the creator's scoped Tiptap editor (auth.uid() = user_idRLS policy). -
published_content: Read by our public React Server Components route and locked againstRTLwrites.
When a partner submits an edit, the admin opens a Side-by-Side Visual Diff Drawer in /cms/affiliates/approvals and clicks Approve & Publish, which copies draft_content to published_content and triggers revalidateTag('affiliate-page-' + handle) with zero site redeploys.
2. Hard-Sandboxed Cortex AI for Partners
Partners get a scoped Cortex AI endpoint (/api/affiliates/cortex) that uses constrained decoding to generate their bio and Tiptap product showcase blocks (AffiliateProductGrid), while stripping out all global database/analytics tools so partners can only mutate their own draft page.
3. Cookie-Less Server Binding + 30-Day Edge Middleware
Privacy extensions often strip affiliate query strings. We implemented dual attribution:
-
Edge Middleware: Intercepts
?ref=[handle]and sets a 30-day first-party HTTP-only cookie (nb_affiliate_ref). -
Server-Bound Storefronts: When a customer buys directly from
/partners/[handle], the RSC product card embeds the partner'saffiliate_iddirectly into the Stripe or Freemius checkout payload on the server—guaranteeing attribution even with cookies disabled.
Join the Founding Ambassador Program (50% Rev-Share) or Try It Free
We are running this module live on our own site right now:
- Earn 50% Commission: Any creator, blogger, or developer can sign up as a Founding Ambassador and earn 50% on every sale across all 3 NextBlock modules (Commerce Pro, Cortex AI, and Affiliates & Creator Storefronts). Only 50 spots are available.
- Try It on Your Own Store: Start a 30-day free trial of the module (no credit card required).
🔗 Become a Founding Partner: https://nextblock.dev/partners
📦 Affiliates Module Details: https://nextblock.dev/product/nextblock-affiliates-creator-storefronts-affiliates-license
🐙 GitHub Repository: https://github.com/nextblock-cms/nextblock
Top comments (0)