Indie / Vibe-Coded · October 2026 · 5 min read
Referral Tracking for Vibe-Coded Apps: A Practical Guide
You shipped a SaaS with Cursor, Bolt, v0 or Lovable in a weekend. It's making real money. Now you want a referral program — but you don't want to spend the weekend after that wiring up enterprise SaaS infrastructure. Here's the dead-simple stack.
"Vibe-coded" is the new shorthand for the wave of indie SaaS being shipped by founders working primarily through AI coding tools — Cursor, Bolt, v0, Lovable, Replit Agent. Most of these apps run on Next.js + Stripe + Supabase / Postgres. Most are built by one person. Most cross $1k MRR in week 2 and $10k MRR in month 3 if the idea was any good.
The first marketing infrastructure these founders typically need is a referral program. Your audience is on X / IndieHackers / Discord — people who will share your product with their followers if you give them a reason to. A working affiliate code + 30% commission gets you that reason. The problem is that wiring up a referral program traditionally meant adopting Rewardful, learning their SDK, getting capped on the cheap tier, paying 9% of commissions, etc. None of that fits the vibe-coded ethos.
This guide is the actual setup an indie / vibe-coded founder should do. 30 minutes from "I want a referral program" to "Sarah just earned her first commission."
What "vibe-coded-friendly" actually means
For our purposes, the stack needs to be:
- Paste-into-your-AI-tool simple. 30 lines of code total. You can paste them into Cursor / Bolt / v0 and have it integrate.
- No SDK / no vendor lock. If the provider goes south, you swap two URLs and move on.
- Flat-rate pricing. You're going to scale fast and unevenly. Per-revenue pricing kills the maths.
- No enterprise sales calls. If a pricing page requires "Contact us for pricing," it's not for you.
- Stripe-native. Your app already uses Stripe. The referral tracker needs to live in that flow, not bolt on a parallel one.
The 5-step stack
1. Pick a tracker that has a real API
You want a service that exposes POST /conversions with Bearer auth, idempotent on order_id, and accepts JSON. AffRef does this; so do FirstPromoter and (partially) Rewardful's higher tiers. Skip anything that requires installing a JavaScript SDK on your client — that's bloat your AI coding tool will get confused about anyway.
For the rest of this guide we'll use AffRef as the example. Comparison post here if you want to weigh other options first.
2. Capture ?ref= in your client
Paste this into your root layout. Cursor / Bolt / v0 will place it correctly:
// Tell your AI coding tool: "add this referral-capture snippet to my root layout"
'use client';
import { useEffect } from 'react';
export function CaptureReferral() {
useEffect(() => {
const ref = new URL(window.location.href).searchParams.get('ref');
if (ref) {
document.cookie = `affref=${encodeURIComponent(ref)}; path=/; max-age=2592000; SameSite=Lax`;
}
}, []);
return null;
}
3. Pass the code to Stripe at checkout
In your existing checkout-creation route, read the cookie and stuff it into Stripe metadata:
// Tell your AI tool: "in my Stripe checkout route, read the affref cookie
// and pass it as subscription_data.metadata.affiliate_code"
import { cookies } from 'next/headers';
const affref = (await cookies()).get('affref')?.value;
await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [...],
subscription_data: {
metadata: { affiliate_code: affref ?? '' },
},
metadata: { affiliate_code: affref ?? '' },
// ...
});
4. Fire the conversion from your Stripe webhook
You already have a Stripe webhook (you set it up when you first wired up billing). Add 10 lines:
// In your existing /api/webhooks/stripe route
if (event.type === 'customer.subscription.created') {
const sub = event.data.object;
const code = sub.metadata.affiliate_code;
if (code) {
await fetch('https://app.affref.com/api/v1/conversions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.AFFREF_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
affiliate_code: code,
order_id: sub.id,
order_total: sub.items.data[0].price.unit_amount / 100,
}),
});
}
}
5. Recruit your first 5 affiliates from your existing audience
Software is the easy part. The first 5 affiliates change everything. Where to find them:
- DM your X followers who've already retweeted you. They like you. They want their followers to see them as the discoverer. Offer 30% recurring + free year of Pro.
- Email your existing customers. The repeat ones. Two sentences: "We just launched affiliates. You'd be a great fit. Here's your code: ABC123. 30% recurring for 12 months."
- Post in adjacent Discord / Slack communities. Indie Hackers Discord, Pieter Levels' Marc Lou's community, niche subreddits. Don't shill — share the news that you launched a program and offer codes to anyone interested.
- List on indie marketplaces. Sites like Tinyhood, IndieHackers, ProductHunt have affiliate / partnership sections. Free distribution.
The mindset: your first 50 affiliates are not strangers. They're people who already kind of like you. Don't be precious about who you let in — at this stage, more affiliates = more shots on goal, and you only pay on outcomes.
The vibe-coded specific gotchas
"My AI tool keeps wanting to install an SDK"
Cursor / Bolt / v0 are trained on enterprise patterns where everything has an SDK. They'll try to npm install rewardful-js or similar. Stop them. Tell them explicitly: "Don't install any package. The integration is one cookie write client-side and one fetch() server-side." The AI will comply.
"My Stripe webhook is in a weird place"
Vibe-coded apps often have Stripe webhooks living in a Vercel Edge Function or a Supabase Edge Function rather than a normal Next.js route. Same pattern works in all of them — the only difference is how you read environment variables. Tell your AI tool the platform; it'll handle the syntax.
"What about race conditions between the cookie set and the redirect?"
Won't happen at indie scale. The cookie is set on every page load, the cookie persists across the session, the Stripe redirect reads it server-side. The only way to lose attribution is if the user lands on the marketing site, immediately closes the tab, then comes back via a completely different path 31+ days later. That edge case isn't worth engineering around at $1k-$50k MRR.
"I want to do something fancier — recurring commissions, tiered rates"
Ship the simple version first. Get 5 working affiliates. Then add complexity. The single biggest mistake indie founders make with affiliate programs is over-engineering before any affiliate has earned a dollar.
Why this matters for vibe-coded apps specifically
A vibe-coded SaaS founder has two scarcest resources: attention (no time to learn enterprise tools) and margin (every percent of MRR counts at this stage). The traditional affiliate-tool stack burns both — Rewardful's 9% commission cut is real money at $5k MRR, and "learn our SDK + dashboard + best practices" is real time.
The pattern above costs you 30 minutes once + $49/mo flat. That's the right shape for your stage. When you cross $100k MRR and have a marketing team, sure, evaluate the polished SaaS tools. Until then, ship the simple version and put your attention into the actual product.
Where to go from here
7-day free trial; pick "SaaS / Custom App" when you create your first brand. The Next.js integration walkthrough has the production-grade version of the code above. Full API docs if you want to see the full surface.
If you want a longer take on the strategy side — when to start an affiliate program vs paid ads, how to think about commission rates — our affiliate vs influencer marketing post and commission benchmarks post have you covered.
Ship the boring 30-minute version. Get your first commission within a week. Adjust from there.