Skip to content
Stack · Nuxt

Add e-signatures and clickwrap to Nuxt

To add e-signatures and clickwrap to Nuxt, install esigncomply and @esigncomply/browser. A route under server/api creates the session with the secret key and keeps the pinned versions in a sealed cookie, the page attaches the browser SDK in onMounted, and a second route confirms the record. Esign Comply seals each acceptance as an independent record.

Follow the quickstart and each signature is a valid electronic signature under the U.S. ESIGN Act, state UETA laws and New York's ESRA, and each clickwrap is built the way courts require: clear notice of the terms, an unmistakable act of assent, and a sealed record of both.

$npm install esigncomply @esigncomply/browser
Nuxt quickstart

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

Last updated

Run in Nuxt before publishing
server/api/ceremony.post.ts
// server/api/ceremony.post.ts
import { randomUUID } from "node:crypto";

// Step 4: create the session with the secret key. The browser gets the client token only.
export default defineEventHandler(async (event) => {
  // Open the sealed cookie first: a missing session password fails here, before a session exists.
  const state = await pinnedState(event);

  // The page that runs the ceremony: the origin the browser reports, plus its path.
  const origin = getRequestHeader(event, "origin") ?? getRequestURL(event).origin;

  const { data: session, error } = await esc.sessions.create(
    {
      profile: process.env.ESIGNCOMPLY_PROFILE_ID!,
      signer,
      documents: [
        { document: DOCUMENTS.terms!, version: "current" },
        { document: DOCUMENTS.privacy!, version: "current" },
      ],
      context: { url: `${origin}/signup`, locale: "en-US", purpose: "account_signup" },
    },
    { idempotencyKey: `signup-${signer.external_id}-${randomUUID()}` },
  );
  if (error) {
    setResponseStatus(event, 502);
    return { error: error.code };
  }

  await state.update({ signer: signer.external_id, versions: session.documents.map((d) => d.version_id) });
  return { clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents };
});
Integrate with Nuxt

How do you integrate Esign Comply with Nuxt?

In Nuxt the server half lives in the same project. Files under server/api hold the secret key and become the routes, useSession from h3 keeps the pinned versions in a sealed cookie, and the page attaches the browser SDK in onMounted, because its <script setup> also runs on the server while Nuxt renders it.

Nuxt describes itself as a free and open-source framework to create type-safe, performant full-stack web applications and websites with Vue.js, with server-side rendering built in by default.

Source: Nuxt documentation, Introduction, read on .
Where each part lives in Nuxt
  • Server routeserver/api/ceremony.post.ts
  • Pageapp/pages/signup.vue
  • Sealed cookieserver/utils/esigncomply.ts
  • Confirm routeserver/api/signup/confirm.post.ts

Run on 2026-11-26 with Nuxt 4.7.0 (Nitro 2.14.0, h3 1.15.11, Vite 8.3.8, Vue 3.5.46), esigncomply 1.0.4 and @esigncomply/browser 1.0.4 on Node.js 24.22.1, under nuxt dev (the conformance check from esigncomply 1.0.4, --timeout 60) and as the built Node.js server (one ceremony), against the API in test mode.

Copy-paste prompt

What prompt adds Esign Comply clickwrap to a Nuxt app?

Paste this into Cursor, Claude Code or the AI coding tool that is open on your project. It names the packages that exist, where the secret key goes in Nuxt, what to build and what never to do, and it ends with the rules block for your project.

The rules block lives at /rules.md. Added to your project's instruction file, it makes every later session build signing and acceptance flows the same way. The prompt generator writes the long version, with your own document and profile IDs.

Pages for each AI tool
Prompt: Esign Comply clickwrap in Nuxt
Add Esign Comply clickwrap to my Nuxt app: a signup form where the user accepts the Terms of Service and the Privacy Notice with a checkbox and a button.

Read these first and follow them exactly. If something conflicts with existing code, or you are unsure how to implement a step, stop and ask. Do not invent API methods, packages or legal wording.
- https://esigncomply.com/docs/quickstart/nuxt.md (the steps and the tested code for Nuxt)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

Nuxt facts
- Packages (the only ones that exist): esigncomply (server routes, Node.js 20.19 or later) and @esigncomply/browser (the page). There is no Nuxt module and no Vue package. Use Nuxt 4 with the app/ and server/ directories.
- The secret key is in ESIGNCOMPLY_API_KEY in .env and is read only by files under server/. Never put it under runtimeConfig.public, never read it in a page or a component: a page's script also runs on the server, and what its template prints is sent as HTML. Never import a file from server/ into the app.
- Server SDK calls return { data, error } and do not throw. Check error every time.
- Keep the signer ID and the pinned version IDs in the sealed cookie from useSession(event, { password }). The password is NUXT_SESSION_PASSWORD, at least 32 characters, read through runtimeConfig.
- Request the session from the page in onMounted with $fetch. Do not use $fetch or useFetch for it at the top of <script setup>: the first creates two sessions, the second leaves the browser without the session cookie.
- The built server does not read .env. In production, set every variable in the host's environment.
- The form is in the server HTML before the page hydrates: render the checkbox disabled and enable it when observeAssent has resolved.

Build
1. Verify the key: GET /v1/usage with ESIGNCOMPLY_API_KEY. Stop if it fails.
2. Register the Terms of Service and the Privacy Notice as documents and publish one version of each from the documents in this project. If the project has none, register short sample documents and say so in your report. Never write or change the wording of the real documents. Create a profile: jurisdictions ["US-FED"], method "checkbox", assurance_level "L1".
3. server/api/ceremony.post.ts: create the session with esc.sessions.create and an Idempotency-Key, save the signer ID and the pinned version IDs with useSession, and return only clientToken, apiUrl and documents.
4. server/routes/legal/[slug].get.ts: render the registered version from esc.documents.versions.getContent inside <article data-esc-document>, unmodified.
5. app/pages/signup.vue: in onMounted, EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }) with template refs, then ceremony.complete() in the submit handler. The checkbox has no checked attribute and no v-model that starts true.
6. server/api/signup/confirm.post.ts: read the record with esc.records.get and require: status is "recorded", "timestamped" or "anchored"; livemode is as expected; the signer ID and version IDs equal the ones in the sealed cookie. Only then create the account.

Never
- Never pre-check the box, auto-submit, or call .click() on the user's behalf.
- Never use "By continuing" or "By clicking below" wording. The notice names the button by its label and each document by its registered name.
- Never put the secret key, or any call that uses it, in code that reaches the browser.
- Never show "signed" or "accepted" before the server has confirmed the record.
- Never fall back to an acceptance with no record when a session is refused.

Check before you report success
- Run: npx esigncomply check --url http://localhost:3000/signup --callback http://localhost:3000/api/signup/confirm
  Fix every finding marked "block". List every finding marked "warn".
- Report the files you created or changed, anything you did not implement and why, and the conformance summary.

Then add the rules block to this project's instruction file: https://esigncomply.com/rules.md
3 things to watch

What goes wrong when you add e-signatures in Nuxt?

These are specific to Nuxt. Each one was seen while the quickstart's code was run, or is in Nuxt's own documentation.

  • 01

    $fetch at the top of script setup creates two sessions

    A page's <script setup> runs on the server while Nuxt renders it and again in the browser. In a test on Nuxt 4.7.0, await $fetch("/api/ceremony", { method: "POST" }) at the top of the block reached the route twice for one page load. The quickstart requests the session in onMounted, and one page load sent one request.

    Source: Nuxt documentation, Data Fetching, read on .
  • 02

    A cookie set during server rendering does not reach the browser

    With useFetch in the page, the session route ran once, on the server, and the browser kept no cookie. Nuxt's documentation says passing cookies from an internal request back to the client is yours to handle. The sealed cookie holds the pinned versions, so the browser makes the request itself.

    Source: Nuxt documentation, Data Fetching, read on .
  • 03

    The built server does not read .env

    nuxt dev loads .env. Nuxt's documentation says the file is not read once the server is built. In the test, node .output/server/index.mjs with no variables answered 500 on the session route, with Empty password in the log. With node --env-file=.env the same build sealed a record.

    Source: Nuxt documentation, .env, read on .
Verifiable

What does Esign Comply record for a signature in Nuxt?

The same record on every stack and platform. Your Nuxt code creates the session and confirms the record, and the browser SDK reports what happened on the page. Esign Comply seals the result where your code cannot change it. The record itself is described on Evidence and verification.

  • Observed and asserted fields

    Every field is tagged. Observed is what the browser SDK and the API saw: the box unchecked at load, the tick from a trusted user event, the notice text, the terms version by hash, the server time. Asserted is what your app said, such as the user's email.

  • A signed receipt

    complete() returns a receipt signed with ES256, using keys you do not hold. Your server stores it next to the user, and GET /v1/records/{id}/receipt returns it again.

  • An external timestamp

    An outside authority timestamps the hash of every live record (RFC 3161), so the time on the record does not rest on your clock or on ours.

  • An offline verifier

    Each record has an evidence report (PDF) and an evidence package (ZIP). Anyone you send the package to checks the acceptance with the open-source esigncomply-verify, without an account.

Recordrec_Z4m8
simple · L1
RecordedWritten durably, receipt signed with ES256
TimestampedExternal RFC 3161 token over the record hash
AnchoredPublic anchor pending
Checkbox changed by a trusted user eventobserved
Terms of Service, version dv_3kT9observed
Server time 2026-11-21T15:03:20.291Zobserved
Signer email dana@example.orgasserted
record_hash sha256:5be7…example record

Questions about e-signatures in Nuxt

Is there an Esign Comply SDK for Nuxt?

Yes, the two JavaScript packages, and no Nuxt module. Server routes use esigncomply, and the page calls @esigncomply/browser directly in onMounted. There are no Vue bindings to install: the SDK is headless and attaches to the template you wrote.

Where do I create the session in Nuxt?

In a server route under server/api, for example server/api/ceremony.post.ts, with esc.sessions.create. Files under server/ hold the secret key, and the route returns only the client token, the API URL and the pinned documents to the page.

Where does Nuxt keep the pinned versions between the two routes?

In the sealed cookie that useSession from h3 sets. In the test run the cookie was named h3, was marked HttpOnly and Secure, and its value was 441 characters long. The browser carries it and cannot read or change it, and the confirm route compares the record against it.

What happens when a page imports the server module?

The esigncomply constructor throws in the browser. In a test on Nuxt 4.7.0, a page that imported server/utils/esigncomply.ts rendered on the server, and the browser then showed a 500 page saying the server SDK was loaded in a browser. Nuxt did not stop the import, in nuxt dev or in nuxt build.

Can a Nuxt page read a secret from runtimeConfig?

Not in the browser, and it must not on the server. In a test, a private runtimeConfig key read in a page was undefined in the browser, yet the server-rendered HTML carried the value the template printed. Read secrets only in files under server/.

Build the signup in your own Nuxt app. Leave the record to us.

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

Nuxt is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Nuxt is from Nuxt's documentation or from a test run, as marked, on . /nuxt.md is this page as Markdown.

Working with an AI tool? This page is also available as Markdown: /nuxt.md