Install on Next.js + Vercel
Frenemy opens one pull request you merge, then sets one environment variable.
Frenemy for Next.js installs itself with two quick connects: it opens a single pull request you review and merge, then sets one environment variable and redeploys. There are no files to copy or paste.
Everything it adds is observe-only and fails open — if Frenemy ever has a problem, your app serves exactly as it did before.
- 1Add site
- 2Connect
- 3Verify
- 4Done
Before you start
- A Next.js app deployed on Vercel, with its code on GitHub.
- Permission to install a GitHub app on the repository and to connect Vercel to the project.
- 1
Add your site
Sign in at app.frenemy.dev, enter your site's address (for example, example.com), and click Continue.
Frenemy detects a Next.js app on Vercel and sets up the two-step connect.
Add your site
Enter your site’s address — we’ll find where it’s hosted and set up the fastest connection for you.
Your site’s addressexample.comContinueFinding where your site is hosted…
Illustration — the first wizard screen. - 2
Connect GitHub
Click Connect GitHub and install the Frenemy app on just the one repository you pick.
The app can only read your code and open pull requests — it never pushes to your branches. You review and merge the change yourself.
Connect GitHub
Frenemy will open one pull request adding two files to your repository. You review and merge it — nothing runs until you do.
example / example.comOpen the pull requestThe app installs on just the one repository you pick. It can only read code and open pull requests — it never pushes to your branches.
Illustration — connecting the Frenemy GitHub app to a single repo. - 3
Review and merge the pull request
Frenemy opens one pull request titled “Add Frenemy to example.com (observe-only)”. It adds two files: frenemy-middleware.js (the engine) and a small Next.js file that hands requests to it.
Read it over and merge it. Nothing runs until you do — merging the pull request is the install.
TipFrenemy picks the right file for you: proxy.ts on Next 16+, middleware.ts on Next 15 and earlier, placed inside src/ if that's how your repo is laid out.
↥ OpenAdd Frenemy to example.com (observe-only)+2 filesMerge pull request+frenemy-middleware.jsthe engine+middleware.tsNext 15 and earlier · proxy.ts on 16+Merging this is the install — nothing runs until you do.
Illustration — the single pull request Frenemy opens for you to merge. - 4
Connect Vercel — set the key and redeploy
Back in the wizard, click Connect Vercel. Frenemy sets one environment variable — FRENEMY_SITE_KEY — on your project and redeploys so it takes effect. Nothing else changes.
Watch outVercel's “Key” field means the variable's NAME. Paste FRENEMY_SITE_KEY there — your actual site key goes in the Value field. (Yes, both are called “key.”)
TipVercel bakes environment variables in at build time, so a new variable only takes effect after a redeploy. Connect Vercel does that redeploy for you.
Environment Variables
KeyFRENEMY_SITE_KEYthe variable’s NAMEValuefk_live_••••••••••••••••your site key goes hereVercel bakes env vars in at build time — the change only takes effect after a redeploy.
Illustration — the one thing people get wrong: Vercel's “Key” is the variable NAME, not your site key. - 5
You're connected
Once your merge is deployed with the key set, Frenemy's first event arrives and the wizard flips to Connected.
Every automated visitor to example.com from that point on is verified, classified, and counted.
Verify example.com
CONNECTED ✓Your first event is in — Frenemy is watching, and every visitor from this moment is counted.
Go to my dashboardIllustration — the wizard confirms the connection.
Set the key yourself (instead of Connect Vercel)
If you'd rather not connect Vercel, the wizard can reveal your site key. In your Vercel project, add an environment variable named FRENEMY_SITE_KEY with that value for the Production environment, then redeploy — a git push, or npx vercel --prod.
What this install can see
Every number in your dashboard traces to what this install can actually observe — nothing is estimated or filled in.
Requests on the paths your middleware matcher covers. The default matcher keeps high-signal paths like /robots.txt included, which makes verification reliable.
Static assets and any path outside the matcher. Response size can't be measured from here — the check runs before your app builds the response — so bandwidth isn't shown for this install (never a fabricated zero).
Troubleshooting Next.js + Vercel
It deployed, but Install & health still says WAITING.
Three things cause almost every Next.js “waiting”:
1. File name vs. Next version. Next 16 renamed middleware to proxy. A proxy.ts on Next 15 or earlier is silently ignored — the single most common miss. Frenemy picks the right name for you; if you edited it, match your version.
2. File location. If your repo keeps code in src/, both files must live inside src/ — Next silently ignores a middleware or proxy file in the wrong spot.
3. The environment variable. FRENEMY_SITE_KEY must be set for Production, and Vercel only picks up env-var changes on a redeploy.
The pull request couldn't be opened — I already have a middleware file.
If your repo already has a middleware or proxy file, automated setup steps aside rather than overwrite your code. Email support and we'll help you add Frenemy alongside what you already have.
More fixes in Troubleshooting, or email support@frenemy.dev and a human will help.