Skip to content
DocsMenu

Add e-signatures and clickwrap with React Router

View as Markdown

Open this page inChatGPTClaudeCursor

To add e-signatures and clickwrap with React Router in framework mode, install esigncomply, @esigncomply/react and @esigncomply/browser. A resource route creates the session with the secret key and keeps the pinned versions in a signed cookie session. The React hooks attach to your own checkbox and button, and a second resource route confirms the record. Esign Comply seals each acceptance.

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 framework mode, the app npx create-react-router@latest creates, with a server. An app that uses React Router as a library, in declarative or data mode, has no server of its own: follow the React quickstart there. The Remix quickstart is about Remix 3, which is a different framework.

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

Add Esign Comply clickwrap to my React Router 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/react-router.md (the steps and the tested code for React Router)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

React Router facts
- This is React Router in framework mode: the @react-router/dev Vite plugin, routes declared in app/routes.ts, route modules with loader and action. Packages from Esign Comply (the only ones that exist): esigncomply (server code, Node.js 20.19 or later), @esigncomply/react (hooks, React 18 or later) and @esigncomply/browser.
- Keep the client in a file named *.server.ts. The build fails with "Server-only module referenced by client" when a component reaches it. Import it only in loader and action functions.
- POST /api/ceremony and POST /api/signup/confirm are resource routes: route modules with an action and no default export, registered in app/routes.ts. Return Response.json from them.
- What a loader returns is sent to the browser and is in the page's HTML. Never return a secret from one. Do not create the session in a loader: a Link with prefetch="intent" runs the loader on hover.
- Keep the signer ID and the pinned version IDs in a cookie session from createCookieSessionStorage (app/sessions.server.ts), signed with SESSION_SECRET. Send the Set-Cookie header from commitSession with the response. The cookie is signed, not encrypted: put nothing secret in it.
- Server SDK calls return { data, error } and do not throw. Check error every time.
- The default client entry wraps the app in StrictMode, so effects run twice in development. Request the session once per mount, from a promise kept in a ref.
- The form is in the server HTML before the page hydrates: keep the checkbox disabled until observeAssent has resolved.
- react-router dev loads .env into process.env. react-router-serve does not.

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. app/routes/api.ceremony.ts (action): create the session with esc.sessions.create and an Idempotency-Key, save the signer ID and the pinned version IDs in the cookie session, and return only clientToken, apiUrl and documents.
4. app/routes/legal.tsx: the loader reads the registered version with esc.documents.versions.getContent, and the component renders it inside <article data-esc-document> with dangerouslySetInnerHTML, unmodified.
5. app/routes/signup.tsx: useCeremony({ clientToken, apiUrl }), useDocument for each link, ceremony.observeAssent({ region, checkbox, submit }) from an effect, then ceremony.complete() in the submit handler. The checkbox is uncontrolled and starts unchecked.
6. app/routes/api.signup.confirm.ts (action): 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 cookie session. 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:5173/signup --callback http://localhost:5173/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 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.
  • 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 React Router app in framework mode. To start one: npx create-react-router@latest my-app. This page was run on React Router 8.5.3 with React 19.3.1, in the app that command creates from its default template.
  • Node.js 22.22 or later, which React Router 8.5.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 hooks and the browser SDK for the page:

npm install esigncomply @esigncomply/react @esigncomply/browser

@esigncomply/react is a thin layer of hooks over @esigncomply/browser. It ships no components: you build every element of the form.

Step 2. Set the key

Put the key in .env in the project folder. react-router dev loads this file into process.env, where the Node SDK finds the key itself. The starter's .gitignore already lists .env. Never give the key a VITE_ prefix: Vite puts every VITE_ variable into the code it ships to the browser. When this was tested, a loader saw the key in process.env, and import.meta.env did not hold it on the server or in the browser.

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

Add a secret for the session cookie of step 4 to the same file:

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:

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}'
{
  "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. The rules for handling keys are in /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.

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:

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 checks that it does. With your own documents, publish the text you already have and change the notice to match. See Documents and Profiles.

Step 4. Create a session on the server

One module holds the client, the test signer and the document IDs. Its name ends in .server.ts:

// app/lib/esigncomply.server.ts
import { EsignComply } from "esigncomply";

// A .server module: React Router keeps it out of the browser bundle, and the build fails if client code reaches it.
// 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";

The name matters in framework mode. React Router removes loader, action, middleware and headers from the code it sends to the browser, and a .server module may only be reached from those. When a route component imported this file in a test, react-router build stopped with Server-only module referenced by client. Under react-router dev the server still rendered that page once, and the browser's request for the route module was answered 500 with the same message.

The state the confirmation compares against lives in a cookie session, the session storage React Router ships. Its documentation recommends one file for it, app/sessions.server.ts:

// app/sessions.server.ts
import { createCookieSessionStorage } from "react-router";

type SignupSession = { signerId: string; versionIds: string[] };

// Server-owned state: the signer ID and the version IDs this server pinned, in a cookie that
// React Router signs with SESSION_SECRET. The browser cannot change it without breaking the signature.
export const { getSession, commitSession } = createCookieSessionStorage<SignupSession>({
  cookie: {
    name: "signup",
    httpOnly: true,
    path: "/",
    sameSite: "lax",
    secrets: [process.env.SESSION_SECRET!],
    secure: process.env.NODE_ENV === "production",
  },
});

The cookie is signed, not encrypted. When this page was tested, the value decoded to the signer ID and the two version IDs in plain JSON, so put nothing secret in it. A cookie whose payload had been changed, with the old signature, was refused by the confirm route with 409. Under react-router dev the cookie was marked HttpOnly and SameSite=Lax. On the built server it was marked Secure as well, and headless Chromium kept it on http://localhost.

The routes are declared in app/routes.ts. The two under /api are resource routes:

// app/routes.ts
import { type RouteConfig, index, route } from "@react-router/dev/routes";

export default [
  index("routes/home.tsx"),
  route("signup", "routes/signup.tsx"),
  route("legal/:slug", "routes/legal.tsx"),
  // Resource routes: modules with an action and no component.
  route("api/ceremony", "routes/api.ceremony.ts"),
  route("api/signup/confirm", "routes/api.signup.confirm.ts"),
] satisfies RouteConfig;

A route module with an action and no default export is a resource route: React Router answers with what the action returns and renders nothing. This one creates the session and returns three values to the browser: the client token, the API URL and the pinned documents.

// app/routes/api.ceremony.ts
import { DOCUMENTS, esc, signer } from "~/lib/esigncomply.server";
import { commitSession, getSession } from "~/sessions.server";
import type { Route } from "./+types/api.ceremony";

// A resource route: no default export, so React Router serves what the action returns.
// Step 4: create the session with the secret key. The browser gets the client token only.
export async function action({ request }: Route.ActionArgs) {
  // 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: created, 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 session = await getSession(request.headers.get("Cookie"));
  session.set("signerId", signer.external_id);
  session.set(
    "versionIds",
    created.documents.map((d) => d.version_id),
  );
  return Response.json(
    { clientToken: created.client_token, apiUrl: created.api_url, documents: created.documents },
    { headers: { "Set-Cookie": await commitSession(session) } },
  );
}

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. The ./+types/api.ceremony import is generated by React Router: npm run typecheck creates it and passed on this project.

Step 5. Attach the ceremony in the browser

The hooks render nothing. useCeremony attaches to the session, useDocument reports each document link, and observeAssent watches the checkbox, the notice and the button you built. Each step goes from the signer's browser straight to Esign Comply. The page is app/routes/signup.tsx:

// app/routes/signup.tsx
import { useEffect, useRef, useState, type FormEvent } from "react";
import { useCeremony, useDocument } from "@esigncomply/react";
import type { Route } from "./+types/signup";

export function meta({}: Route.MetaArgs) {
  return [{ title: "Create account" }];
}

type CeremonySession = { clientToken: string; apiUrl: string; documents: { version_id: string }[] };

// Document links are underlined and differ from the text around them by at least 3 to 1 (rule CR-05).
// The form sets its own colours, so the ratio does not depend on the theme of the app around it.
const FORM = { font: "16px/1.5 system-ui, sans-serif", maxWidth: 480, margin: "48px auto", padding: "0 20px", color: "#000", background: "#fff" };
const LINK = { color: "#0b57d0", textDecoration: "underline" };

export default function Signup() {
  // { clientToken, apiUrl, documents } from your resource route. Never the secret key.
  const [session, setSession] = useState<CeremonySession | null>(null);

  // One session per page load. StrictMode runs effects twice in development,
  // so the request is kept in a ref and both runs share it.
  const request = useRef<Promise<CeremonySession> | null>(null);
  useEffect(() => {
    let mounted = true;
    request.current ??= fetch("/api/ceremony", { method: "POST" }).then((response) => response.json());
    void request.current.then((value) => mounted && setSession(value));
    return () => {
      mounted = false;
    };
  }, []);

  const { ceremony, canComplete, error } = useCeremony({ clientToken: session?.clientToken, apiUrl: session?.apiUrl });
  const [terms, privacy] = session?.documents ?? [];
  const tos = useDocument<HTMLAnchorElement>(ceremony, { versionId: terms?.version_id, mode: "hyperlink" });
  const notice = useDocument<HTMLAnchorElement>(ceremony, { versionId: privacy?.version_id, mode: "hyperlink" });

  const assentRef = useRef<HTMLDivElement>(null);
  const checkboxRef = useRef<HTMLInputElement>(null);
  const submitRef = useRef<HTMLButtonElement>(null);
  const [ready, setReady] = useState(false); // true once the SDK observes the checkbox
  const [message, setMessage] = useState("");

  // Observe the assent controls once both documents are presented.
  useEffect(() => {
    if (!ceremony || !tos.presented || !notice.presented) return;
    void ceremony
      .observeAssent({
        region: assentRef.current!, // notice, links, checkbox, button
        checkbox: checkboxRef.current!,
        submit: submitRef.current!,
      })
      .then(() => setReady(true));
  }, [ceremony, tos.presented, notice.presented]);

  async function onSubmit(event: FormEvent<HTMLFormElement>) {
    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 resource 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 (err) {
      setMessage(err instanceof Error ? err.message : "Something went wrong.");
    }
  }

  return (
    <form onSubmit={onSubmit} style={FORM}>
      <h1>Create account</h1>
      <div ref={assentRef}>
        {/* The form is in the server HTML, so the box stays disabled until the SDK watches it. Only the user changes it. */}
        <label>
          <input ref={checkboxRef} 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={tos.ref} href={`/legal/terms?v=${terms?.version_id ?? ""}`} style={LINK}>Terms of Service</a> and acknowledge the{" "}
          <a ref={notice.ref} href={`/legal/privacy?v=${privacy?.version_id ?? ""}`} style={LINK}>Privacy Notice</a>.
        </p>
        <button ref={submitRef} type="submit" disabled={!canComplete}>
          Create account
        </button>
      </div>
      <p role="alert">{message || error?.message}</p>
    </form>
  );
}

Each link opens a document page on your own origin. Its loader reads the registered version with the secret key, and the component renders that HTML, unmodified:

// app/routes/legal.tsx
import { data } from "react-router";
import { DOCUMENTS, esc } from "~/lib/esigncomply.server";
import type { Route } from "./+types/legal";

// /legal/terms?v=dv_... loads one registered version. The loader runs on the server only,
// and what it returns is sent to the browser: return the document, never the key.
export async function loader({ params, request }: Route.LoaderArgs) {
  const documentId = DOCUMENTS[params.slug];
  if (!documentId) throw data("Not found", { status: 404 });
  const version = new URL(request.url).searchParams.get("v") || "current";
  const { data: content, error } = await esc.documents.versions.getContent(documentId, version);
  if (error || !content.html) throw data("Not found", { status: 404 });
  return { versionId: content.version_id, html: content.html };
}

export default function LegalDocument({ loaderData }: Route.ComponentProps) {
  // The registered version, unmodified.
  return <article data-esc-document={loaderData.versionId} dangerouslySetInnerHTML={{ __html: loaderData.html }} />;
}

Start the app and open http://localhost:5173/signup:

npm run dev

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

Account created. Record rec_28GYCi1Xt4NcVeNq2pFx

Five details matter, and each one was seen in the test run.

The session request is kept in a ref. The client entry React Router uses by default wraps the app in StrictMode, and with a plain fetch in the effect one page load sent two POST /api/ceremony under react-router dev. With the ref it sent one, under react-router dev and on the built server.

The checkbox is disabled until the SDK observes it. React Router sends the form as HTML before the script loads, and React keeps the same elements when it hydrates. In a test with the client entry held back and no disabled, a box ticked that early stayed ticked, and the SDK reported a finding for CR-01 at Block level. The box is uncontrolled and has no defaultChecked: only the user changes it.

The session is not created in a loader. In a test, hovering a Link with prefetch="intent" requested the route's .data address and its loader ran on the server before any click. A plain Link did not. A loader that created a session would create one for a visitor who never opened the page.

What a loader returns is in the page. A marker a test loader returned was in the HTML of its page twice: once rendered, and once in the data React Router sends along for hydration. The document page returns the document and nothing else. In the built files for the browser, a search for getContent, for SESSION_SECRET and for the signer's email found nothing.

The form sets its own colours, because the starter's stylesheet follows the system theme. With a dark theme and without those two properties, the page turned dark and the links measured 6.39 to 1 against white text. With them the links measure 3.29 to 1 in both themes. Rule CR-05 asks for 3 to 1.

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 resource 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 cookie session; and the document versions are exactly the ones this server pinned there. This step is never optional.

// app/routes/api.signup.confirm.ts
import { LIVE, SEALED, esc } from "~/lib/esigncomply.server";
import { getSession } from "~/sessions.server";
import type { Route } from "./+types/api.signup.confirm";

// Step 6: confirm the record with the secret key before the account exists.
export async function action({ request }: Route.ActionArgs) {
  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 session = await getSession(request.headers.get("Cookie"));
  const expected = [...(session.get("versionIds") ?? [])].sort();
  const confirmed =
    !error &&
    SEALED.includes(record.status) &&
    record.livemode === LIVE &&
    record.signer.external_id === session.get("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:

confirmed rec_28GYCi1Xt4NcVeNq2pFx (recorded)

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

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

See Server confirmation for the webhook that backs this route up when the browser closes early. A resource route suits it: React Router's check of the Origin header applies to actions of routes with a component, and a POST with another site's Origin reached this resource route in a test.

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.

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

The report for this page's code, shortened:

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:5173/api/signup/confirm answered 409.

Ceremonies
  390x844    record rec_KX2iooQyehGRk30Dwgww  session ses_UsQ3NJBQNyJPTEZBram3, 5 events
  768x1024   record rec_uodxpD61JArhxD11qgH0  session ses_DusAHB74VvqEpS5mGaSk, 5 events
  1440x900   record rec_mQiYfqRP3ZxijKykxnVt  session ses_xkx4AcLtjUTcHer6VDMg, 5 events

Summary: 0 block, 0 warn, 27 pass.

This run was made under react-router 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.

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, and every flag of the command is on the CLI page.

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.
  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 react-router-serve ./build/server/index.js 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 ./node_modules/.bin/react-router-serve ./build/server/index.js, 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 signed 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 Zero-length key is not supported. The server has no SESSION_SECRET, so React Router cannot sign the session cookie. react-router dev reads the value from .env, and the built server reads it only from its environment.
  • 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.
  • 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 react-router 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.
  • 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 and Retries and timeouts.

Questions about the React Router quickstart

Does this page apply to an app that uses React Router as a library?

No. An app that uses React Router as a library, in declarative or data mode, is a React app with no server from the framework, so there is nowhere in it to keep the key. Use the React quickstart there, with a server for the two routes. The form code is the same: the hooks do not depend on the router.

Is this the quickstart for an app that came from Remix 2?

Yes. React Router's documentation calls React Router v7 the next major version of Remix after v2, and this page was run on React Router 8.5.3 in framework mode. The Remix quickstart is about Remix 3, which has its own UI runtime and is not React.

Why are the two endpoints resource routes and not an action of the signup route?

Because they are called by address and answer with JSON. The page posts to them with fetch, and the conformance check posts a made-up record ID to the confirm route. React Router's documentation names JSON payloads and webhooks as what resource routes serve, and its check of the Origin header does not apply to them.

A script cannot, because the cookie is HttpOnly. A person who opens the browser's storage can: the value is signed, not encrypted, and it decoded to plain JSON in a test. Nobody can change it. A cookie with an altered payload and the old signature was refused with 409.

Does the React Router 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

Run on 2026-11-26 with React Router 8.5.3 in framework mode (@react-router/dev, @react-router/node and @react-router/serve 8.5.3, React 19.3.1, Vite 8.3.8), in the app that npx create-react-router@latest makes, esigncomply 1.0.4, @esigncomply/react 1.0.1 and @esigncomply/browser 1.0.4 on Node.js 24.22.1, under react-router dev (the conformance check from esigncomply 1.0.4) and as the built server under react-router-serve (one ceremony), against the API in test mode.

Last updated · API version 2026-11-21