Refgrow

Set up Refgrow with your AI agent

One command in your app's folder. It signs you in, adds the tracking script and the referral widget where they belong, shows you the diff before writing anything, and gives Claude Code, Cursor or Codex the Refgrow tools to finish the rest with you.

bash
npx refgrow init

Node.js 20 or newer. The setup uses the Refgrow API, which comes with every plan and the free trial.

What it does

  1. Signs you in. Your browser opens refgrow.com; check that the code matches the one in your terminal, pick a program or create one, and approve. That creates an API key for the program. Already have a key? Pass --key rgk_....
  2. Finds your framework, your root layout and a page only signed-in users see (account, settings, billing or profile).
  3. Shows the changes as a diff: the tracking script in the layout, a small referral widget component, and the widget on that page. Nothing is written until you say yes.
  4. Connects your coding agent: registers the Refgrow MCP server with Claude Code, Cursor and Codex (the ones it finds) and adds the integrate-refgrow skill to your project.

Then pass the signed-in user's email to the widget, for example <RefgrowWidget email={user.email} />, so users see their referral link without a second login, and ask your agent to "Integrate Refgrow": it passes the referral code to your checkout and proves attribution with a dry-run test sale.

Where the code goes

FrameworkTracking scriptReferral widget
Next.js (App Router)app/layout.tsx: next/script after <body>components/refgrow-widget.tsx, rendered on your account or settings page
Next.js (Pages Router)pages/_document: a script in <Head> (created if missing)components/refgrow-widget.tsx, rendered on your account or settings page
React (Vite, Create React App)index.html, before </head>src/components/RefgrowWidget.tsx, on a page in src/pages, views or routes
Vueindex.html, before </head>src/components/RefgrowWidget.vue, on a view with <script setup>
Nuxtplugins/refgrow.client.ts (new file)components/RefgrowWidget.vue (auto-imported), on pages/account or settings
SvelteKitsrc/app.html, before </head>src/lib/RefgrowWidget.svelte, on src/routes/account or settings
Plain HTMLindex.html, before </head>account.html or settings.html, before </body>

When a file does not look the way it expects, init leaves it alone and tells you what to add by hand. Running it again changes nothing that is already in place.

Options

bash
npx refgrow init --dry-run              # show the plan and the diffs, write nothing
npx refgrow init --yes                  # apply without asking (CI, scripts)
npx refgrow init --key rgk_...          # use an existing API key
npx refgrow init --framework nextjs-app # skip detection: nextjs-app, nextjs-pages, react, vue, nuxt, sveltekit, html
npx refgrow init --page app/account/page.tsx  # the page for the widget
npx refgrow init --agent claude,cursor  # which coding agents to connect
npx refgrow init --no-widget --no-mcp   # tracking script only

The MCP tools your agent gets

get_setup_statusThe path to a first partner sale: provider connected, tracking script seen, widget seen in your app, customers invited, partner sales, with the next step.
get_snippetsThe tracking script and the widget as code for your framework, and where each goes.
connect_provider_instructionsHow you connect Stripe, Paddle, Lemon Squeezy, Polar, Dodo Payments or Creem: the key page, permissions, your webhook URL. You paste the key in the dashboard; the agent never sees it.
list_customers_to_inviteRead only. Your Stripe customers who could become partners, with test and team addresses flagged.
invite_customersInvites customers as partners. Without confirm it only returns a preview; the agent sends after you approve.
get_project_statsClicks, signups, sales, revenue and commissions for a period.
list_affiliatesYour partners with their clicks, sales and earnings.

Plus the rest of the Refgrow MCP server: partners, referrals, conversions, coupons, payouts and the Stripe dry-run test mode.

Your customers as first partners

Most partner sales come from partners the owner invited, and the people who already pay for your product are the best first partners. Ask your agent to "invite my customers as partners". It lists them, shows you who would get the email and what it says, and sends only after you approve. Every address is checked with your payment provider first, and daily limits apply. You can do the same from the dashboard: Partners, Invite customers.

Prefer to paste a prompt?

text
Add Refgrow referrals to this app: run `npx refgrow init` in the project root and follow it.
Then pass the signed-in user's email to the referral widget, pass the referral code to checkout,
and verify with a Refgrow test sale. Docs: https://refgrow.com/docs/ai-setup

Keys and safety

  • The API key is saved to ~/.refgrowrc and to your agents' per-user configs. It is never written into your project.
  • Payment provider keys are pasted by you in the Refgrow dashboard. The agent is told never to ask for them or put them in code.
  • Revoke a key any time on Settings, API keys; the ones created here are named "refgrow init".
Start Free Trial
Set up Refgrow with your AI agent — Refgrow Docs