# Add e-signatures and clickwrap with SolidStart

> Build a signup clickwrap in SolidStart with esigncomply in API routes, a useSession cookie for the pinned versions and the browser SDK in onMount. Tested code.

Source: https://esigncomply.com/docs/quickstart/solidstart

Last updated November 26, 2026

To add e-signatures and clickwrap with 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 to your own checkbox in `onMount`, and a second route confirms the record. Esign Comply seals each acceptance as an independent record.

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

This page is for SolidStart 2: the `@solidjs/start` package on Solid 1, which `npm init solid@latest` creates when you choose SolidStart. The same command offers Solid 2.0 first. Its `fullstack` shape runs on the start mode of `@solidjs/vite-plugin`, and Solid's documentation says that start mode is not SolidStart. The imports on this page do not exist there.

Paste this prompt into Cursor, Claude Code or another AI coding tool to have it build the same integration:

```text copy="Copy prompt" open="cursor"
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
```

The rest of this page is the same integration by hand, in eight steps.

## Before you start

- A test API key. [Create an account](https://esigncomply.com/signup) with your email, no card, then choose **Create test key** in the dashboard. The key is shown once and starts with `esc_test_`. An AI agent with an agent token creates it with `POST /v1/agent/api-keys`: see the [agent account API](https://esigncomply.com/docs/api/agent.md).
- Nothing else from Esign Comply. Test mode works on `localhost` with no card and no domain, and the Free plan includes it in full.
- A SolidStart 2 app. To start one: `npm init solid@latest`, then choose **SolidStart (Solid 1.x)** and version **2 (Stable)**. With no questions: `npx create-solid@latest my-app --solidstart --v2 --ts -t basic`. This page was run on SolidStart 2.2.3, in the app that command creates.
- Node.js 24 or later, which SolidStart 2.2.3 declares in its `engines` field. The `esigncomply` package needs 20.19 or later. This page was run on Node.js 24.22.1.
- `curl` and `jq` for steps 2 and 3.

## Step 1. Install

Install the server package for the routes and the browser SDK for the page:

```bash
npm install esigncomply @esigncomply/browser
```

There is no Solid package to add. The browser SDK is headless: you write the markup, and it observes it. The server files on this page read `process.env`, and the template has no Node.js types. If you type-check the project, add them with `npm install --save-dev @types/node`: without them the only errors in these files were `Cannot find name 'process'` when this was tried.

## Step 2. Set the key

Put the key in `.env` in the project folder. Under `vite dev` SolidStart's server code finds the values of this file in `process.env`: a test route read one there. Never give the key a `VITE_` prefix, because Vite puts every `VITE_` variable into the code it ships to the browser.

```bash
# .env (never commit this file)
ESIGNCOMPLY_API_KEY=esc_test_us_...
```

Add a password for the session cookie of step 4 to the same file. It needs at least 32 characters:

```bash
printf 'SESSION_SECRET=%s\n' "$(node -e 'console.log(require("node:crypto").randomBytes(32).toString("base64url"))')" >> .env
```

Load the file into your shell for the commands in steps 2, 3 and 7, then check that the key works:

```bash
set -a; . ./.env; set +a
curl -s ${ESIGNCOMPLY_API_URL:-https://esigncomply.com/v1}/usage \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" | jq '{plan_name, test_events}'
```

```json
{
  "plan_name": "Free",
  "test_events": {
    "used_this_month": 0,
    "quota_per_month": 500
  }
}
```

A `401` means the key is wrong or revoked: see [`invalid_api_key`](https://esigncomply.com/docs/api/errors.md#invalid_api_key). The rules for handling keys are in [/auth.md](https://esigncomply.com/auth.md).

## Step 3. Register a document version

Every record pins the exact version of each document by hash, so the documents are registered first. This block registers a Terms of Service and a Privacy Notice with one version each, and creates a profile: the Federal pack, a checkbox with a button, level L1. It is the same for every stack and needs `curl` and `jq`.

```bash
ESC=${ESIGNCOMPLY_API_URL:-https://esigncomply.com/v1}
KEY="Authorization: Bearer $ESIGNCOMPLY_API_KEY"
JSON="Content-Type: application/json"

# Two sample documents, one version each.
TERMS=$(curl -s $ESC/documents -H "$KEY" -H "$JSON" \
  -d '{"name":"Terms of Service","type":"terms"}' | jq -r .id); sleep 1
curl -s $ESC/documents/$TERMS/versions -H "$KEY" -H "$JSON" \
  -d '{"version_label":"1","language":"en","content":{"format":"markdown","text":"# Terms of Service\n\nThese are sample terms for a test."},"material_change":true}' \
  | jq -r .id; sleep 1
PRIVACY=$(curl -s $ESC/documents -H "$KEY" -H "$JSON" \
  -d '{"name":"Privacy Notice","type":"privacy_notice"}' | jq -r .id); sleep 1
curl -s $ESC/documents/$PRIVACY/versions -H "$KEY" -H "$JSON" \
  -d '{"version_label":"1","language":"en","content":{"format":"markdown","text":"# Privacy Notice\n\nThis is a sample privacy notice for a test."}}' \
  | jq -r .id; sleep 1

# A profile: Federal pack, checkbox plus button, L1.
PROFILE=$(curl -s $ESC/profiles -H "$KEY" -H "$JSON" \
  -d '{"name":"Signup","jurisdictions":["US-FED"],"method":"checkbox","assurance_level":"L1"}' | jq -r .id)

printf 'ESIGNCOMPLY_PROFILE_ID=%s\nESIGNCOMPLY_TERMS_ID=%s\nESIGNCOMPLY_PRIVACY_ID=%s\n' "$PROFILE" "$TERMS" "$PRIVACY"
```

It prints the two version IDs, then three lines with your own IDs:

```text
dv_YiWs9cmWoVSGp7ALPeZS
dv_bAYeA7QigKUH0iLhPpV7
ESIGNCOMPLY_PROFILE_ID=prof_SPVEgBT8a8Ror3mJ8M99
ESIGNCOMPLY_TERMS_ID=doc_bDgYFndAoC8tkeYibAVy
ESIGNCOMPLY_PRIVACY_ID=doc_mb2hnWKS0Qa7SKtucDW9
```

Add the three lines to `.env`. The pauses keep the script under the Free plan's 2 requests per second. Keep the names `Terms of Service` and `Privacy Notice`: the notice on your page names each document by its registered name, and rule [CR-02](https://esigncomply.com/docs/conformance.md#cr-02) checks that it does. With your own documents, publish the text you already have and change the notice to match. See [Documents](https://esigncomply.com/docs/api/documents.md) and [Profiles](https://esigncomply.com/docs/api/profiles.md).

## Step 4. Create a session on the server

One module holds the client, the test signer and the state the confirmation compares against:

```ts file="src/lib/esigncomply.ts"
// src/lib/esigncomply.ts
import "server-only"; // the build fails if code that runs in the browser imports this file
import { useSession } from "@solidjs/start/http";
import { EsignComply } from "esigncomply";

// The SDK reads ESIGNCOMPLY_API_KEY and ESIGNCOMPLY_API_URL from process.env itself.
export const esc = new EsignComply();

// The signer. In your app this is the signed-in user, or the account you are about to create.
export const signer = {
  external_id: "user_7c1d",
  email: "dana@example.org",
  name: "Dana Whitfield",
  class: "consumer",
  country: "US",
  region: "US-CA",
} as const;

export const DOCUMENTS: Record<string, string | undefined> = {
  terms: process.env.ESIGNCOMPLY_TERMS_ID,
  privacy: process.env.ESIGNCOMPLY_PRIVACY_ID,
};
export const SEALED = ["recorded", "timestamped", "anchored"];
// Test records in development, live records where ESIGNCOMPLY_LIVE is "true": production only.
export const LIVE = process.env.ESIGNCOMPLY_LIVE === "true";

// Server-owned state: the signer ID and the version IDs this server pinned, in a cookie that
// SolidStart encrypts with SESSION_SECRET. The browser cannot read it or change it.
export function signupSession() {
  return useSession<{ signerId?: string; versionIds?: string[] }>({
    name: "signup",
    password: process.env.SESSION_SECRET!,
  });
}
```

Two things here are specific to SolidStart. The first line is a marker SolidStart's build understands. When a route component imported this file in a test, `vite build` stopped with `Attempt to import 'server-only' in a client module`. Under `vite dev` the server still rendered that page once, and the browser's request for the module was answered `500` with the same message.

`useSession` comes from `@solidjs/start/http`. It keeps the data in a cookie it encrypts with the password, so the pinned versions need no table and no memory, and the browser cannot read or change them. When this page was tested the cookie was named `signup` and was marked `HttpOnly`, `Secure` and `SameSite=Lax`. Headless Chromium kept it on `http://localhost`.

A file under `src/routes` that exports a function named after an HTTP method is an API route. This one creates the session and returns three values to the browser: the client token, the API URL and the pinned documents.

```ts file="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 });
}
```

The signer is a fixed test person here. In your app it is the signed-in user or the account you are about to create.

Restart `vite dev` after you add a route file. Each of the three times this was tried, a route added while the dev server ran was answered `404` by the catch-all page until the restart.

## Step 5. Attach the ceremony in the browser

The browser SDK renders nothing. It observes the checkbox, the notice, the links and the button of your own markup, and reports each step from the signer's browser straight to Esign Comply. The page is `src/routes/signup.tsx`:

```tsx file="src/routes/signup.tsx"
// src/routes/signup.tsx
import { Title } from "@solidjs/meta";
import { EsignComply, type Ceremony } from "@esigncomply/browser";
import { createSignal, onCleanup, onMount } from "solid-js";

// Document links are underlined and differ from the text around them by at least 3 to 1 (rule CR-05).
const LINK = { color: "#0b57d0", "text-decoration": "underline" };

export default function Signup() {
  // This function also runs on the server while SolidStart renders the page.
  // Everything that needs the browser sits in onMount, which never runs there.
  let assent!: HTMLDivElement;
  let checkbox!: HTMLInputElement;
  let submit!: HTMLButtonElement;
  let termsLink!: HTMLAnchorElement;
  let privacyLink!: HTMLAnchorElement;

  const [versions, setVersions] = createSignal<string[]>([]); // the version IDs this session pinned, for the two links
  const [ready, setReady] = createSignal(false); // true once the SDK observes the checkbox
  const [canComplete, setCanComplete] = createSignal(false);
  const [message, setMessage] = createSignal("");
  let ceremony: Ceremony | undefined;

  // One session per page load.
  onMount(() => void start());
  onCleanup(() => ceremony?.destroy());

  async function start() {
    try {
      // Your API route creates the session and returns { clientToken, apiUrl, documents }. Never the secret key.
      const response = await fetch("/api/ceremony", { method: "POST" });
      if (!response.ok) throw new Error("We could not start the signup. Reload the page to try again.");
      const session = await response.json();

      ceremony = await EsignComply.attach({ clientToken: session.clientToken, apiUrl: session.apiUrl });
      ceremony.on("change", ({ remainingSteps }) => {
        setCanComplete(!remainingSteps.some((step) => step !== "signature.applied"));
      });

      // Point each link at the exact version this session pinned. Solid has changed both addresses when the setter returns.
      setVersions(session.documents.map((document: { version_id: string }) => document.version_id));
      await ceremony.presentDocument({ versionId: versions()[0], mode: "hyperlink", link: termsLink });
      await ceremony.presentDocument({ versionId: versions()[1], mode: "hyperlink", link: privacyLink });
      await ceremony.observeAssent({ region: assent, checkbox, submit }); // region: notice, links, checkbox, button
      setReady(true);
    } catch (error) {
      setMessage(error instanceof Error ? error.message : "Something went wrong.");
    }
  }

  async function onSubmit(event: SubmitEvent) {
    event.preventDefault();
    if (!ceremony) return;
    try {
      const result = await ceremony.complete(); // the signing act, from the signer's own click
      // The result came to the browser. Your API route confirms the record before anything is granted.
      const confirmed = await fetch("/api/signup/confirm", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ recordId: result.recordId }),
      });
      setMessage(
        confirmed.ok
          ? `Account created. Record ${result.recordId}`
          : "We could not confirm whether your acceptance was recorded. Please wait while we check.",
      );
    } catch (error) {
      setMessage(error instanceof Error ? error.message : "Something went wrong.");
    }
  }

  return (
    <form onSubmit={onSubmit} style={{ font: "16px/1.5 system-ui, sans-serif", "max-width": "480px", margin: "48px auto", padding: "0 20px" }}>
      <Title>Create account</Title>
      <h1>Create account</h1>
      <div ref={assent}>
        {/* The box is in the server HTML, so it stays disabled until the SDK watches it. Only the user changes it. */}
        <label>
          <input ref={checkbox} type="checkbox" disabled={!ready()} /> I agree to the Terms of Service and Privacy Notice
        </label>
        <p>
          By checking the box and clicking Create account, you agree to the{" "}
          <a ref={termsLink} href={`/legal/terms?v=${versions()[0] ?? ""}`} style={LINK}>Terms of Service</a> and acknowledge the{" "}
          <a ref={privacyLink} href={`/legal/privacy?v=${versions()[1] ?? ""}`} style={LINK}>Privacy Notice</a>.
        </p>
        <button ref={submit} type="submit" disabled={!canComplete()}>
          Create account
        </button>
      </div>
      <p role="alert">{message()}</p>
    </form>
  );
}
```

Each link opens a document page on your own origin. The page loads the registered version through a server function and renders that HTML, unmodified:

```tsx file="src/routes/legal/[slug].tsx"
// src/routes/legal/[slug].tsx
import { createAsync, query, useParams, useSearchParams } from "@solidjs/router";
import { HttpStatusCode } from "@solidjs/start";
import { Show } from "solid-js";
import { DOCUMENTS, esc } from "~/lib/esigncomply";

// /legal/terms?v=dv_... loads one registered version. The body of a "use server" function runs on the server only.
const getDocument = query(async (slug: string, version: string) => {
  "use server";
  const documentId = DOCUMENTS[slug];
  if (!documentId) return null;
  const { data, error } = await esc.documents.versions.getContent(documentId, version || "current");
  if (error || !data.html) return null;
  return { versionId: data.version_id, html: data.html };
}, "legal-document");

export default function LegalDocument() {
  const params = useParams();
  const [search] = useSearchParams();
  // deferStream: the server waits for the document before it sends the page, so the HTML carries the text.
  const document = createAsync(() => getDocument(params.slug ?? "", String(search.v ?? "")), { deferStream: true });

  return (
    <Show when={document()} fallback={<HttpStatusCode code={404} />}>
      {/* The registered version, unmodified. */}
      {(found) => <article data-esc-document={found().versionId} innerHTML={found().html} />}
    </Show>
  );
}
```

The body of the function marked `"use server"` stays on the server, and so does the import it uses. In the module `vite dev` sent to the browser, the function was a reference with an ID and the import of `~/lib/esigncomply` was gone. In the built files for the browser, a search for `getContent` found nothing.

`deferStream: true` matters for the record. SolidStart streams a page whose data is still loading, and the browser SDK reads the linked page as HTML, without running its scripts. Without the option, the HTML that arrived first held an empty placeholder, the document came after the closing `html` tag inside a `template` element, and the `document.presented` event carried no hash of the page. With it, the article was in the HTML and the event carried a `link_target_render_hash` equal to the hash of the registered version.

Start the app and open [http://localhost:3000/signup](http://localhost:3000/signup):

```bash
npm run dev
```

The button stays disabled until the box is ticked. Tick it, click **Create account**, and the page shows:

```text
Account created. Record rec_CWVqBvnthxa891Xg4Pqp
```

Three details matter. Everything that needs the browser sits in `onMount`, because the route component also runs on the server while SolidStart renders the page, and `onMount` does not run there. One page load sent one `POST /api/ceremony` when this was counted, under `vite dev` and on the built server. There is no wait between `setVersions(...)` and `presentDocument`: Solid had changed both addresses when the setter returned, and the SDK requested the first link with its version ID. And the checkbox is disabled until the SDK observes it. The form arrives as HTML before the script does, and hydration keeps the same elements. In a test with the script held back, a box ticked in that HTML stayed ticked, and the SDK reported a finding for [CR-01](https://esigncomply.com/docs/conformance.md#cr-01) at Block level. The box has no `checked` attribute: only the user changes it.

## Step 6. Confirm the record on the server

The result of `ceremony.complete()` was delivered to the browser, so your server does not trust it. A second API route reads the record with the secret key and grants access only when four things hold: the status is `recorded`, `timestamped` or `anchored`; `livemode` is what this deployment expects; the signer is the one in the encrypted cookie; and the document versions are exactly the ones this server pinned there. This step is never optional.

```ts file="src/routes/api/signup/confirm.ts"
// src/routes/api/signup/confirm.ts
import type { APIEvent } from "@solidjs/start/server";
import { LIVE, SEALED, esc, signupSession } from "~/lib/esigncomply";

// Step 6: confirm the record with the secret key before the account exists.
export async function POST({ request }: APIEvent) {
  const body = await request.json().catch(() => ({})); // an empty or malformed body is refused below
  const { data: record, error } = await esc.records.get(String(body.recordId));

  const { signerId, versionIds } = (await signupSession()).data;
  const expected = [...(versionIds ?? [])].sort();
  const confirmed =
    !error &&
    SEALED.includes(record.status) &&
    record.livemode === LIVE &&
    record.signer.external_id === signerId &&
    JSON.stringify(record.documents.map((d) => d.version_id).sort()) === JSON.stringify(expected);

  console.log(confirmed ? `confirmed ${record.id} (${record.status})` : "refused");
  if (!confirmed) return Response.json({ confirmed: false }, { status: 409 });
  // Only now create the account, and store record.id and record.receipt with it.
  return Response.json({ confirmed: true, recordId: record.id });
}
```

The server prints one line for each confirmation:

```text
confirmed rec_CWVqBvnthxa891Xg4Pqp (recorded)
```

A record ID that was made up is refused with status `409`. So is a real record ID sent without the session cookie:

```bash
curl -s -X POST http://localhost:3000/api/signup/confirm \
  -H "Content-Type: application/json" -d '{"recordId":"rec_made_up"}'
```

```json
{"confirmed":false}
```

See [Server confirmation](https://esigncomply.com/docs/guides/server-confirmation.md) for the webhook that backs this route up when the browser closes early.

## Step 7. Check the result

Open the dashboard and choose **Records**. The test record is there with what was observed, what was asserted, and its evidence report, watermarked TEST.

Then run the conformance check against the page. It opens the page in headless Chromium at three window sizes, signs as a visitor would, and tries four things that must be refused. One of them posts a made-up record ID to your confirm route.

```bash
npm install --save-dev playwright
npx playwright install chromium
npx esigncomply check --url http://localhost:3000/signup --callback http://localhost:3000/api/signup/confirm
```

The report for this page's code, shortened:

```text
Violations that must be refused
  REFUSED   Submit with the checkbox untouched      No record was made.
  REFUSED   Completion from another origin          The API answered 403 domain_mismatch.
  REFUSED   Programmatic click                      No record was made.
  REFUSED   Forged success posted to your callback  http://localhost:3000/api/signup/confirm answered 409.

Ceremonies
  390x844    record rec_MJ1YFSVTv6cEp00CM2Cm  session ses_WSvnGsbV91mGuh0pJnfM, 5 events
  768x1024   record rec_4gqafErXChDU40BDGkfg  session ses_P1tBTrLYs5veyaYmmSNQ, 5 events
  1440x900   record rec_GTRe1ndA4JivyXYteSYt  session ses_Es4R5QWX87axqKVXxrSh, 5 events

Summary: 0 block, 0 warn, 27 pass.
```

This run was made under `vite dev`, and the dev server logged a `confirmed` line for each of the three records. On the built server, one ceremony was signed and confirmed: the record shown in step 5. A browser that closes while its confirm request is on the way is another matter. In a test, the dev server answered a confirm request whose connection had closed after a millisecond with `Internal server error: aborted` before the route ran. That is the case the webhook of step 6 is for.

Fix every finding marked `block` and read every finding marked `warn`. Each one names the rule the screen missed, the measurement and the fix. In test mode a finding never stops a record from being sealed, so read the report. The rules are on [Conformance rules](https://esigncomply.com/docs/conformance.md), and every flag of the command is on the [CLI page](https://esigncomply.com/docs/sdk/cli.md).

## Step 8. Go live

Going live takes three steps on the Esign Comply side. There is no plan to choose and no checkout: the Free plan records 10 live signatures a month.

1. Register your production domain and verify it. See [Register a domain](https://esigncomply.com/docs/guides/domains.md).
2. Add your organization's legal name, country and address under **Go live** in the dashboard.
3. Create a live key. It is shown once and starts with `esc_live_`.

Test and live share nothing, so create the documents and the profile again with the live key, or copy them to live from the dashboard, and use the live IDs in production.

Then switch the app over:

- Set the live key as `ESIGNCOMPLY_API_KEY` and set `ESIGNCOMPLY_LIVE=true` in production only. From then on the confirm route refuses every test record there.
- Build with `npm run build` and start the server with `npm run start`, which runs `node .output/server/index.mjs` on the port in `PORT`, or 3000. Set every variable in the environment of the host. The built server does not read `.env`: started with no variables, the session route of this page answered `502` with `missing_api_key`. Started with `node --env-file=.env .output/server/index.mjs`, it created the session and confirmed the record shown in step 5.
- Set `SESSION_SECRET` on the host too. Without it the session route answered `500`.
- The pinned versions travel in the encrypted cookie, so they need no table. Store `record.id` and `record.receipt` beside the user in your database.

In live mode `context.url` must be inside your registered domain, and browser calls are accepted only from it. By default a live signature with a finding at Block level is recorded and you are told at once which rule failed. Turn on blocking, on the dashboard's Conformance page, and it is refused before it is sealed. Run the check from step 7 until no finding is at Block level before you switch keys.

## Troubleshooting

- **`/api/ceremony` answers `500` and the log says `Empty password`.** The server has no `SESSION_SECRET`. `vite dev` reads it from `.env`, and the built server reads it only from its environment. With a value shorter than 32 characters the log says `Password string too short (min 32 characters required)`.
- **`missing_api_key` from `/api/ceremony`.** The server process has no `ESIGNCOMPLY_API_KEY`, so the SDK found no key and the route answers `502`. This is what the built server answered when it was started without its variables. See [`missing_api_key`](https://esigncomply.com/docs/api/errors.md#missing_api_key).
- **`domain_mismatch` when the page loads.** The page was opened from a host that is not on the test allowlist, for example your machine's LAN address from `vite dev --host`. Test keys work on `localhost` and `127.0.0.1` at any port. Add other hosts under Domains in the dashboard. See [`domain_mismatch`](https://esigncomply.com/docs/api/errors.md#domain_mismatch).
- **`429` when the confirm route reads the record.** The route needs no retry loop: the `esigncomply` package waits for the time in `Retry-After` and tries again, up to twice. In the test, four confirmations sent at once for one record, with the cookie of the session that made it, all answered `200` on the built server, two of them a second later than the others. Four reads sent at once through the package showed why: two got `429` with `Retry-After: 1` and passed on the next attempt. See [`rate_limit_exceeded`](https://esigncomply.com/docs/api/errors.md#rate_limit_exceeded) and [Retries and timeouts](https://esigncomply.com/docs/sdk/node.md#retries-and-timeouts).

## Questions about the SolidStart quickstart

### Does this page apply to 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`, and Solid's migration guide says that start mode is not SolidStart and does not provide its runtime. The API calls are the same, and the imports from `@solidjs/start` are not.

### Why does the document page set deferStream?

So the document is in the HTML the browser SDK reads. Without the option SolidStart streamed the page, the text came after the closing tag of the document inside a `template` element, and the SDK sent no hash of the linked page. With it the event carried the hash of the registered version.

### Why did a new route answer 404 under vite dev?

Because the dev server had not been restarted. Each of the three times it was tried on SolidStart 2.2.3, a route file added while `vite dev` ran was answered by the catch-all page with `404`, and the same address answered `200` after a restart.

### What does the server-only import do?

It stops the build when code for the browser imports the file. In a test, `vite build` ended with `Attempt to import 'server-only' in a client module` and the path of the file. The session helpers of `@solidjs/start/http` carry the same marker, so a file that imports them is covered too.

### Does the SolidStart quickstart need a domain or a card?

No. Test mode works on `localhost` with a test key, no card and no domain. You register and verify a domain only when you go live, and the Free plan then records 10 live signatures a month.

## Next steps

- [E-signatures and clickwrap for SolidStart](https://esigncomply.com/solidstart): what the integration gives you on this stack, with the things to watch for.
- [Browser SDK](https://esigncomply.com/docs/sdk/browser.md): every method the page calls, and what each one records.
- [Server confirmation](https://esigncomply.com/docs/guides/server-confirmation.md): the checks in step 6 and the `record.completed` webhook.
- [Node SDK](https://esigncomply.com/docs/sdk/node.md): every method the routes call, the endpoint behind it, and the errors.
- [All quickstarts](https://esigncomply.com/docs/quickstart.md#quickstarts-by-stack-and-platform).
