# Add e-signatures and clickwrap to Remix

> Add e-signatures and clickwrap to Remix 3 with esigncomply in a controller, a signed cookie session and @esigncomply/browser in a clientEntry component.

Source: https://esigncomply.com/remix

Stack · Remix

To add e-signatures and clickwrap to 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, and a second action confirms the record. Esign Comply seals each acceptance as an independent record anyone can verify.

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

[Get an API key](https://esigncomply.com/signup) · [Read the docs](https://esigncomply.com/docs/quickstart/remix)

`npm install esigncomply @esigncomply/browser`

[Remix quickstart](https://esigncomply.com/docs/quickstart/remix)

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

Last updated November 26, 2026

Run in Remix before publishing

**Controller action**

app/actions/controller.tsx (excerpt)

```tsx
// 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,
  })
```

**Hydrated form**

app/actions/public/signup-form.tsx (excerpt)

```tsx
// 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()
```

**Cookie session**

app/router.ts (excerpt)

```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 }),
  ],
})
```

**Asset allowlist**

app/assets.ts (excerpt)

```ts
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.*'],
```

Integrate with Remix

## How do you integrate Esign Comply with Remix?

This page is for Remix 3, which `npx remix new` creates: it has its own component runtime and is not React. Routes are declared in `app/routes.ts`, a controller answers them and holds the key, and the form is a `clientEntry` component in a `public/` directory, the only code the asset server sends to a browser.

Remix is a full-stack TypeScript framework for building web applications.

Source: [Remix documentation, Getting Started](https://docs.remix.run/start-here/), read on November 25, 2026.

[Remix quickstart](https://esigncomply.com/docs/quickstart/remix) · [All stacks](https://esigncomply.com/stacks)

Where each part lives in Remix

- **Controller action** · `app/actions/controller.tsx`
- **Hydrated form** · `app/actions/public/signup-form.tsx`
- **Cookie session** · `app/router.ts`
- **Asset allowlist** · `app/assets.ts`

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.

Copy-paste prompt

## What prompt adds Esign Comply clickwrap to a Remix app?

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

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

[Pages for each AI tool](https://esigncomply.com/build)

Prompt: Esign Comply clickwrap in Remix

```
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
```

3 things to watch

## What goes wrong when you add e-signatures in Remix?

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

- **Remix 3 is not React, so the hooks do not apply**

  The Remix site says: this is Remix 3, which has its own UI runtime; do not assume React hooks or Remix 2 route conventions. On 2026-11-25 `npx remix new` created that framework, at version 3.3.0. Its components take `@esigncomply/browser` directly. An app on Remix 1 or 2 is a React app: use the React Router page at `/react-router` or the React page at `/react` there.

  Source: [remix.run, llms.txt](https://remix.run/llms.txt), read on November 25, 2026.

- **The asset server serves only the packages you allow**

  Remix has no bundler: its asset server compiles browser modules on request and refuses what `app/assets.ts` does not allow. In the test, the signup page answered `500` with `IMPORT_NOT_ALLOWED` until `@esigncomply/browser` was in `allowPackages`, and again when the form imported the server module from outside `public/`.

  Source: [Remix documentation, Files and Assets](https://docs.remix.run/files-and-assets/), read on November 25, 2026.

- **The starter neither loads .env nor ignores it**

  The scripts `npx remix new` writes start Node.js without an env file, and its `.gitignore` does not list `.env`. In the test, nothing from `.env` reached the server until `--env-file=.env` was added to the `dev` script. Add `.env` to `.gitignore` before the first commit.

## Where are the Remix quickstart and the API reference?

Start with the quickstart: it carries every file this page excerpts, in the order you write them.

- Quickstart

  **[Remix quickstart](https://esigncomply.com/docs/quickstart/remix)**

  Step by step, from install to your first sealed test record, with every file and the output of each step.

- Reference

  **[API reference](https://esigncomply.com/docs/api)**

  Every endpoint, field and error code. Sessions, records and documents are the three this page uses.

- Guide

  **[Server confirmation](https://esigncomply.com/docs/guides/server-confirmation)**

  The one place access is granted: what to compare, and the webhook that backs the check up.

Verifiable

## What does Esign Comply record for a signature in Remix?

The same record on every stack and platform. Your Remix code creates the session and confirms the record, and the browser SDK reports what happened on the page. Esign Comply seals the result where your code cannot change it. The record itself is described on [Evidence and verification](https://esigncomply.com/product/evidence).

- **Observed and asserted fields**

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

- **A signed receipt**

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

- **An external timestamp**

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

- **An offline verifier**

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

[How sealing and verification work](https://esigncomply.com/product/evidence) · [Observed and asserted, in the docs](https://esigncomply.com/docs/concepts/observed-and-asserted) · [The offline verifier](https://esigncomply.com/docs/sdk/verify)

Record

`rec_Z4m8`

simple · L1

Recorded

Written durably, receipt signed with ES256

Timestamped

External RFC 3161 token over the record hash

Anchored

Public anchor pending

Checkbox changed by a trusted user event · observed

Terms of Service, version dv_3kT9 · observed

Server time 2026-11-21T15:03:20.291Z · observed

Signer email dana@example.org · asserted

record_hash sha256:5be7… · example record

## Questions about e-signatures in Remix

### Is there an Esign Comply SDK for Remix?

Yes, the two JavaScript packages, and no Remix bindings. A controller uses `esigncomply`, and a `clientEntry` component calls `@esigncomply/browser` directly. The React hooks do not apply, because Remix 3 components are not React components.

### Where do I create the session in Remix?

In a controller action, for example a `ceremony` action mapped to `POST /api/ceremony` in `app/routes.ts`, with `esc.sessions.create`. The module that creates the client sits outside every `public/` directory, and the action returns only the client token, the API URL and the pinned documents.

### Does this work in a Remix 1 or Remix 2 app?

Not this code. It was run on Remix 3.3.0 only, and Remix 3 has its own UI runtime. An app on Remix 1 or 2 is a React app, so start from the React Router page at `/react-router`, the framework Remix 2 apps move to, or from the React page at `/react`. The two server calls are the same on every stack.

### Why does the form start the ceremony in a queued task?

Because a component's setup runs on the server too, and Remix's documentation says a queued task does nothing there. `EsignComply.attach` has to run in the browser. In the test, one page load sent one `POST /api/ceremony`, under `npm run dev` and under `npm run hmr`.

### Does Remix need 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 on request, their URLs carried a fingerprint, and a ceremony in that mode ended in a sealed, confirmed record.

### Other stacks

- [React Router](https://esigncomply.com/react-router)
- [React](https://esigncomply.com/react)
- [Next.js](https://esigncomply.com/nextjs)

### Platforms used with Remix

- [Cloudflare Workers](https://esigncomply.com/cloudflare-workers)
- [Deno Deploy](https://esigncomply.com/deno-deploy)

[All stacks](https://esigncomply.com/stacks) · [All platforms](https://esigncomply.com/platforms) · [Clickwrap API](https://esigncomply.com/clickwrap) · [E-signature API](https://esigncomply.com/sign)

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

[Get an API key](https://esigncomply.com/signup) · [Read the docs](https://esigncomply.com/docs/quickstart/remix)

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

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

---

Every page on esigncomply.com has a Markdown version at the same URL plus `.md` (the home page is `https://esigncomply.com/index.md`). https://esigncomply.com/llms.txt lists them.

---

Esign Comply is the e-signature API and clickwrap API for developers who build their own signing flow in their own UI: it supplies the ceremony rules as a generated prompt for AI coding tools, records events in direct browser ceremonies, and seals independent, verifiable evidence.
