Add e-signatures and clickwrap to a Deno Deploy app
To add e-signatures and clickwrap to a Deno Deploy app, store the secret key as a secret environment variable and call the REST API with fetch from your Deno.serve handler. One route creates the session, another confirms the record against DENO_TIMELINE, and Deno KV keeps the pinned state. Esign Comply seals each acceptance as an independent record.
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.
No package to install: fetch and Deno KV are built into Deno
Deno Deploy quickstartFree plan: 10 live signatures a month and a full test mode. No card required.
Last updated
// Step 4: create the session with the secret key. The browser gets the client token only. if (req.method === "POST" && url.pathname === "/api/ceremony") { const { ok, data: session } = await esc("/sessions", { method: "POST", headers: { "Idempotency-Key": `signup-${signer.external_id}-${crypto.randomUUID()}` }, body: JSON.stringify({ profile: Deno.env.get("ESIGNCOMPLY_PROFILE_ID"), signer, documents: [ { document: DOCUMENTS.terms, version: "current" }, { document: DOCUMENTS.privacy, version: "current" }, ], // The timeline that served the page: localhost, a preview URL or your production domain. context: { url: `${req.headers.get("origin") ?? url.origin}/signup`, locale: "en-US", purpose: "account_signup" }, }), }); if (!ok) return Response.json({ error: session.error?.code }, { status: 502 }); const versionIds = session.documents.map((d: { version_id: string }) => d.version_id).sort(); await kv.set(["pinned", signer.external_id], versionIds, { expireIn: 30 * 60 * 1000 }); return Response.json({ clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents });
// Deno Deploy sets DENO_TIMELINE: "production" on the production timeline, and the name of the // branch or preview everywhere else. Only production holds the live key and accepts live records. const LIVE = Deno.env.get("DENO_TIMELINE") === "production";
// Step 6: confirm the record with the secret key before the account exists. if (req.method === "POST" && url.pathname === "/api/signup/confirm") { const { recordId } = await req.json(); const { ok, data: record } = await esc(`/records/${encodeURIComponent(String(recordId))}`); const pinned = await kv.get<string[]>(["pinned", signer.external_id]); const confirmed = ok && pinned.value !== null && SEALED.includes(record.status) && record.livemode === LIVE && record.signer.external_id === signer.external_id && JSON.stringify(record.documents.map((d: { version_id: string }) => d.version_id).sort()) === JSON.stringify(pinned.value); console.log(confirmed ? `confirmed ${record.id} (${record.status})` : "refused"); if (!confirmed) return Response.json({ confirmed: false }, { status: 409 }); // Only now create the account. The record ID and the receipt stay in your own database. await kv.set(["acceptance", signer.external_id], { recordId: record.id, receipt: record.receipt, acceptedAt: record.signed_at }); return Response.json({ confirmed: true, recordId: record.id });
How do you integrate Esign Comply with Deno Deploy?
On Deno Deploy the server half is one Deno.serve handler with nothing installed: fetch makes the API calls and Deno.env.get reads the key. Two things come from the platform. DENO_TIMELINE says whether the code runs in production, and Deno KV, opened with no arguments, keeps what the session pinned in a database of its own for each timeline.
Deno Deploy is a serverless platform for running JavaScript and TypeScript applications in the cloud.
Source: Deno documentation, Deno Deploy, read on .- Create the sessionmain.ts
- DENO_TIMELINEmain.ts
- Confirmmain.ts
Run on 2026-11-26 with Deno 2.9.8 on a local machine (Deno.serve, Deno KV with --unstable-kv, DENO_TIMELINE set by hand for the production check), the browser SDK script build and the conformance check from esigncomply 1.0.4, against the API in test mode. The Deno Deploy settings are from Deno's documentation as of 2026-11-24. The code has not yet been run on Deno Deploy.
How does Esign Comply fit with Deno Deploy?
Each step uses a feature Deno Deploy already has. The secret key stays on the server side of Deno Deploy in all three.
- 01A secret environment variable holds the keyAdd
ESIGNCOMPLY_API_KEYin the app's settings under Environment Variables as a secret: the live key in the Production context, the test key in the Development context, which serves preview and branch URLs. The code reads it withDeno.env.get. Source: Deno documentation, Environment variables and contexts, read on . - 02The Deno.serve handler creates the session
POST /apisends/ceremony POST /v1with/sessions fetchand returns the client token. The same handler serves the signup page and the document pages, and the browser SDK records the ceremony from the signer's device. - 03The confirmation reads DENO_TIMELINE and Deno KV
POST /apireads the pinned versions from Deno KV and expects a live record only when/signup /confirm DENO_TIMELINEisproduction. It then stores the record ID and the receipt. Source: Deno documentation, Timelines, read on .
Where do the key, the preview hosts and the webhook go on Deno Deploy?
Four settings carry an Esign Comply integration on Deno Deploy. What is said here about Deno Deploy was read from its own documentation, and the quickstart has each command.
Environment variables and contexts
A variable can be plain text or a secret, and a secret is never visible in the console after it is saved. Each value belongs to a context: Production for the production timeline, Development for preview and branch URLs. Give the key one value in each.
Source: Deno documentation, Environment variables and contexts, read on .
Deno KV
Provision a database with the Deno KV engine and assign it to the app. Deno.openKv() then takes no arguments, and Deno Deploy creates an isolated database for each timeline. On your machine the Deno CLI needs the --unstable-kv flag.
Source: Deno documentation, Databases, read on .
Preview and branch URLs
A Git branch runs at https:/ and a preview at https:/. A test key refuses a host it does not know: list the hosts you test on, or your organization's deno.net host, under Domains in the Esign Comply dashboard as a test origin.
Source: Deno documentation, Timelines, read on .
The registered domain and the webhook
Go live on a domain you own, added to your organization in Deno Deploy and verified with Esign Comply by one DNS record: the file method is offered only for a fixed list of platform suffixes, and deno.net is not one of them. For the record.completed webhook, add a route and register its production URL under Webhooks in the Esign Comply dashboard.
Source: Deno documentation, Domains, read on .
Read on : Deno documentation, Deno Deploy, Deno documentation, Environment variables and contexts, Deno documentation, Timelines, Deno documentation, Databases, Deno documentation, Deno KV, Deno documentation, Domains.
What prompt adds Esign Comply clickwrap to a Deno Deploy 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 on Deno Deploy, what to build and what never to do, and it ends with the rules block for your project.
The rules block lives at /rules.md. Added to your project's instruction file, it makes every later session build signing and acceptance flows the same way. The prompt generator writes the long version, with your own document and profile IDs.
Pages for each AI toolAdd Esign Comply clickwrap to my app on Deno Deploy: 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/deno-deploy.md (the steps and the tested code for Deno Deploy)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)
Deno Deploy facts
- Install nothing. The server calls the REST API at https://esigncomply.com/v1 with fetch, Authorization: Bearer and the secret key. Do not invent a Deno package.
- The browser SDK is a script tag: https://esigncomply.com/sdk/v1/esigncomply.js. It defines the global EsignComply.
- The secret key is the environment variable ESIGNCOMPLY_API_KEY, added in the app's settings as a secret: the test key for the Development context, the live key for the Production context. Read it with Deno.env.get. Never print it.
- Expect live records only when Deno.env.get("DENO_TIMELINE") is "production".
- Two requests can run in two isolates. Keep the pinned version IDs in Deno KV (await Deno.openKv()), never in a module-level variable. Locally Deno KV needs the --unstable-kv flag.
- The page is on screen before the script has a session: render the checkbox disabled and enable it when observeAssent has resolved.
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. Server: POST /api/ceremony calls POST /v1/sessions with an Idempotency-Key, saves the signer ID and the pinned version IDs in Deno KV, and returns only clientToken, apiUrl and documents.
4. Server: GET /legal/terms and /legal/privacy render the html from GET /v1/documents/{id}/versions/{version_id}/content inside <article data-esc-document>, unmodified.
5. Browser: EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }), then complete() from the user's real click.
6. Server: POST /api/signup/confirm calls GET /v1/records/{id} and requires: status is "recorded", "timestamped" or "anchored"; livemode is as expected; the signer ID and version IDs equal the entry in Deno KV. Only then create the account, and store the record ID and the receipt.
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:8000/signup --callback http://localhost:8000/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.mdWhat goes wrong when you add e-signatures on Deno Deploy?
These are specific to Deno Deploy. Each one was seen while the quickstart's code was run, or is in Deno Deploy's own documentation.
- 01
A preview is not production, and the code can tell
Deno Deploy sets
Source: Deno documentation, Environment variables and contexts, read on .DENO_TIMELINEtoproductiononly on the production timeline. Started locally withDENO_TIMELINE=productionand a test key, the confirm route refused a sealed test record with409. Comparelivemodewith that variable, and give previews the test key. - 02
Deno KV needs a flag on your machine
Without
--unstable-kv, Deno 2.9.8 stopped withTypeError: Deno.openKv is not a function. The local run also needs--allow-net,--allow-envand--allow-read: without--allow-envit stopped withNotCapable: Requires env access. - 03
A branch host and a preview host are two hosts
In a test against the API, listing one branch host as a test origin let that host through and left a preview host of the same app refused with
domain_mismatch. An entry for the organization's own host,my-org.deno.net, covered both, and a host of another organization stayed refused.
Where are the Deno Deploy quickstart and the API reference?
Start with the quickstart: it carries every file this page excerpts, in the order you write them.
- QuickstartDeno Deploy quickstartStep by step, from install to your first sealed test record, with every file and the output of each step.Open
- ReferenceAPI referenceEvery endpoint, field and error code. Sessions, records and documents are the three this page uses.Open
- GuideServer confirmationThe one place access is granted: what to compare, and the webhook that backs the check up.Open
What does Esign Comply record for a signature on Deno Deploy?
The same record on every stack and platform. Your Deno Deploy code creates the session and confirms the record, and the browser SDK reports what happened on the page. Esign Comply seals the result where your code cannot change it. The record itself is described on Evidence and verification.
Observed and asserted fields
Every field is tagged. Observed is what the browser SDK and the API saw: the box unchecked at load, the tick from a trusted user event, the notice text, the terms version by hash, the server time. Asserted is what your app said, such as the user's email.
A signed receipt
complete()returns a receipt signed with ES256, using keys you do not hold. Your server stores it next to the user, andGET /v1returns it again./records /{id} /receipt 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.
Questions about e-signatures on Deno Deploy
How does test mode work on Deno Deploy preview URLs?
A test key works on a preview or branch URL once its host is a test origin of your domain. Every app of your organization runs under <org-name>.deno.net, and an entry covers its subdomains, so one entry for that host covers them. Previews use the Development context, which holds the test key.
Where should the receipt be stored on Deno Deploy?
In Deno KV or in your own database, beside the signer ID and the record ID. The quickstart writes both to Deno KV once the record is confirmed. On Deno Deploy each timeline has an isolated database, so previews and production keep separate entries.
Does a Deno Deploy app need the esigncomply package?
No. The server SDK is written for Node.js, and the quickstart calls the REST API with fetch, which Deno has built in. In a separate test, npm:esigncomply@1.0.4 loaded under Deno 2.9.8 and answered a call, but the published code does not depend on it.
How does the code tell production from a preview on Deno Deploy?
It reads DENO_TIMELINE. The value is production on the production timeline, and the name of the Git branch or the preview elsewhere. The confirm route expects a live record only in production, so a test record cannot unlock anything there.
Was this code run on Deno Deploy, or only with the Deno CLI?
Only with the Deno CLI so far. It was run with Deno 2.9.8 on a local machine, with DENO_TIMELINE set by hand for the production check, and the Deno Deploy settings come from Deno's documentation as of November 24, 2026. Variable contexts, the KV database per timeline and the preview URLs are proven only by a deployment.
Run the signing flow on Deno Deploy. Leave the record to us.
Free plan: 10 live signatures a month and a full test mode. No card required.
Deno Deploy is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Deno Deploy is from Deno Deploy's documentation or from a test run, as marked, on . /deno-deploy.md is this page as Markdown.