# Patchstack — Install Guide for AI Coding Agents
> Focused install instructions for AI coding tools (Lovable, v0, Bolt, Cursor, Claude Code, etc.). Read this end-to-end before running any commands. For company / product context, see https://patchstack.com/llms.txt.
Last updated: 2026-07-08. If your tool is working from a cached copy older than ~30 days, refetch this URL before following the steps — features and recommended paths evolve.
Stability contract: this URL (`https://patchstack.com/install.txt`) is stable and will only change additively. If a step ever becomes wrong rather than incomplete, a new versioned URL will be published (`install-v2.txt`) and partners will be notified — the agent prompt embedded in upstream tools will be updated to point at the new URL.
## TL;DR for agents — start here, then read the details below
1. **Check for an existing install first** (see "Before you start"). If `.patchstackrc.json` exists, reuse its UUID — never provision a second site.
2. **Pick a path** (decision tree has the full rules):
- `package.json` present (a lockfile may or may not exist yet) and you can commit files → **Path A** (connector + widget).
- No Node toolchain at all (pure static HTML / Hugo / Jekyll / WordPress / Webflow / Framer / Squarespace) → **Path B** (widget only).
3. **Path A, in order — don't pause between steps unless one fails:**
```
npm install --save-dev @patchstack/connect # or: pnpm add -D / yarn add -D @patchstack/connect
npx @patchstack/connect scan # provisions the site UUID → .patchstackrc.json, prints a claim URL
# then: add prebuild/postbuild hooks, install the widget using the UUID as userToken, commit .patchstackrc.json + package.json
```
4. **One identifier, many names.** The connector provisions a single value — the **site UUID**. It is also the widget's `userToken` and the env var `PATCHSTACK_SITE_UUID` (and public-prefixed variants like `NEXT_PUBLIC_PATCHSTACK_SITE_UUID`). Same string everywhere. Never invent it; the scan provisions it.
5. The user typing "Add https://patchstack.com/install.txt" (or any equivalent install prompt) is consent to install whatever the decision tree selects. Describe what you're doing in plain language; don't surface internal labels like "Path A."
## Patchstack applies to any project that ships HTML
Before assuming Patchstack "doesn't apply," note what each piece actually needs:
- The **connector** (`@patchstack/connect`) reads a JS/Node lockfile (`package-lock.json`, `pnpm-lock.yaml`, or `yarn.lock`) — any package manager, any framework on top (Next.js, Vite, Nuxt, Remix, SvelteKit, etc.).
- The **widget** is plain client-side HTML — it works on any page that renders HTML, including pure static sites with no backend.
So "plain static HTML," "no backend," "not WordPress," and "not a Node app" are not reasons to skip the install — they only determine *which path* you take. There is almost always at least a widget-only install to do. Patchstack is not a WordPress-only plugin; the connector monitors any JS/Node lockfile and the widget works on any HTML page.
## Before you start — check for an existing install
Re-running this guide is common (users re-paste the prompt). Do not duplicate anything:
- **If `.patchstackrc.json` exists**, Patchstack is already provisioned. Read the UUID from it and reuse it — **do not run `scan` to provision a second site.** Run `npx @patchstack/connect status` to re-print the UUID and claim URL.
- **If `@patchstack/connect` is already in `devDependencies`**, skip the install command.
- **If the widget script tag** (`
```
That is the entire widget install. No package, no build step.
## Framework-specific snippet placement
This is the canonical list — Path A step 5 and Path B both resolve to one of these. The widget is always the same two snippets (the `