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.
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 creates both in its first step.
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.
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.txtOn 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
initcall belongs insrc/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: 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.tsxorsrc/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/browserthere and paste theinitcall 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. - Put the key in the project’s environment variables on Vercel as
SYPNIA_PROJECT_KEY, as Next.js on Vercel explains. Where v0 exposes those settings is its own feature: check v0’s current documentation. - You do not need the
environmentline:@sypnia/nextreads it from Vercel, so previews report aspreviewand your real site asproduction.
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:
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 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.
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). 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.