# Build a clickwrap with Lovable

> Build a clickwrap with Lovable. Paste one prompt to add terms acceptance to your signup page, in your own design, with an independent record of each one.

Source: https://esigncomply.com/build/lovable

App builder · Lovable

You're building your app in Lovable and signup needs an "I agree" checkbox with a real record behind it. Paste one prompt: Lovable builds the clickwrap in your own design, and Esign Comply supplies the rules and keeps the independent record of every acceptance.

[Get started](https://esigncomply.com/signup) · [Generate a prompt](https://esigncomply.com/product/prompt-generator)

Free plan: 10 live signatures a month and a full test mode. No card required.

One prompt, from paste to record

1. Add a test key to the project's secrets · You
2. Paste one prompt into Lovable · You
3. Lovable builds the page and the server code · You
4. Acceptance reported from the user's browser · Esign Comply
5. Sealed record, receipt and timestamp · Esign Comply
6. Server confirms, then creates the account · You

Copy-paste prompt

## The prompt to paste into Lovable

Open your project in Lovable and paste this into the chat. It builds a signup clickwrap: your Terms of Service and Privacy Notice, accepted with your own checkbox and your own button.

What the prompt tells Lovable

- Read `setup.md`, `auth.md` and `llms.txt` before writing anything.
- Create the session on your server with the secret key, and send only the client token to the browser.
- Attach the browser SDK to your own checkbox and button. No widget, no iframe.
- Confirm the record on your server before the account exists.
- Never invent an API method, and stop and ask when something conflicts.

[Generate the prompt for your regions](https://esigncomply.com/product/prompt-generator)

Prompt for Lovable

```
Build a signup clickwrap for this app with Esign Comply. New users tick an unchecked "I agree" checkbox and click Create account to accept our Terms of Service and Privacy Notice. Keep our design. Esign Comply keeps the independent record.

Read these first and follow them exactly:
- https://esigncomply.com/setup.md
- https://esigncomply.com/auth.md
- https://esigncomply.com/llms.txt

Build
1. A backend function that creates the session with the secret key from ESIGNCOMPLY_API_KEY and returns only the client token and the document version IDs to the browser.
2. The signup page: attach @esigncomply/browser with the client token to the page's own checkbox and button. Call complete() from the user's real click.
3. A second backend function that confirms the record with the secret key before the account is created. The browser never decides that.

Rules
- Ask me to add ESIGNCOMPLY_API_KEY as a project secret for server-side functions, never as a VITE_ variable. Do not ask me to paste it in chat.
- Never invent API methods, packages or legal wording. If the docs do not cover it, or something conflicts with the app, stop and ask.
- Never pre-check the box.
- If a call returns domain_mismatch, tell me the origin in the error so I can add it to my test origins.

When the page works, ask me to run npx esigncomply check --url with the preview URL and paste the output back. Keep these rules in the project's Knowledge.
```

5 steps

## How to run it in Lovable

Lovable is an AI app builder. This is the whole run, from a new Esign Comply account to your first test record.

1. **Create a free account and a test key**

   Sign up, then choose Create test key in the dashboard. The key starts with `esc_test_` and is shown once. The Free plan needs no card, and test mode needs no registered domain.

2. **Add the key as a project secret**

   Store it as `ESIGNCOMPLY_API_KEY` in the secrets your backend functions read. Never give it a `VITE_` name, because that prefix puts it in the browser bundle, and never paste it into the chat.

3. **Paste the prompt into Lovable**

   Lovable builds the signup page in your design, a backend function that creates the session and a second one that confirms the record before the account is created.

4. **Add your preview host to your test origins**

   Test keys work on `localhost` with no setup. A hosted preview runs on its own host, so list that host under Domains, Test origins in the Esign Comply dashboard. If a call returns `domain_mismatch`, the message names the origin to add.

5. **Open the preview and tick the box**

   Tick the checkbox and click Create account. The test record opens in the dashboard with its findings, and Copy for AI gives you those findings as Markdown to paste back into Lovable.

[Create a free account](https://esigncomply.com/signup) · [Read the quickstart](https://esigncomply.com/docs/quickstart) · [Guide for AI app builders](https://esigncomply.com/docs/guides/ai-builders)

The 60-second result

## What you have 60 seconds after Lovable finishes

Open the preview, tick the box, click Create account. A minute after Lovable finishes, you have three pieces of code in the project and one sealed test record.

1. **The server route that creates the session**

   e.g. `app/api/ceremony/route.ts`

   It holds the secret key, pins the current version of each document and hands the browser a short-lived client token.

2. **Your signup form, with the SDK attached**

   e.g. `app/signup/signup-form.tsx`

   Your markup and your styles. The SDK renders nothing: it watches your links, your checkbox and your button, and reports what the user did.

3. **The server confirmation**

   e.g. `app/api/signup/confirm/route.ts`

   The record ID came from the browser, so the server reads the record with the secret key before the account exists.

**Create the session**

```ts
// app/api/ceremony/route.ts
import { esc } from "@/lib/esigncomply";

export async function POST(request: Request) {
  const { signerId, email, attempt } = await request.json();

  const { data: session, error } = await esc.sessions.create(
    {
      profile: "prof_signup_4f1a",
      signer: {
        external_id: signerId,
        email,
        class: "consumer",
        country: "US",
      },
      documents: [
        { document: "doc_8Hq2", version: "current" }, // Terms of Service
        { document: "doc_Pv71", version: "current" }, // Privacy Notice
      ],
      context: {
        url: "http://localhost:3000/signup",
        locale: "en-US",
        purpose: "account_signup",
      },
    },
    { idempotencyKey: `signup-${signerId}-${attempt}` },
  );
  if (error) return Response.json({ error: error.code }, { status: 502 });

  // Save signerId and the pinned version IDs in server-owned state.
  return Response.json({
    clientToken: session.client_token,
    documents: session.documents,
  });
}
```

**Signup form**

```tsx
// app/signup/signup-form.tsx
import { EsignComply } from "@esigncomply/browser";

// After /api/ceremony returns clientToken and documents:
const ceremony = await EsignComply.attach({ clientToken });

await ceremony.presentDocument({
  versionId: documents[0].version_id,
  mode: "hyperlink",
  link: document.querySelector("#tos-link"),
});
await ceremony.presentDocument({
  versionId: documents[1].version_id,
  mode: "hyperlink",
  link: document.querySelector("#privacy-link"),
});

await ceremony.observeAssent({
  region: document.querySelector("#assent"), // notice, links, box, button
  checkbox: document.querySelector("#agree"), // yours, unchecked
  submit: document.querySelector("#create-account"), // your button
});

// Called from the real submit handler, after the user ticked the box.
async function finishSignup() {
  const result = await ceremony.complete();
  // result: { recordId, receipt, verifyUrl, status }
  await fetch("/api/signup/confirm", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ recordId: result.recordId }),
  });
}
```

**Confirm on the server**

```ts
// app/api/signup/confirm/route.ts
import { esc } from "@/lib/esigncomply";

export async function POST(request: Request) {
  const { recordId } = await request.json();
  const expected = await loadCeremonyState(request); // server-owned state

  const { data: record, error } = await esc.records.get(recordId);
  if (error) return Response.json({ confirmed: false }, { status: 409 });

  const versions = record.documents.map((d) => d.version_id).sort();
  const confirmed =
    ["recorded", "timestamped", "anchored"].includes(record.status) &&
    record.livemode === (process.env.VERCEL_ENV === "production") &&
    record.signer.external_id === expected.signerId &&
    versions.join() === [...expected.versionIds].sort().join();

  if (!confirmed) return Response.json({ confirmed: false }, { status: 409 });
  // Only now create the account.
  return Response.json({ confirmed: true });
}
```

The example is written as Next.js route handlers. In Lovable, the two server parts are server routes or backend functions that make the same two calls.

The record that appears

### One sealed test record, kept by Esign Comply

Record

`rec_Z4m8`

simple · L1

Recorded

Written durably, receipt signed with ES256

Timestamped

External RFC 3161 token over the record hash

Anchored

Public anchor pending

Checkbox changed by a trusted user event · observed

Terms of Service, version dv_3kT9 · observed

Server time 2026-11-21T15:03:20.291Z · observed

Signer email dana@example.org · asserted

record_hash sha256:5be7… · example record

Your first test record opens in the dashboard with what was observed, what was asserted, and the conformance findings. It is sealed like a live record, on a separate test ledger, and its evidence report is watermarked TEST.

[Sign a live demo](https://esigncomply.com/use-cases) · [What a record holds](https://esigncomply.com/product/evidence)

## What Lovable gets right with the rules, and wrong without them

A signup page that looks right and a signup page that follows the rules are two different things. The rules cover what the page says, where it says it and what the user did, and most of them are measurements of the design Lovable builds.

[CR-01](https://esigncomply.com/docs/conformance#cr-01) · block

### Affirmative assent control

Without the rules

The checkbox ships already ticked, or a handler ticks it for the user to save a click.

With the prompt

The box renders unchecked and only a real user event changes it. The SDK records its state at load, and the check reports a pre-checked box or a scripted click at block level.

[CR-03](https://esigncomply.com/docs/conformance#cr-03) · warn

### Notice names the action control

Without the rules

"By continuing" or "by clicking below", next to a button that says something else.

With the prompt

The notice names the button by its exact label: "By checking the box and clicking Create account, you agree to the Terms of Service." The check flags vague phrases.

[CR-04](https://esigncomply.com/docs/conformance#cr-04) · block

### Notice and control in the same viewport

Without the rules

The agreement line sits in the footer or under a long form, below the fold on a phone.

With the prompt

The notice sits directly above the button in the same container. The SDK records both positions at the signing act, and the check runs your page at 390 by 844.

[CR-05](https://esigncomply.com/docs/conformance#cr-05) · warn

### Document link contrast

Without the rules

Links to the terms styled to match the sentence around them, because it looked cleaner.

With the prompt

Document links are underlined and differ in colour from the surrounding text by at least 3 to 1. The check prints the ratio it measured.

[CR-06](https://esigncomply.com/docs/conformance#cr-06) · warn

### Notice font size and contrast

Without the rules

Fine print: 10 px, light gray, tucked under a bright button.

With the prompt

The notice is set at body size, never under 12 px, with contrast of at least 4.5 to 1 against its background. The SDK measures both.

[CR-07](https://esigncomply.com/docs/conformance#cr-07) · warn

### Single primary action control

Without the rules

Email signup and two social sign-in buttons in one form, all styled as the main action under one notice.

With the prompt

One primary button inside the assent container. Social sign-in gets its own container, its own notice and its own session.

Each row is a real conformance rule with its ID and its default level. Esign Comply runs 28 of them over your test records, and every finding names the rule, the measurement and the fix.

[E-signature mistakes AI tools make](https://esigncomply.com/learn/vibe-coded-esignature-mistakes) · [All 28 conformance rules](https://esigncomply.com/docs/conformance)

## Go further with Lovable

A clickwrap is one page. The same prompt pattern builds a signing product: Lovable builds the screens, and Esign Comply keeps a record per signer.

A whole product

### Build your own signing app

Upload a document, email each signer a link to your own application and collect the signatures there. There are 7 build guides, each with the steps and the code.

[Build your own DocuSign](https://esigncomply.com/build/docusign-alternative)

Your stack

### Stack guides

The same integration written out for your framework and your host, with working code for the server, the browser and the confirmation.

[Browse the stack guides](https://esigncomply.com/guides)

Live demos

### Use cases

NDAs, contractor agreements, consent forms, order forms and terms updates. Each page has a live demo you can sign in test mode.

[See the use cases](https://esigncomply.com/use-cases)

Prompt generator

### The exact rules for your regions

Pick your use case, regions, signer types and stack. You get one prompt to paste into Lovable, with your own document and profile IDs and the rule packs you selected.

[Generate a prompt](https://esigncomply.com/product/prompt-generator)

### Build guides to follow with Lovable

- [Build your own DocuSign](https://esigncomply.com/build/docusign-alternative)
- [Build your own Dropbox Sign](https://esigncomply.com/build/dropbox-sign-alternative)
- [Build your own PandaDoc](https://esigncomply.com/build/pandadoc-alternative)
- [Build your own Adobe Acrobat Sign](https://esigncomply.com/build/adobe-sign-alternative)
- [Build your own signNow](https://esigncomply.com/build/signnow-alternative)
- [Build your own DocSend](https://esigncomply.com/build/docsend-alternative)
- [Build your own clickwrap](https://esigncomply.com/build/clickwrap)
- [All build guides](https://esigncomply.com/build)

### The same prompt for another AI tool

- [Cursor](https://esigncomply.com/build/cursor)
- [Claude Code](https://esigncomply.com/build/claude-code)
- [Codex](https://esigncomply.com/build/codex)
- [Windsurf](https://esigncomply.com/build/windsurf)
- [GitHub Copilot](https://esigncomply.com/build/github-copilot)
- [Devin](https://esigncomply.com/build/devin)
- [v0](https://esigncomply.com/build/v0)
- [Bolt](https://esigncomply.com/build/bolt)
- [Replit](https://esigncomply.com/build/replit)
- [ChatGPT](https://esigncomply.com/build/chatgpt)
- [Grok](https://esigncomply.com/build/grok)
- [Grokbot](https://esigncomply.com/build/grokbot)
- [Muse](https://esigncomply.com/build/muse)
- [All AI tools](https://esigncomply.com/build#tools)

## Questions about Lovable and e-signatures

### Can Lovable build a clickwrap or an e-signature flow?

Yes. Paste the prompt on this page and Lovable builds the signup page with your own checkbox and button, a backend function that creates the Esign Comply session and a second one that confirms the record. Esign Comply supplies the rules and keeps the independent record of each acceptance.

### Where do I put the API key in Lovable?

In the project secrets that your backend functions read, under the name ESIGNCOMPLY_API_KEY. Never as a VITE\_ variable: anything with that prefix is compiled into the browser bundle. Never paste the key into the chat either. Start with a test key.

[Guide for AI app builders](https://esigncomply.com/docs/guides/ai-builders)

### Why does my Lovable preview return domain_mismatch?

Because test keys accept browser calls from localhost and from the preview hosts you list. Add your preview host under Domains, Test origins in the Esign Comply dashboard. The error message names the exact origin to add, and an entry also covers its subdomains.

[How test mode works](https://esigncomply.com/docs/guides/test-mode)

### Does the clickwrap keep my Lovable design?

Yes. Esign Comply has no hosted signing page and no widget. The browser SDK renders nothing: it attaches to the checkbox and the button Lovable built, reports what the user did from their browser, and leaves every pixel of the page to you.

[How the SDK works](https://esigncomply.com/product/ceremony-sdk)

### How do I run the conformance check on a Lovable app?

Two ways. Open your test record in the Esign Comply dashboard, where the findings are listed, and use Copy for AI to paste them back into Lovable. Or run npx esigncomply check --url with your preview URL from a terminal on your own machine.

[Read the conformance rules](https://esigncomply.com/docs/conformance)

## Build the clickwrap in Lovable. Leave the record to us.

[Get started](https://esigncomply.com/signup) · [Documentation](https://esigncomply.com/docs)

Free plan: 10 live signatures a month and a full test mode. No card required.

Lovable is a trademark of its owner. Esign Comply is not affiliated with it.

---

Every page on esigncomply.com has a Markdown version at the same URL plus `.md` (the home page is `https://esigncomply.com/index.md`). https://esigncomply.com/llms.txt lists them.
