Skip to content
Stack · SolidStart

Add e-signatures and clickwrap to SolidStart

To add e-signatures and clickwrap to SolidStart, install esigncomply and @esigncomply/browser. An API route creates the session with the secret key and keeps the pinned versions in an encrypted cookie from useSession. The page attaches the browser SDK in onMount, and a second route confirms the record. Esign Comply seals each acceptance as an independent record anyone can verify.

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
SolidStart quickstart

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

Last updated

Run in SolidStart before publishing
src/routes/api/ceremony.ts
// src/routes/api/ceremony.ts
import type { APIEvent } from "@solidjs/start/server";
import { DOCUMENTS, esc, signer, signupSession } from "~/lib/esigncomply";

// Step 4: create the session with the secret key. The browser gets the client token only.
export async function POST({ request }: APIEvent) {
  // The page that runs the ceremony: the origin the browser reports, plus its path.
  const origin = request.headers.get("origin") ?? new URL(request.url).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}-${crypto.randomUUID()}` },
  );
  if (error) return Response.json({ error: error.code }, { status: 502 });

  const cookie = await signupSession();
  await cookie.update({ signerId: signer.external_id, versionIds: session.documents.map((d) => d.version_id) });
  return Response.json({ clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents });
}
Integrate with SolidStart

How do you integrate Esign Comply with SolidStart?

In SolidStart a file under src/routes that exports POST is an API route, and the key stays there and inside functions marked "use server". useSession from @solidjs/start/http keeps the pinned versions in an encrypted cookie. A route component also runs on the server, so the page attaches the browser SDK in onMount.

SolidStart v2 builds a full-stack app on top of Solid v1 and Vite v8+.

Source: SolidStart v2 documentation, Overview, read on .
Where each part lives in SolidStart
  • API routesrc/routes/api/ceremony.ts
  • Pagesrc/routes/signup.tsx
  • Session cookiesrc/lib/esigncomply.ts
  • Server functionsrc/routes/legal/[slug].tsx

Run on 2026-11-26 with SolidStart 2.2.3 (Solid 1.9.20, Solid Router 1.0.3, Vite 8.3.8, Nitro 3.0.260610-beta), esigncomply 1.0.4 and @esigncomply/browser 1.0.4 on Node.js 24.22.1, under vite dev (the conformance check from esigncomply 1.0.4) 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 SolidStart 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 SolidStart, 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 SolidStart
Add Esign Comply clickwrap to my SolidStart 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/solidstart.md (the steps and the tested code for SolidStart)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

SolidStart facts
- This is SolidStart 2: @solidjs/start 2 on Solid 1, with Vite and Nitro, configured in vite.config.ts. It is not the Solid 2.0 fullstack template of create-solid: do not use @solidjs/vite-plugin start mode or Solid 2 APIs.
- Packages (the only ones that exist): esigncomply (server code, Node.js 20.19 or later) and @esigncomply/browser (the page). There is no Solid package.
- Create the client in one module that starts with import "server-only". Import it only from API routes and from inside functions marked "use server". The build fails when a component reaches it any other way.
- The secret key is in ESIGNCOMPLY_API_KEY in .env. Read it from process.env in server code only. Never give it a VITE_ prefix and never read it in a component.
- 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 encrypted cookie from useSession (@solidjs/start/http). The password is SESSION_SECRET, at least 32 characters.
- A route component also runs on the server. Call fetch and EsignComply.attach inside onMount only. The form is in the server HTML before the script loads: keep the checkbox disabled until observeAssent has resolved.
- The document pages load their text with createAsync and { deferStream: true }. Without it the page is streamed, and the HTML that arrives first has no document in it.
- Restart vite dev after you add a route file. The built server does not read .env.

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. src/routes/api/ceremony.ts (POST): 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. src/routes/legal/[slug].tsx: a query whose function is marked "use server" loads the registered version from esc.documents.versions.getContent, and the page renders it inside <article data-esc-document> with innerHTML, unmodified.
5. src/routes/signup.tsx: in onMount, EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }) with ref elements, then ceremony.complete() in the submit handler. The checkbox has no checked attribute.
6. src/routes/api/signup/confirm.ts (POST): 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 encrypted 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 SolidStart?

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

  • 01

    A streamed document page has no document in its first HTML

    SolidStart streams a page whose data is still loading, and the browser SDK reads a linked document page as HTML without running scripts. In the test on SolidStart 2.2.3 the document.presented event then carried no hash of the page. With deferStream: true on createAsync it carried the hash of the registered version.

    Source: Solid Router documentation, createAsync, read on .
  • 02

    create-solid offers Solid 2.0 first, and that is not SolidStart

    On 2026-11-26 npm init solid@latest listed Solid 2.0 before SolidStart (Solid 1.x). Solid's documentation says the start mode behind the Solid 2.0 templates is not SolidStart and does not provide its runtime. This page was run on SolidStart 2.2.3: choose SolidStart and version 2, or pass --solidstart --v2.

    Source: Solid documentation, From SolidStart, read on .
  • 03

    A route file added while vite dev runs answers 404

    Each of the three times it was tried on SolidStart 2.2.3, a file added under src/routes while vite dev ran was answered by the catch-all page with 404: an API route, a page, and a page again. The same address answered 200 after a restart. Restart the dev server after you add the routes of the quickstart.

Verifiable

What does Esign Comply record for a signature in SolidStart?

The same record on every stack and platform. Your SolidStart 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 SolidStart

Is there an Esign Comply SDK for SolidStart?

Yes, the two JavaScript packages, and no Solid bindings. API routes and server functions use esigncomply, and the page calls @esigncomply/browser directly in onMount. The browser SDK is headless, so it attaches to the markup you wrote.

Where do I create the session in SolidStart?

In an API route, for example src/routes/api/ceremony.ts, with esc.sessions.create. The client lives in a module that starts with import "server-only", and the route returns only the client token, the API URL and the pinned documents.

Does this code run on the Solid 2.0 fullstack template?

No. It was run on SolidStart 2.2.3, which runs on Solid 1. The Solid 2.0 templates use the start mode of @solidjs/vite-plugin, which Solid's documentation says is not SolidStart, so the imports from @solidjs/start do not exist there. The two API calls are the same on every stack.

What does "use server" keep out of the browser?

The body of the function and the imports only it uses. In the test, the module vite dev sent to the browser held a reference with an ID in place of the function, the import of the server module was gone, and the built browser files did not contain getContent.

What happens when SESSION_SECRET is missing?

The session route answers 500. In the test, the built server started without SESSION_SECRET logged Empty password, and with a value shorter than 32 characters it logged Password string too short. vite dev reads the value from .env, and the built server only from its environment.

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

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

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

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