Skip to content
Platform · DigitalOcean App Platform

Add e-signatures and clickwrap on DigitalOcean App Platform

To add e-signatures and clickwrap on DigitalOcean App Platform, run the esigncomply package in a Node.js service and declare the secret key in the app spec as an encrypted SECRET variable. The service creates the session and confirms the record, and a managed PostgreSQL database keeps the receipt. 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.

$npm install esigncomply pg
DigitalOcean App Platform quickstart

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

Last updated

Run locally for DigitalOcean App Platform before publishing
server.js (excerpt)
// 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 { data: session, error } = await esc.sessions.create(
    {
      profile: process.env.ESIGNCOMPLY_PROFILE_ID,
      signer,
      documents: [
        { document: DOCUMENTS.terms, version: "current" },
        { document: DOCUMENTS.privacy, version: "current" },
      ],
      // The page that runs the ceremony: the origin the browser reports, plus its path.
      context: { url: `${req.headers.origin ?? url.origin}/signup`, locale: "en-US", purpose: "account_signup" },
    },
    { idempotencyKey: `signup-${signer.external_id}-${randomUUID()}` },
  );
  if (error) return json(res, 502, { error: error.code });
  // In the database, not in memory: the next request can reach another container.
  await savePinned(signer.external_id, session.documents.map((d) => d.version_id).sort());
  return json(res, 200, { clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents });
}
Integrate with DigitalOcean App Platform

How do you integrate Esign Comply with DigitalOcean App Platform?

On App Platform the server half is one service of an app spec, .do/app.yaml. App Platform sets PORT from http_port, asks /health to decide whether a container gets traffic, and sends SIGTERM to a container it replaces. A job of kind PRE_DEPLOY creates the table. instance_count runs several containers with separate filesystems, so the pinned versions go to a managed PostgreSQL database.

App Platform is a fully managed Platform-as-a-Service (PaaS) that deploys applications from Git repositories or container images.

Source: DigitalOcean documentation, App Platform, read on .
Where each part lives on DigitalOcean App Platform
  • Serviceserver.js
  • App spec.do/app.yaml
  • Confirmserver.js
  • Databasestore.js

Run on 2026-11-26 in the images that doctl apps dev build made from this code (doctl 2.10.0 with DigitalOcean's builder image digitaloceanapps/cnb-local-builder:heroku-22_v0.97.0 and run image digitaloceanapps/apps-run:heroku-22_e731548, heroku/nodejs 0.342.5, Node.js 24.15.0 on Ubuntu 22.04), started with the run commands of .do/app.yaml as two web containers and the PRE_DEPLOY job (PORT, the health check path, SIGTERM) with PostgreSQL 17.12 in a container in place of a managed database, with esigncomply 1.0.4, pg 8.23.1, the browser SDK script build and the conformance check from esigncomply 1.0.4, against the API in test mode. .do/app.yaml passed doctl apps spec validate --schema-only. The same code also ran under Node.js 24.22.1 on the machine. doctl got a placeholder in place of an access token and a closed local port as its API address, so no DigitalOcean account was used. The App Platform settings are from DigitalOcean's documentation as of that date, and the workflow and the doctl apps create command in step 8 were not run. Nothing has been deployed to App Platform yet.

Three steps

How does Esign Comply fit with DigitalOcean App Platform?

Each step uses a feature DigitalOcean App Platform already has. The secret key stays on the server side of DigitalOcean App Platform in all three.

  1. 01
    An encrypted variable holds the keyDeclare ESIGNCOMPLY_API_KEY in the app spec with type: SECRET. DigitalOcean's reference says the value is encrypted on first submission. The spec in your repository holds a reference, ${ESIGNCOMPLY_API_KEY}, which DigitalOcean's GitHub Action fills in from a repository secret when it deploys. The SDK reads the key from process.env. Source: DigitalOcean docs, Reference for App Specification, read on .
  2. 02
    The service creates the sessionrun_command: node server.js starts the component that receives HTTP requests. POST /api/ceremony calls esc.sessions.create there and returns the client token. The same service serves the signup page, and the browser SDK records the ceremony from the signer's device. Source: DigitalOcean docs, How to Manage Services, read on .
  3. 03
    A managed database keeps the receiptThe session route stores the pinned versions in a table of the PostgreSQL cluster the spec attaches, which the service reaches through ${db.DATABASE_URL}. The confirm route reads the record with the secret key, compares it with the row, and writes the record ID and the receipt into it. A PRE_DEPLOY job creates the table. Source: DigitalOcean docs, How to Manage Databases, read on .
DigitalOcean App Platform setup

Where do the key, the preview hosts and the webhook go on DigitalOcean App Platform?

Four settings carry an Esign Comply integration on DigitalOcean App Platform. What is said here about DigitalOcean App Platform was read from its own documentation, and the quickstart has each command.

Variables

App-level envs of the spec reach every component, the service and the job. The production workflow passes the live key, the live IDs and ESIGNCOMPLY_LIVE as true, a preview workflow the test key and the test IDs. DigitalOcean's documentation notes that an encrypted variable is decrypted in the running container, where team members who can open the app's console can read it. On your machine the values go in .env.

Source: DigitalOcean docs, How to Use Environment Variables, read on .

The run command, the port and the health check

Set run_command to node server.js: the default of a Node.js component is npm start. Listen on 0.0.0.0 on the port in PORT, which App Platform sets from http_port. health_check.http_path makes the check an HTTP request to /health, and without it App Platform uses a TCP check. In the test /health answered 503 while the database was unreachable.

Source: DigitalOcean docs, Set Up and Manage Health Checks, read on .

Preview apps and test mode

DigitalOcean documents pull request previews as a GitHub Actions workflow: its action deploys one app per pull request with deploy_pr_preview, and a second workflow deletes it. Give that workflow the test key. Each preview app answers on a host of its own under ondigitalocean.app. List that exact host under Domains in the Esign Comply dashboard as a test origin, never the shared suffix.

Source: DigitalOcean docs, Deploy using GitHub Actions, read on .

The registered domain and the webhook

Go live on a domain you own: add it on the app's Networking tab, register it and verify it with one DNS record. File verification is not offered for ondigitalocean.app. DigitalOcean's page shows an ingress rule that redirects the starter domain to your domain. For the record.completed webhook, add a route to the service and register its production URL under Webhooks in the Esign Comply dashboard.

Source: DigitalOcean docs, How to Manage Domains, read on .

Read on : DigitalOcean docs, Reference for App Specification, DigitalOcean docs, How to Use Environment Variables, DigitalOcean docs, Set Up and Manage Health Checks, DigitalOcean docs, How to Scale Apps, DigitalOcean docs, How to Store Data, DigitalOcean docs, How to Manage Databases, DigitalOcean docs, Connect to PostgreSQL Clusters, DigitalOcean docs, Cron Jobs and Deployment Jobs, DigitalOcean docs, How to Manage Services, DigitalOcean docs, App Termination Settings, DigitalOcean docs, Node.js Buildpack, DigitalOcean docs, How to Create Apps, DigitalOcean docs, Deploy using GitHub Actions, DigitalOcean app_action, README, DigitalOcean docs, How to Manage Domains, DigitalOcean docs, App Platform Limits, DigitalOcean docs, How to Build Components Locally, DigitalOcean docs, doctl apps spec validate.

Copy-paste prompt

What prompt adds Esign Comply clickwrap to a DigitalOcean App Platform 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 DigitalOcean App Platform, 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 tool
Prompt: Esign Comply clickwrap on DigitalOcean App Platform
Add Esign Comply clickwrap to my app on DigitalOcean App Platform: 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/digitalocean-app-platform.md (the steps and the tested code for DigitalOcean App Platform)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

DigitalOcean App Platform facts
- Packages (the only ones that exist): esigncomply (server, Node.js 20.19 or later, an ES module) and @esigncomply/browser. Without a bundler, load the browser SDK from https://esigncomply.com/sdk/v1/esigncomply.js.
- The secret key is the environment variable ESIGNCOMPLY_API_KEY, declared in .do/app.yaml with type: SECRET. Never write its value in the file: the deploy workflow fills it in from a repository secret, or it is typed into the control panel with Encrypt. Never print it.
- The service listens on 0.0.0.0 on the port in PORT (http_port, 8080 by default). Set run_command to "node server.js": the default of a Node.js component is npm start.
- A service can run several containers, each with its own ephemeral filesystem. Keep the pinned version IDs in the managed PostgreSQL database (DATABASE_URL from ${db.DATABASE_URL}), never in a variable of the process or in a file.
- Pass ${db.CA_CERT} as DATABASE_CA_CERT. Where it is set, remove sslmode from the URL and give pg ssl: { ca }: pg 8 lets sslmode in the URL replace the ssl option.
- Create the table in a job of kind PRE_DEPLOY with CREATE TABLE IF NOT EXISTS: it runs before every deployment.
- Handle SIGTERM: App Platform sends it to a container it replaces, then SIGKILL after grace_period_seconds.
- Expect live records only where ESIGNCOMPLY_LIVE is "true": the production app.
- Never push an image that doctl apps dev build made in a folder that holds .env: the build copies the whole folder.
- 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 creates the session with esc.sessions.create and an Idempotency-Key, saves the signer ID and the pinned version IDs in Postgres, and returns only clientToken, apiUrl and documents.
4. Server: GET /legal/terms and /legal/privacy render the registered version from esc.documents.versions.getContent 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 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 row in Postgres. Only then create the account, and store the record ID and the receipt in the same row.

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:8080/signup --callback http://localhost:8080/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 on DigitalOcean App Platform?

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

  • 01

    doctl apps dev build copies .env into the image

    In the test, doctl 2.10.0 built the service in the project folder and the image held .env, with the key, in /workspace, although .gitignore lists the file. The build copies the folder it runs in. DigitalOcean's page describes pushing local builds to a container registry, so build in a fresh clone, where .env does not exist. An image built from a copy of the folder without the file did not hold it.

    Source: DigitalOcean docs, How to Build Components Locally, read on .
  • 02

    pg reads sslmode=require as verify, and drops your CA certificate

    DigitalOcean's documentation says its connection details set sslmode to require, which encrypts and does not verify the server, and App Platform offers the CA certificate as ${db.CA_CERT}. In the test, pg 8.23.1 refused a URL ending in sslmode=require against a TLS-only Postgres with a privately signed certificate, also with ssl: { ca } beside it. With the parameter removed and the CA certificate passed, it connected over TLS 1.3, verified.

    Source: DigitalOcean docs, Connect to PostgreSQL Clusters, read on .
  • 03

    The built image starts npm start, not your run command

    DigitalOcean's documentation says a Node.js component runs npm start when no run command is set. In the images doctl built, the default process was npm start with Node.js as its child, for the job as well. Stopped with SIGTERM, that container exited with code 1 and npm error signal SIGTERM. With node server.js as process 1, the server closed its pool and exited with code 0. App Platform sends SIGKILL after grace_period_seconds, 120 by default.

    Source: DigitalOcean docs, App Termination Settings, read on .
Verifiable

What does Esign Comply record for a signature on DigitalOcean App Platform?

The same record on every stack and platform. Your DigitalOcean App Platform 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, 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.

Recordrec_Z4m8
simple · L1
RecordedWritten durably, receipt signed with ES256
TimestampedExternal RFC 3161 token over the record hash
AnchoredPublic anchor pending
Checkbox changed by a trusted user eventobserved
Terms of Service, version dv_3kT9observed
Server time 2026-11-21T15:03:20.291Zobserved
Signer email dana@example.orgasserted
record_hash sha256:5be7…example record

Questions about e-signatures on DigitalOcean App Platform

How does test mode work on DigitalOcean App Platform preview apps?

A preview app gets a host of its own under ondigitalocean.app, which a test key refuses until you list that exact host under Domains as a test origin. DigitalOcean documents previews as a GitHub Actions workflow that deploys one app per pull request: give it the test key and the test IDs. On localhost a test key works with no setup.

Where should the receipt be stored on DigitalOcean App Platform?

In the managed PostgreSQL database, beside the signer ID and the record ID. The confirm route writes both once the record is confirmed. DigitalOcean's documentation says each container has a separate filesystem that is reset on every redeployment, so a file is no place for it.

Why does the quickstart take sslmode off the database URL?

Because pg 8 lets sslmode in the URL replace the ssl option, CA certificate included. In the test a URL ending in sslmode=require was refused by a TLS-only Postgres with a privately signed certificate. With the parameter removed and ${db.CA_CERT} passed as the CA certificate, the connection was encrypted and verified.

Does doctl apps dev build need a DigitalOcean account?

Not in the test. The command stops when it has no access token, and a placeholder was enough: with the API address set to a closed local port, doctl 2.10.0 built the service and the job from .do/app.yaml. DigitalOcean's page lists an authenticated doctl as a prerequisite, and creating an app needs an account.

What did doctl build, and what does only App Platform prove?

doctl built the service and the job with DigitalOcean's builder images, and both ran in Docker with the run commands of the spec, against Postgres with and without TLS. Nothing was deployed: the encrypted variable, the bindable database variables, the job before a deployment, health checks, the GitHub Action, previews and custom domains are proven only by a deployment.

Run the signing flow in your App Platform service. Leave the record to us.

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

DigitalOcean App Platform is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about DigitalOcean App Platform is from DigitalOcean App Platform's documentation or from a test run, as marked, on . /digitalocean-app-platform.md is this page as Markdown.

Working with an AI tool? This page is also available as Markdown: /digitalocean-app-platform.md