# Apps built with Lovable, Bolt, v0 or Replit

> Add Sypnia to an app made with an AI app builder, with the prompt to give the builder, the code it should produce, and how to check that it did it right.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Status: at launch.  
Source: https://docs.sypnia.com/guides/lovable-bolt-v0-replit/

This guide is for people who built their app by describing it. You do not need to read code to follow it. It works with Sypnia Cloud and with a self-hosted engine; the examples use Sypnia Cloud, and one line changes for your own engine.

**At the end you will have:** Sypnia watching the app your builder made, so that when a button stops working after «one small change», you are told in a sentence, with a prompt you can paste straight back into the builder.

**You need:** a project in Sypnia and its ingest key, which starts with `spk_`. The [Cloud quickstart](https://docs.sypnia.com/start/quickstart-cloud) creates both in its first step.

> **In plain words**
>
> You will ask your builder to add a small piece of code, the SDK, to your app. From then on the app tells Sypnia what happens to the people who use it. The key you paste is not a password: it can only send, never read, so it is safe inside the app.

## The prompt

Paste this into your builder's chat, with your own key in place of the example. It is written so that the builder cannot get the important parts wrong.

```text
Add Sypnia monitoring to this app.

1. Install the npm package @sypnia/browser. (If this is a Next.js app, install
   @sypnia/next instead and follow https://docs.sypnia.com/sdks/nextjs.md.)
2. In the file where the app starts, before it renders, add:

   import { init } from '@sypnia/browser';

   init({
     project: 'spk_7d1f0c9e4b8a2f6d3c5e1a9b0f4d8c2e',
     environment: location.hostname === 'MY-REAL-DOMAIN.com' ? 'production' : 'development',
   });

   Replace MY-REAL-DOMAIN.com with the domain where my customers use the app.
3. Call init exactly once. Do not wrap it in a component or an effect.
4. Where the app knows who signed in, call
   identify({ person: { id: user.id } }) from '@sypnia/browser',
   and identify(null) on sign-out. Send the id only, no name or e-mail.
5. Do not add any other Sypnia call. Do not try to record what people type.
   The key above is public and belongs in the code; never add a key that starts with sps_.
6. Show me the files you changed.

Reference: https://docs.sypnia.com/llms.txt
```

On a self-hosted engine, add one line to the `init` call in the prompt: `endpoint: 'https://sypnia.example.com',` with your engine's address.

Why the `environment` line matters: builders show your app in a preview while you work. Without that line, every test you make in the preview would count as a real customer and send you alerts.

## In your builder

What follows is what we know to be stable about each tool: what kind of app it makes and where the code goes. Menus and names in these tools change often. Where a step depends on the tool's own features, it says so: check the tool's current documentation instead of trusting a menu name written here.

**Lovable**

Lovable makes React apps built with Vite.

- **Give it the prompt above.** The `init` call belongs in `src/main.tsx`, before the line that renders the app.
- **If it asks where to keep the key:** in the code is fine. The ingest key is public.
- **If your app uses Supabase** (Lovable connects to it), also read [Supabase apps](https://docs.sypnia.com/guides/supabase): one more option records the calls to your database.
- **Check the result** in the published app, not only in the preview. Whether you can open and edit the code yourself, or sync it to GitHub, depends on your plan: check Lovable's current documentation.

**Bolt**

Bolt makes several kinds of app; most are Vite apps with React, and it can also make Next.js apps.

- **Give it the prompt above.** For a Vite app the call goes in `src/main.tsx` or `src/main.ts`. For a Next.js app the builder should follow the Next.js page linked in the prompt.
- **You can also do it by hand:** Bolt shows the project's files and a terminal. Run `npm install @sypnia/browser` there and paste the `init` call yourself.
- **Check the result** in the deployed app. How Bolt deploys and where it keeps environment variables is its own feature: check Bolt's current documentation.

**v0**

v0 makes Next.js apps and deploys them on Vercel.

- **Give it the prompt above.** Because the app is Next.js, the right package is `@sypnia/next`, with three small files. The builder should follow the page linked in the prompt; the result must match [Next.js](https://docs.sypnia.com/sdks/nextjs).
- **Put the key in the project's environment variables on Vercel** as `SYPNIA_PROJECT_KEY`, as [Next.js on Vercel](https://docs.sypnia.com/guides/nextjs-on-vercel) explains. Where v0 exposes those settings is its own feature: check v0's current documentation.
- **You do not need the `environment` line:** `@sypnia/next` reads it from Vercel, so previews report as `preview` and your real site as `production`.

**Replit**

Replit runs any kind of app, so first find out which kind yours is: ask the Replit Agent «is this a Vite app, a Next.js app, or something else, and does it have a Node server?».

- **Give the Agent the prompt above.** For an app with a Node server (Express is common), also ask: «Add @sypnia/node to the server following <https://docs.sypnia.com/sdks/node.md>, reading the key from the secret SYPNIA_PROJECT_KEY.»

- **For a plain HTML app without a build step,** skip the package and paste one line before `</head>` in each page:

  ```html
  <script async src="https://ingest.sypnia.com/v1/sdk.js" data-project="spk_7d1f0c9e4b8a2f6d3c5e1a9b0f4d8c2e"></script>
  ```

- **Secrets:** the ingest key may live in the code. Replit has a place for secrets; use it for the server's variables. Where it is and how deployments read it is Replit's own feature: check Replit's current documentation.

## Check that the builder did it right

You do not have to read the code. Check three things:

### 1. The app still works

Open the published app and use it as a customer would.

**You should see:**Everything behaves as before. Sypnia shows nothing on your pages.

### 2. Sypnia receives it

In Sypnia, open **Sessions**. Choose the environment `production` if you used your real domain, `development` if you used the preview.

**You should see:**Within 10 minutes, your own visit, with the pages you opened and what you clicked.

### 3. Ask the builder to confirm

Paste: «List every place where Sypnia is called in this app, and confirm that init is called once and that no key starting with sps\_ is in the code.»

**You should see:**One `init`, at most one `identify` and one `identify(null)`, and no `sps_` key.

If no session appears, the most common causes with builders are an `init` placed inside a component (so it runs late or twice) and a preview address that does not match the `environment` line. [Troubleshooting](https://docs.sypnia.com/sdks/troubleshooting) has the full list.

## When Sypnia reports a problem

This is the part these tools make easy. Every problem comes with a prompt written for a coding agent: what happens, where, why, what to change and how to check it. Copy it from the problem and paste it into your builder's chat. See [The prompt](https://docs.sypnia.com/agent/the-prompt).

Two honest limits:

- **File names in problems.** Sypnia shows the file and line in your own code only if your build uploads its source maps. Whether you can add a build step depends on the builder; with a Next.js app on Vercel it is two environment variables ([Next.js on Vercel](https://docs.sypnia.com/guides/nextjs-on-vercel)). Without source maps the problem still says what happened, to whom and since when.
- **Pull requests** **\[Cloud]** need your code on GitHub and the Sypnia GitHub App. If your builder syncs to GitHub, that works; if not, use the prompt.
