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#headinglinks 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.mdlink 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.docscopies the server anddocumentation/intonode:22-alpine(DOCS_DIR=/docs, port 3000,/healthzhealth check). Indocker-compose.ymlit's thedocsservice. SetDOCUMENTATION_URLto 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 thewebbuild as well as its runtime environment; rebuildwebafter changing it.
Adding or changing a page
- Write the Markdown in the right folder. Start it with a single
#title. - Link it from
documentation/README.mdso it appears in the sidebar. - Reference screenshots as
../assets/screenshots/<area>/<name>.png, and add the capture toscripts/doc-shots.mjs(see below). - 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) fromscripts/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, defaulthttp://localhost:3108). - Deterministic browser: 1440×900 (invited-signer shots use a 390×844 phone), light colour scheme,
America/Torontotimezone,en-CAlocale. 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,inviteeandadminuse 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
-
Install the script dependencies once:
cd scripts && npm install. -
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 --buildWeb is on
ESIGN_WEB_PORT(3100), the docs onESIGN_DOCS_PORT(3101) and Mailpit onESIGN_MAIL_PORT(3108). -
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 -
Regenerate screenshots:
node scripts/doc-shots.mjs, or only some groups with--only=basic,invitee. OverrideBASE,MAILPIT,EMAIL,PASSWORD,TENANT,ADMIN_EMAILorADMIN_PASSWORDas needed. -
Read the ISSUES list at the end, then review the PNG diffs in git before committing.
-
Check links against the running docs:
node infra/docs-site/check-links.mjs http://localhost:3101/(ornpm run checkininfra/docs-site). -
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.