Add Matter Chat to a Vercel project
One authorization instead of three env dashboards. The key lands on your project, the domains land on your allow-list, and previews work on the first deploy.
The snippet's two facts live in two dashboards
A pasted snippet carries a key and assumes an allowed domain. On Vercel those become an env var you set by hand across three environments, plus an allow-list entry per domain — and preview URLs are the ones everyone forgets.
- The key pasted into production but never into preview or development
- Preview deployments refused because their vercel.app domain was never allowed
- A rotated key updated in one environment and stale in the other two
- Nobody sure which Vercel project the assistant is actually wired to
Press Add to Vercel
Open your bot's Install tab and press Add to Vercel on the Vercel card. Vercel asks you to authorize the Matter Chat integration for your personal account or team; approving it brings you straight back to the dashboard. If you started from Vercel's side instead, we first ask which bot the install is for — the result is the same.
Pick the project
The card then lists your Vercel projects; choose the one that serves your site. Each bot links to one project, and connecting again later simply replaces the link — there is nothing to clean up first.
The env var
NEXT_PUBLIC_MATTERCHAT_KEY is set to the bot's public key, on production, preview and development.
The domains
Every domain attached to the project — the project's vercel.app domain included — joins the bot's allowed list, so previews work too.
Read the key in your code
In a Next.js app, render the component from @matterchat/react once in app/layout.tsx and hand it the env var: <MatterChat publicKey={process.env.NEXT_PUBLIC_MATTERCHAT_KEY} />. The plain script snippet works the same way — interpolate the env var where the snippet shows the key. Either form means the key never appears in your source, so rotating it is a dashboard change, not a commit.
Redeploy to pick it up
Env vars reach a Vercel deployment when it is built, so the first deploy after connecting is the one where the widget appears. Anything already deployed keeps running without the var until then — if the launcher is missing, check for a deploy newer than the connection before debugging anything else.
Disconnect when you no longer want it
Disconnect on the Vercel card removes our integration from your Vercel account, and Vercel retires the env var it set with it. The domains it added stay on your allowed list until you remove them in the bot's settings — an existing site should not lose chat because you unlinked a project.
Common questions
- Is the key safe in a NEXT_PUBLIC_ env var?
- Yes — it is the same public key every pasted snippet ships in page source. It is bounded by your allowed domains, per-visitor rate limits and plan caps, not by secrecy, which is also why the var is set as plain rather than sensitive.
- Can one Vercel account power several bots?
- Yes. Each bot links to one project, but an agency can run the install once per bot and point each at a different project under the same Vercel account.
- We moved the site to a different Vercel project — now what?
- Disconnect on the Vercel card first — while a project is linked, that is the card's only control, and it removes our configuration along with the env var it set on the old project. Then press Add to Vercel again and pick the new project: it gets the env var and its domains allowed, and domains already on your allowed list stay.
From the blog
All posts- BuildingWhat to index first when your site is a messStart with the pages that already resolve real support questions. Noise, archives, and unfinished docs can wait — indexing them first makes answers worse.Read
- BuildingLaunch checklist: five questions before you go liveBefore launch: confirm sources, citations, refusals, human handoff, and cost controls. If any fail, the widget is not ready — the model is not the issue.Read
- BuildingKnowledge ops for a two-person teamA support bot on a tiny team survives on refusal lists, ten-minute recrawls, and docs edits tied to real tickets — not on a KM platform nobody maintains.Read
Answer honestly. Capture the rest.
Point Matter Chat at your site and see what it can — and can't — answer. It's honest about both.
No credit card. 2 minute setup.
Every answer cites the source it came from. When there isn't one, it says so — and hands the visitor to you.
Installs on the tools you already run.