Skip to content
DocsMenu

Add e-signatures and clickwrap with Remix

View as Markdown

Open this page inChatGPTClaudeCursor

To add e-signatures and clickwrap with Remix, install esigncomply and @esigncomply/browser. A controller action creates the session with the secret key and keeps the pinned versions in a signed cookie session. A hydrated component attaches the browser SDK to your own checkbox, and a second action 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 Remix 3, the framework npx remix new creates today. Remix 3 has its own UI runtime and is not React. An app on Remix 1 or 2 is a React app: start from the React Router quickstart, the framework Remix 2 apps move to, or from the React quickstart for the hooks alone.

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 Remix 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/remix.md (the steps and the tested code for Remix)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

Remix facts
- This is Remix 3 (npx remix new), which has its own UI runtime. It is not React: do not use @esigncomply/react, hooks, loaders or Remix 2 route files. Read the app's AGENTS.md and node_modules/remix/INDEX.md first.
- Packages (the only ones that exist): esigncomply (server code, Node.js 20.19 or later) and @esigncomply/browser (the page).
- Browser code lives in a public/ directory under app/, and every npm package it imports must be in allowPackages in app/assets.ts. Add "@esigncomply/browser" there. Keep the module that creates the esigncomply client outside public/.
- The starter's scripts do not load .env. Start Node.js with --env-file=.env, and add .env to .gitignore: the starter does not list it. Never print the key.
- A component's setup and render also run on the server. Call fetch and EsignComply.attach in handle.queueTask or in an event handler, never in setup or render.
- The form is in the server HTML before it hydrates: render the checkbox disabled and enable it when observeAssent has resolved.
- Server SDK calls return { data, error } and do not throw. Check error every time.
- Keep the pinned version IDs in context.session, from remix/middleware/session with a signed cookie. Print the document HTML with innerHTML={unsafeHTML(html)}.

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.ts and app/actions/controller.tsx: a ceremony action for POST /api/ceremony creates the session with esc.sessions.create and an Idempotency-Key, saves the pinned version IDs in context.session, and returns only clientToken, apiUrl and documents.
4. A legal action for GET /legal/:slug renders the registered version from esc.documents.versions.getContent inside <article data-esc-document> with unsafeHTML, unmodified.
5. app/actions/public/signup-form.tsx, a clientEntry component: in a queued task, EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }) with the elements from ref(), then ceremony.complete() in the submit handler. The checkbox has no checked prop.
6. A confirm action for POST /api/signup/confirm reads the record with esc.records.get and requires: status is "recorded", "timestamped" or "anchored"; livemode is as expected; the signer ID and version IDs equal the server-owned state. 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:44100/signup --callback http://localhost:44100/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 Remix 3 app. To start one: npx remix new my-app, then npm install in its folder. This page was run on Remix 3.3.0, in the app that command creates.
  • Node.js 24.3 or later, which Remix 3.3.0 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 controller and the browser SDK for the form:

npm install esigncomply @esigncomply/browser

There is no Remix package to add, and the React hooks do not apply: Remix 3 components are not React components. The browser SDK is headless, so it attaches to the markup you write.

Remix has no bundler. Its asset server compiles each browser module when the browser asks for it, and allowPackages in app/assets.ts is the list of npm packages it may serve. Add the browser SDK to that list:

// app/assets.ts
import { createAssetServer } from 'remix/assets'
import { componentHmr } from 'remix/component-hmr/assets'

const rootDir = process.cwd()
const nodeEnv = process.env.NODE_ENV ?? 'development'
const isDevelopment = nodeEnv === 'development'
const isProduction = nodeEnv === 'production'
const isHmr = Boolean(isDevelopment && process.env.REMIX_NODE_HMR)

export const assets = createAssetServer({
  basePath: '/assets',
  rootDir,

  allowFiles: ['app/routes.ts', 'app/**/public/**'],
  // Every npm package that browser code imports is listed here.
  allowPackages: ['remix', '@esigncomply/browser'],
  denyFiles: ['app/**/*.test.*'],
  sourceMaps: isDevelopment ? 'external' : undefined,
  minify: !isDevelopment,
  fingerprint: isProduction,
  watch: isDevelopment,
  hmr: isHmr
    ? {
        channel: async () => (await import('remix/node-hmr/runtime')).createBrowserHmrChannel(),
        moduleImporter: 'remix/multiple-import-maps-polyfill',
      }
    : undefined,
  scripts: { loaders: isHmr ? [componentHmr()] : undefined },
})

const entry = 'app/actions/public/entry.ts'

export const scriptEntry = await assets.getScriptEntry(entry)

That one line is the only change to the file. Without it the signup page answered 500 when this was tried, and the log said IMPORT_NOT_ALLOWED.

Step 2. Set the key

Put the key in .env in the project folder:

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

Step 4 keeps the pinned versions in a session cookie that Remix signs, and the signature needs a secret. Add one to the same file, and keep the file out of Git:

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

Two things here are specific to the Remix starter. Its .gitignore lists node_modules/, db/*.sqlite, tmp/ and .DS_Store, and not .env. And its scripts start Node.js without an env file, so nothing reads .env yet. Add --env-file=.env to the dev and hmr scripts in package.json:

{
  "name": "my-app",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "NODE_ENV=development node --env-file=.env --watch --import remix/node-tsx server.ts",
    "hmr": "NODE_ENV=development node --env-file=.env hmr.ts",
    "start": "NODE_ENV=production node --import remix/node-tsx server.ts",
    "test": "NODE_ENV=test remix test",
    "typecheck": "tsc --noEmit"
  },
  "engines": {
    "node": ">=24.3.0"
  },
  "dependencies": {
    "@esigncomply/browser": "^1.0.4",
    "esigncomply": "^1.0.4",
    "remix": "^3.3.0"
  },
  "devDependencies": {
    "@types/node": "latest",
    "typescript": "latest"
  }
}

The start script stays as it is: in production the variables come from the host.

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 constants the actions share. It sits directly under app/, outside every public/ directory, so the asset server never sends it to a browser:

// app/esigncomply.ts
import { EsignComply } from 'esigncomply'

// Server code only. This file sits outside every public/ directory, so the asset server
// never sends it to a browser. The SDK reads ESIGNCOMPLY_API_KEY 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 client takes no argument. The server is plain Node.js started with --env-file, so the key is in process.env, which is where the SDK looks.

In Remix the URLs are declared apart from the code that answers them. Add four routes to app/routes.ts:

// app/routes.ts
import { get, post, route } from 'remix/routes'

export const routes = route({
  assets: get('/assets/*path'),
  home: '/',
  signup: get('/signup'),
  legal: get('/legal/:slug'),
  ceremony: post('/api/ceremony'),
  confirm: post('/api/signup/confirm'),
})

The router gets two more middleware: cop(), which refuses a POST that a browser sends from another origin, and session(), which reads and writes a signed cookie:

// app/router.ts
import { createCookie } from 'remix/cookie'
import { cop } from 'remix/middleware/cop'
import { render } from 'remix/middleware/render'
import { session } from 'remix/middleware/session'
import { staticFiles } from 'remix/middleware/static'
import { createRouter, type RouterContext } from 'remix/router'
import { createCookieSessionStorage } from 'remix/session-storage/cookie'

import controller from './actions/controller.tsx'
import { assets } from './assets.ts'
import { routes } from './routes.ts'

// The session cookie is signed with SESSION_SECRET. Signing stops tampering. It does not hide the contents.
// Only the test runner gets a fixed secret. Everywhere else the server does not start without one.
const secret = process.env.SESSION_SECRET ?? (process.env.NODE_ENV === 'test' ? 'test-secret' : undefined)
if (!secret) throw new Error('Set SESSION_SECRET before you start the server.')
const sessionCookie = createCookie('__session', { secrets: [secret], sameSite: 'lax' })

export const router = createRouter({
  middleware: [
    staticFiles('./public', { index: false }),
    cop(), // refuses a POST that a browser sends from another origin
    session(sessionCookie, createCookieSessionStorage()),
    render({ assets }),
  ],
})

export type AppContext = RouterContext<typeof router>

declare module 'remix' {
  interface RouterTypes {
    context: AppContext
  }
}

router.map(routes, controller)

The controller answers the routes. The ceremony action creates the session and returns three values to the browser: the client token, the API URL and the pinned documents. The version IDs it pinned go into context.session.

// app/actions/controller.tsx
import { unsafeHTML } from 'remix/component'
import { createController } from 'remix/router'

import { assets } from '../assets.ts'
import { DOCUMENTS, LIVE, SEALED, esc, signer } from '../esigncomply.ts'
import { routes } from '../routes.ts'
import { Document } from './document.tsx'
import { HomePage } from './home-page.tsx'
import { SignupForm } from './public/signup-form.tsx'

export default createController(routes, {
  actions: {
    async assets(context) {
      return (await assets.fetch(context.request)) ?? new Response('Not Found', { status: 404 })
    },
    home(context) {
      return context.render(<HomePage />)
    },

    // The page is rendered on the server. Only the form hydrates in the browser.
    signup(context) {
      return context.render(
        <Document title="Create account">
          <SignupForm />
        </Document>,
      )
    },

    // The document pages: each one renders a registered version, unmodified.
    async legal(context) {
      let documentId = DOCUMENTS[context.params.slug]
      if (!documentId) return new Response('Not Found', { status: 404 })
      let version = context.url.searchParams.get('v') || 'current'
      const { data, error } = await esc.documents.versions.getContent(documentId, version)
      if (error) return new Response('Not Found', { status: 404 })
      return context.render(
        <Document title="Document">
          {/* unsafeHTML prints the registered version as it is. As a child, {data.html} would be escaped. */}
          <article data-esc-document={data.version_id} innerHTML={unsafeHTML(data.html ?? '')} />
        </Document>,
      )
    },

    // Step 4: create the session with the secret key. The browser gets the client token only.
    async ceremony(context) {
      // The page that runs the ceremony: the origin the browser reports, plus its path.
      let origin = context.request.headers.get('origin') ?? context.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}${routes.signup.href()}`, locale: 'en-US', purpose: 'account_signup' },
        },
        { idempotencyKey: `signup-${signer.external_id}-${crypto.randomUUID()}` },
      )
      if (error) return Response.json({ error: error.code }, { status: 502 })

      // Remix signs the session cookie: the browser can read the version IDs and cannot change them.
      context.session.set(
        'pinnedVersions',
        created.documents.map((d) => d.version_id),
      )
      return Response.json({
        clientToken: created.client_token,
        apiUrl: created.api_url,
        documents: created.documents,
      })
    },

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

      let pinned = (context.session.get('pinnedVersions') as string[] | undefined) ?? []
      const confirmed =
        !error &&
        SEALED.includes(record.status) &&
        record.livemode === LIVE &&
        record.signer.external_id === signer.external_id &&
        JSON.stringify(record.documents.map((d) => d.version_id).sort()) ===
          JSON.stringify([...pinned].sort())

      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 legal action prints the registered version with unsafeHTML. Written as a child, {data.html}, the same page arrived as &lt;h1&gt;Terms of Service&lt;/h1&gt; when this was tried, and a plain string on innerHTML was answered 500. 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.

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 form is a component in a public/ directory, app/actions/public/signup-form.tsx:

// app/actions/public/signup-form.tsx
import { EsignComply, type Ceremony } from '@esigncomply/browser'
import { clientEntry, css, on, ref, type Handle } from 'remix/component'

import { routes } from '../../routes.ts'

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

// This component hydrates in the browser. Its setup and render also run on the server,
// so everything that needs the browser sits in a queued task or an event handler.
export const SignupForm = clientEntry(import.meta.url, function SignupForm(handle: Handle) {
  let assent: HTMLDivElement
  let checkbox: HTMLInputElement
  let submit: HTMLButtonElement
  let termsLink: HTMLAnchorElement
  let privacyLink: HTMLAnchorElement

  let versions: string[] = [] // the version IDs this session pinned, for the two links
  let ready = false // true once the SDK observes the checkbox
  let canComplete = false
  let message = ''
  let ceremony: Ceremony | undefined

  // One session per page load. A queued task never runs on the server.
  handle.queueTask(async () => {
    try {
      // Your action creates the session and returns { clientToken, apiUrl, documents }. Never the secret key.
      let response = await fetch(routes.ceremony.href(), { method: 'POST' })
      if (!response.ok) throw new Error('We could not start the signup. Reload the page to try again.')
      let session = await response.json()

      ceremony = await EsignComply.attach({ clientToken: session.clientToken, apiUrl: session.apiUrl })
      handle.signal.addEventListener('abort', () => ceremony?.destroy())
      ceremony.on('change', ({ remainingSteps }) => {
        canComplete = !remainingSteps.some((step) => step !== 'signature.applied')
        handle.update()
      })

      // Point each link at the exact version this session pinned, wait for the DOM, then report it.
      versions = session.documents.map((document: { version_id: string }) => document.version_id)
      await handle.update()
      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
      ready = true // the SDK watches the box from here on
      handle.update()
    } catch (error) {
      message = error instanceof Error ? error.message : 'Something went wrong.'
      handle.update()
    }
  })

  return () => (
    <form
      mix={[
        on('submit', async (event) => {
          event.preventDefault()
          if (!ceremony) return
          try {
            let result = await ceremony.complete() // the signing act, from the signer's own click
            // The result came to the browser. Your action confirms the record before anything is granted.
            let confirmed = await fetch(routes.confirm.href(), {
              method: 'POST',
              headers: { 'Content-Type': 'application/json' },
              body: JSON.stringify({ recordId: result.recordId }),
            })
            message = confirmed.ok
              ? `Account created. Record ${result.recordId}`
              : 'We could not confirm whether your acceptance was recorded. Please wait while we check.'
          } catch (error) {
            message = error instanceof Error ? error.message : 'Something went wrong.'
          }
          handle.update()
        }),
        css({ font: '16px/1.5 system-ui, sans-serif', maxWidth: '480px', margin: '48px auto', padding: '0 20px' }),
      ]}
    >
      <h1>Create account</h1>
      <div mix={ref((node) => (assent = node))}>
        {/* The form is in the server HTML, so the box stays disabled until the SDK watches it. Only the user changes it. */}
        <label>
          <input type="checkbox" disabled={!ready} mix={ref((node) => (checkbox = node))} /> 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 href={`/legal/terms?v=${versions[0] ?? ''}`} mix={[link, ref((node) => (termsLink = node))]}>
            Terms of Service
          </a>{' '}
          and acknowledge the{' '}
          <a href={`/legal/privacy?v=${versions[1] ?? ''}`} mix={[link, ref((node) => (privacyLink = node))]}>
            Privacy Notice
          </a>
          .
        </p>
        <button type="submit" disabled={!canComplete} mix={ref((node) => (submit = node))}>
          Create account
        </button>
      </div>
      <p role="alert">{message}</p>
    </form>
  )
})

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

npm run dev
Server listening on http://localhost:44100

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

Account created. Record rec_U7sEWsCnFdh9aErP1f2o

Three details matter. clientEntry marks the form as the part of the page that hydrates in the browser, and everything that needs the browser sits in handle.queueTask: Remix's documentation says a component's setup also runs on the server, where a queued task does nothing. One page load sent one POST /api/ceremony when this was counted, under npm run dev and under npm run hmr. The code awaits handle.update() after it sets versions, so the two links carry their version IDs before the SDK reads them. And the checkbox is disabled until the SDK observes it. Remix sends the form as HTML before the script loads, and the component keeps the same elements when it hydrates: a box ticked before the SDK watches it fails CR-01. In a test with the page's scripts held back, under npm run dev, under npm run hmr and in production mode, the box was disabled in the server HTML and a click on it did nothing. The box has no checked prop: 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. The confirm action in the controller 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 this server created the session for; and the document versions are exactly the ones in the session cookie. This step is never optional.

The server prints one line for each confirmation:

confirmed rec_U7sEWsCnFdh9aErP1f2o (recorded)

A record ID that was made up is refused with status 409:

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

The same request with the Origin header of another site never reached the action: cop() answered 403. A real record ID sent without the session cookie was answered 409, because there were no pinned versions to compare it with.

See Server confirmation for the webhook that backs this action 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.

npm install --save-dev playwright
npx playwright install chromium
npx esigncomply check --url http://localhost:44100/signup --callback http://localhost:44100/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:44100/api/signup/confirm answered 409.

Ceremonies
  390x844    record rec_U7sEWsCnFdh9aErP1f2o  session ses_NhufcVm1DM3LgNbC97w3, 5 events
  768x1024   record rec_s6A9V7GeQfwuDWb33R36  session ses_PtN1jaHAgFsP93xG8jcR, 5 events
  1440x900   record rec_WTeUib11fo8dsRMNPEve  session ses_jcvEd4o40JRGXxn23391, 5 events

Summary: 0 block, 0 warn, 27 pass.

This run was made under npm run dev.

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 action refuses every test record there.
  • Start it with npm run start and give the process its variables. Remix has no build step: production mode is the same server with NODE_ENV=production. In the test run that command with --env-file=.env added sealed a record, and the page showed Account created. Record rec_8hg9K8iFVXUnskXiD3Zx. The asset URLs carried a fingerprint there, and a request for /assets/app/esigncomply.ts was answered 404.
  • Set SESSION_SECRET on the host. The server in this quickstart does not start without it.
  • Store record.id and record.receipt beside the user. The session needs no store of its own: the pinned versions travel in the signed cookie.

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

  • 500 on /signup and IMPORT_NOT_ALLOWED in the log. The asset server refused an import of the form. Either @esigncomply/browser is missing from allowPackages in app/assets.ts, or the form imports a file outside a public/ directory, such as app/esigncomply.ts. Both were answered this way when they were tried. The Esign Comply API is not involved.
  • The server stops with Set SESSION_SECRET before you start the server. Node.js was started without --env-file=.env, so nothing from .env reached the process: the starter's scripts do not pass the flag. When only the key is missing, the SDK does not throw. Every call resolves with missing_api_key, and the ceremony action answers 502.
  • 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. 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 action reads the record. The action 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 session cookie, all answered 200, two of them a second later than the others: the API had answered those two reads with 429. See rate_limit_exceeded and Retries and timeouts.

Questions about the Remix quickstart

Does this quickstart work in a Remix 2 app?

No. It was run on Remix 3.3.0 only. Remix 3 has its own UI runtime, so its components are not React components and the React hooks do not apply. An app on Remix 1 or 2 is a React app: start from the React Router quickstart, the framework Remix 2 apps move to, or from the React quickstart for the hooks alone. The API calls on the server are the same.

Why is the session requested in a queued task?

Because a component's setup runs on the server too, and a queued task runs in the browser only, after the form is in the page. That is where EsignComply.attach has to run. When this was counted, one page load sent one session request, under npm run dev and under npm run hmr.

Yes, and that is fine here. Remix signs the cookie and does not encrypt it. In the test run the first part of __session decoded from base64 to JSON that held the two version IDs. A cookie whose payload was changed was answered 409 by the confirm action. Version IDs are not secrets.

Is there a build step before production?

No. npm run start runs the same TypeScript source with NODE_ENV=production. In the test run the asset server compiled the browser modules when they were requested, their URLs carried a fingerprint, and the import map sent @esigncomply/browser to a file under /assets/npm.

Does the Remix 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 Remix 3.3.0, in the app that npx remix new creates, esigncomply 1.0.4 and @esigncomply/browser 1.0.4 on Node.js 24.22.1, under npm run dev (the conformance check from esigncomply 1.0.4) and in production mode (one ceremony), against the API in test mode.

Last updated · API version 2026-11-21