Carta Sign documentation

Maintaining this documentation

This page is for people working on Carta Sign itself.

How the site works

infra/docs-site/server.mjs is a small node:http server (markdown-it, github-slugger, highlight.js) that turns documentation/ into a site with sidebar navigation, search, a per-page outline and dark mode. Nothing is pre-built: HTML is produced per request and cached.

  • Rendering: markdown-it with raw HTML disabled. Headings get GitHub-compatible ids, so file.md#heading links work on GitHub and on the site. Blockquotes that start with **Note**, **Tip**, **Important**, **Warning** or **Caution** become styled callouts. External links open in a new tab; images lazy-load.
  • Navigation: built from documentation/README.md. Each ## is a sidebar group, each ### a subgroup, and the first .md link in each list item is an entry. That order also drives the Previous/Next links. Pages not linked from the README appear under Other pages.
  • Search: a JSON index of every page, filtered in the browser by public/app.js.
  • Live editing: pages are cached by file modification time and the site index is rebuilt at most every 2 seconds, so a bind-mounted documentation/ updates live.
  • Raw source: every page links to its Markdown (?raw).
  • Packaging: infra/Dockerfile.docs copies the server and documentation/ into node:22-alpine (DOCS_DIR=/docs, port 3000, /healthz health check). In docker-compose.yml it's the docs service. Set DOCUMENTATION_URL to its public URL to show Docs in the public nav, Documentation in the footer and Help & documentation in the app sidebar. The public pages are prerendered, so it's passed to the web build as well as its runtime environment; rebuild web after changing it.

Adding or changing a page

  1. Write the Markdown in the right folder. Start it with a single # title.
  2. Link it from documentation/README.md so it appears in the sidebar.
  3. Reference screenshots as ../assets/screenshots/<area>/<name>.png, and add the capture to scripts/doc-shots.mjs (see below).
  4. Check links (see below).

Screenshots

scripts/doc-shots.mjs drives a running dev stack with playwright-core and headless Chromium. It walks the UI the way a user would and saves PNGs at the paths the Markdown references, under documentation/assets/screenshots/.

  • Target data: the demo workspace Northwind Studio (northwind_studio) from scripts/seed-demo.mjs, signed in as [email protected], and the platform admin [email protected] for the admin console.
  • Emails: invited-signer shots need a real signing code, which the script reads from the dev stack's Mailpit (MAILPIT, default http://localhost:3108).
  • Deterministic browser: 1440×900 (invited-signer shots use a 390×844 phone), light colour scheme, America/Toronto timezone, en-CA locale. It uses the cached Playwright Chromium build 1248 in new headless mode, which renders PDFs; the headless shell is the fallback.
  • Groups run in a fixed order: public, shell, basic, invitee, administration, admin. public, invitee and admin use their own pages; the rest share one signed-in page.
  • Locating UI: by role, label and placeholder, not CSS classes, so shots survive styling changes.
  • Data it creates: a "Docs consulting agreement" (signed and sent to two people), a "Docs photography release" sent to one person, and an invite code.
  • Failure handling: each step is wrapped so one failure doesn't stop the run; problems are printed as an ISSUES list at the end, and the exit code is non-zero.

Running it

  1. Install the script dependencies once: cd scripts && npm install.

  2. Start the dev stack, listing the demo admin so it's promoted at start-up:

    [email protected] docker compose -f docker-compose.yml -f docker-compose.dev_mode.yml up -d --build
    

    Web is on ESIGN_WEB_PORT (3100), the docs on ESIGN_DOCS_PORT (3101) and Mailpit on ESIGN_MAIL_PORT (3108).

  3. Seed the demo data, then restart web so the admin account is promoted:

    node scripts/seed-demo.mjs
    docker compose -f docker-compose.yml -f docker-compose.dev_mode.yml restart web
    
  4. Regenerate screenshots: node scripts/doc-shots.mjs, or only some groups with --only=basic,invitee. Override BASE, MAILPIT, EMAIL, PASSWORD, TENANT, ADMIN_EMAIL or ADMIN_PASSWORD as needed.

  5. Read the ISSUES list at the end, then review the PNG diffs in git before committing.

  6. Check links against the running docs: node infra/docs-site/check-links.mjs http://localhost:3101/ (or npm run check in infra/docs-site).

  7. Commit the Markdown and screenshots together.

End-to-end checks

scripts/e2e.mjs runs the signing flows against the same stack, including the cases that must fail: wrong codes, cancelled and resent links, declines, read-only workspaces and other workspaces' members. It creates its own "E2E …" users and workspaces, and needs the platform admin from the seed. Run node scripts/e2e.mjs; it exits non-zero if anything fails.