Open-source document signature platform. Not affiliated with DocuSign.
TypeScript
Rewrite the README to show what SignuDoc does and how it compares with DocuSign
Claude9956cbfb70da
diff --git a/.env.example b/.env.exampleindex a878170..368c8a3 100644--- a/.env.example+++ b/.env.example@@ -56,7 +56,7 @@ EMAIL_DRIVER=capture# Vercel only. BOTID=1 turns on Vercel BotID for sign-in, sign-up, password# reset, the contact form and first-run setup. It is read when the app is-# built, so redeploy after changing it. See "Bot protection" in the README+# built, so redeploy after changing it. See "Bot protection" in docs/self-hosting.md# before turning it on.# BOTID=@@ -74,7 +74,7 @@ EMAIL_DRIVER=capture# Resend region for the sending domain the app adds for you: us-east-1# (default), eu-west-1, sa-east-1 or ap-northeast-1. Use eu-west-1 to send-# from the EU. See "Running in the EU" in the README.+# from the EU. See "Running in the EU" in docs/self-hosting.md.# RESEND_REGION=# The seal on finished PDFs. Unset, the install makes its own key anddiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 41c9fa5..32da678 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -9,7 +9,7 @@ Issues and pull requests are welcome.3. Copy the environment file: `cp .env.example .env`4. Start the dev server: `npm run dev`-See the [README](./README.md) for full setup details.+See [Development](./docs/development.md) for full setup details.## Development workflow@@ -21,7 +21,7 @@ npm run lintnpm run format:check```-If your change touches auth, email, storage, or production-only configuration, verify the related env-backed flow against the setup notes in [README.md](./README.md).+If your change touches auth, email, storage, or production-only configuration, verify the related env-backed flow against the [self-hosting guide](./docs/self-hosting.md).If your change touches Better Auth tables or plugins, run `npm run auth:generate` and update the committed migration as needed.diff --git a/README.md b/README.mdindex 404aa04..f046281 100644--- a/README.md+++ b/README.md@@ -1,370 +1,226 @@-# SignuDoc+<p align="center">+ <img src="docs/images/banner.png" alt="SignuDoc: e-signatures that are yours, on your own Vercel account. Open source, deployed in one click, with no per-seat or per-envelope fees, and sealed PDFs anyone can check.">+</p>-SignuDoc is an e-signature app you can run for your own organization.+<p align="center">+ An e-signature app for your own organization, on your own Vercel account.<br>+ Upload a PDF, place fields, send signing links, and keep the sealed, signed copy with its audit certificate.+</p>-Upload a PDF, add signers in order, place fields, send secure signing links, and keep the final signed PDF plus an audit certificate in one place.+<p align="center">+ <a href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FNYLLON-SOFTWARE%2FSignuDoc&project-name=signudoc&repository-name=signudoc&stores=%5B%7B%22type%22%3A%22integration%22%2C%22integrationSlug%22%3A%22neon%22%2C%22productSlug%22%3A%22neon%22%2C%22protocol%22%3A%22storage%22%7D%2C%7B%22type%22%3A%22blob%22%2C%22access%22%3A%22private%22%7D%2C%7B%22type%22%3A%22integration%22%2C%22integrationSlug%22%3A%22resend%22%2C%22productSlug%22%3A%22resend-email%22%2C%22protocol%22%3A%22messaging%22%7D%5D&demo-title=SignuDoc&demo-description=Your%20own%20e-signature%20site.%20Upload%20a%20PDF%2C%20place%20fields%2C%20send%20signing%20links%2C%20and%20keep%20the%20signed%20copy%20with%20its%20audit%20certificate.&demo-url=https%3A%2F%2Fgithub.com%2FNYLLON-SOFTWARE%2FSignuDoc&demo-image=https%3A%2F%2Fraw.githubusercontent.com%2FNYLLON-SOFTWARE%2FSignuDoc%2Fmain%2Fdocs%2Fimages%2Fbanner.png"><img src="https://vercel.com/button" alt="Deploy with Vercel"></a>+</p>-[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FNYLLON-SOFTWARE%2Fsignudoc&project-name=signudoc&repository-name=signudoc&stores=%5B%7B%22type%22%3A%22integration%22%2C%22integrationSlug%22%3A%22neon%22%2C%22productSlug%22%3A%22neon%22%2C%22protocol%22%3A%22storage%22%7D%2C%7B%22type%22%3A%22blob%22%2C%22access%22%3A%22private%22%7D%2C%7B%22type%22%3A%22integration%22%2C%22integrationSlug%22%3A%22resend%22%2C%22productSlug%22%3A%22resend-email%22%2C%22protocol%22%3A%22messaging%22%7D%5D&demo-title=SignuDoc&demo-description=Your%20own%20e-signature%20site.%20Upload%20a%20PDF%2C%20place%20fields%2C%20send%20signing%20links%2C%20and%20keep%20the%20signed%20copy%20with%20its%20audit%20certificate.&demo-url=https%3A%2F%2Fgithub.com%2FNYLLON-SOFTWARE%2Fsignudoc&demo-image=https%3A%2F%2Fraw.githubusercontent.com%2FNYLLON-SOFTWARE%2Fsignudoc%2Fmain%2Fdocs%2Fimages%2Fprepare.png)+<p align="center">+ <a href="#everything-it-takes-to-get-a-document-signed">Features</a> ·+ <a href="#signudoc-and-docusign-side-by-side">SignuDoc vs DocuSign</a> ·+ <a href="#what-it-costs">What it costs</a> ·+ <a href="#get-started">Get started</a> ·+ <a href="docs/self-hosting.md">Self-hosting guide</a>+</p>-The button puts your own copy on [Vercel](https://vercel.com) with a Postgres database, private file storage and email already connected. There is no terminal to open and nothing to type in.+## Why SignuDoc-+**Pay for hosting, not for every person who sends.** SignuDoc is free and open source and runs on your own Vercel account. A team of 50 pays about $480 a year for Vercel Pro and Resend. On DocuSign Standard the same team pays $15,000, and on Business Pro $24,000.-## Deploy your own+**No envelope allowance to watch.** DocuSign's Standard and Business Pro plans include 100 envelopes per user per year. SignuDoc has no limit of its own: you send as many documents as your email plan carries.-1. **Click "Deploy with Vercel"** above.-2. **Sign in to Vercel** and let it copy this repository into your GitHub account. Your site is built from that copy.-3. **Add the three things Vercel offers to create.** Each has a free plan:- - a Postgres database from [Neon](https://neon.com) (pick the region closest to you),- - a private file store, [Vercel Blob](https://vercel.com/docs/vercel-blob), for the documents,- - [Resend](https://resend.com) for sending email.-4. **Click Deploy.** The build creates the database tables by itself.-5. **Open your new site.** It takes you to a setup page, where you name your organization, give the email address people should write to for help, and create the first account. That account is the administrator.-6. **Set up the address you send from.** Under Settings, Organization, enter an address at your own domain in "Send email from" and save (the setup page offers the same field). The site lists the DNS records for that domain and checks them for you. Add them where your domain is managed. If your Resend key is not allowed to manage domains, the page sends you to Resend's dashboard for this step instead.+**Your documents stay in your accounts.** PDFs live in a private Vercel Blob store and everything else in a Neon Postgres database, both in your name and in the region you choose. Nobody else hosts your agreements, and the code is yours to read, change and run.-+**Evidence anyone can check.** Every finished PDF and its audit certificate carry a PAdES seal that PDF readers check for changes, the audit trail is hash-chained so an edited or deleted row shows, and anyone holding a copy can check it on the install's public Verify page.-Step 6 is the one part that cannot be done for you: every email provider asks for proof that you own the domain you send from. While "Send email from" is empty, email goes out from Resend's test address, which Resend delivers only to the email address of the Resend account itself, normally the one on your Vercel account. So to try the whole product straight away, leave that field empty and send a document to that address. Once you save an address of your own, email is sent from it, and Resend does not deliver it until the domain shows as verified. Add the records before you count on it.+**One click, nothing to look after.** The Deploy button creates the database, the file store and email for you, on free plans. There are no servers to patch, and every push to your copy deploys again.-If the site opens on a page that says to connect a database, the database was not connected when the site was built. Connect it under Storage in the Vercel project, deploy again and reload.+## Everything it takes to get a document signed-### What it costs+### Prepare a document in minutes-- **Vercel.** The free Hobby plan is enough to run SignuDoc, but Vercel [limits Hobby to personal, non-commercial use](https://vercel.com/docs/limits/fair-use-guidelines). An organization using this for its work belongs on Vercel Pro. Everything here works the same on both.-- **Neon, Vercel Blob and Resend** each have a free plan with limits: see [Neon](https://neon.com/faqs/free-plan-limits-and-quotas), [Vercel Blob](https://vercel.com/docs/vercel-blob/usage-and-pricing) and [Resend](https://resend.com/pricing). The one you are most likely to meet first is Resend's, which at the time of writing allows 100 emails a day and 3,000 a month on its free plan. Every signing invitation, reminder and completed copy is an email.+Upload a PDF, add up to 10 signers in the order they sign, and add people who only receive the finished copy. Then place fields where they belong: signature, initials, date, text, number, checkbox, dropdown and radio buttons, each required or optional and each tied to one signer.-### Use your own web address+-Add your domain to the project in Vercel (Settings, Domains), then deploy once more. The site works out its own address from the project's production domain, so the links in its emails follow the new domain after that deployment. Nothing needs to be set by hand.+<p align="center">+ <sub>The organization, people and documents in these screenshots are made up.</sub>+</p>-### Lock down a new install+### Signing without an account-A new install is claimed by whoever opens it first. That is normally you, seconds after the deployment finishes. If its address will be known to others before you get there, add a `SETUP_TOKEN` environment variable in Vercel with a secret of your own and deploy again: the setup page then asks for it.+Each signer gets a link by email, agrees to use electronic records, and signs with a typed or drawn signature on any phone, tablet or computer. Fields from earlier signers stay visible and locked. Signers can download the document before they sign, or decline with a reason, and the sender is told.-### Keep your install up to date+-The Deploy button makes a copy of this repository, and a copy does not receive new versions by itself. To take a new version, bring the changes into your copy and push. Vercel builds the push, and the build applies any new database migrations.+### Know who is signing-```bash-git clone https://github.com/<your-account>/signudoc.git-cd signudoc-git remote add upstream https://github.com/NYLLON-SOFTWARE/signudoc.git-git fetch upstream-git merge upstream/main-git push-```--If git answers `refusing to merge unrelated histories`, your copy was made without this project's history. As long as you have not changed the code yourself, take the new version as it is:--```bash-git reset --hard upstream/main-git push --force-with-lease-```--After that first time, `git merge upstream/main` works as above.--### Optional settings--A deployment made with the button needs no environment variables. These are there if you want them, under Settings, Environment Variables in the Vercel project. Deploy again after changing one.--| Variable | What it does |-| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `SETUP_TOKEN` | A secret the setup page asks for. See [Lock down a new install](#lock-down-a-new-install). |-| `CRON_SECRET` | Closes the daily cleanup route to everyone but Vercel's own cron call. See [Daily cleanup](#daily-cleanup). |-| `BOTID` | `1` turns on Vercel BotID for sign-in, sign-up and setup. See [Bot protection](#bot-protection). |-| `RESEND_FROM_EMAIL`, `SUPPORT_EMAIL` | Fix the sender and support addresses from the environment instead of in Settings. |-| `BETTER_AUTH_SECRET` | Your own secret for signing sessions. Without it one is derived from the database password, so changing that password signs everyone out. |-| `APP_URL` | The site's public address, if it should not be the project's production domain. |-| `HOSTED_MODE` | `1` runs SignuDoc as a public service under its own name. See [Hosted mode](#hosted-mode). |-| `RESEND_REGION` | Where Resend sends from when the app adds your domain, for example `eu-west-1`. See [Running in the EU](#running-in-the-eu). |-| `SEAL_P12_BASE64`, `SEAL_P12_PASSWORD` | Seal finished PDFs with a certificate from a certificate authority instead of the install's own. See [Signed PDFs and the seal](#signed-pdfs-and-the-seal). |-| `SEAL_TIMESTAMP_URL` | An RFC 3161 timestamp server that adds a trusted time to each seal. |--## Important notes--SignuDoc is not a law firm and does not give legal advice. Whoever runs an install decides what it may be used for. Every install has a page at `/electronic-signatures` that says what follows, and senders confirm it before each send.--### What SignuDoc is for--- Ordinary business agreements: sales and service contracts, NDAs, statements of work, offer letters, purchase orders, approvals.-- In the US, signatures made with it are electronic signatures under the federal ESIGN Act and the state UETA laws (New York: ESRA). Each signer first agrees to use electronic records, and that agreement is recorded.-- In the EU and UK, they are **simple electronic signatures (SES)** under eIDAS. A court cannot reject them only for being electronic, but you may have to show who signed. The sealed PDF, the audit certificate and the optional access code or emailed code help.--### What SignuDoc is not--- **Not an advanced or qualified electronic signature (AdES or QES)** under eIDAS. Where a law asks for a QES, use a qualified trust service.-- **Not built for FDA 21 CFR Part 11** records.-- **Not HIPAA-ready.** Do not send protected health information without your own agreements with every service the install runs on.-- **Not for documents the law keeps out of electronic signature**, such as wills, family-law matters, court orders, and notices of foreclosure, eviction, utility shut-off or insurance cancellation (ESIGN section 103, UETA section 3), and in most EU countries real estate transfers and documents that need a notary.--### Your responsibilities when you self-host--Your install carries your organization's name, not SignuDoc's. In Settings, link your own terms and privacy policy (without a privacy link, signers see a notice built from your settings at `/signer-privacy`; check it), keep the support address you gave at setup pointed at a mailbox someone reads, and choose how long finished documents are kept. Under GDPR your organization is the controller; Settings, Organization has the tools to answer a signer who asks for their data or for its erasure.--## Signed PDFs and the seal--Every finished PDF and audit certificate is sealed with a PAdES signature, so any change after signing shows in Adobe Acrobat and other PDF readers, and its SHA-256 is recorded. Anyone can check a copy at `/verify`. The audit trail in the database is a hash chain, so an edited or deleted row shows too.--By default each install makes its own seal key and self-signed certificate the first time it seals, and keeps the key encrypted in the database with a key derived from `BETTER_AUTH_SECRET` (or the database password, when that is unset). Keep that secret stable: a new one makes a new seal key, and old PDFs still verify but under the old certificate. Readers show a self-signed seal as "validity unknown" until the certificate is trusted. For a seal readers trust on sight, buy a document-signing certificate and set `SEAL_P12_BASE64` and `SEAL_P12_PASSWORD`. `SEAL_TIMESTAMP_URL` adds a trusted time from a timestamp server.--## Running in the EU--By default the parts of an install run in the US. To keep signers' data in the EU:--1. **Functions.** Add `"regions": ["fra1"]` to `vercel.json` (or pick Frankfurt under Settings, Functions in the Vercel project).-2. **Database.** Create the Neon database in an EU region (Frankfurt) when you connect it.-3. **Files.** Create the Vercel Blob store in an EU region (Frankfurt).-4. **Email.** Set `RESEND_REGION=eu-west-1` before you add your domain in Settings, or create the domain in Resend's dashboard with the Ireland region. Resend still keeps account data and email logs in the US.-5. **Agreements.** Accept the data processing agreements of Vercel, Neon and Resend, which include the EU standard contractual clauses, and list them in your privacy policy.--Some data still leaves the EU: Vercel's and Resend's account metadata and logs, for example. The processors' agreements and the EU-US Data Privacy Framework cover that, but check it against your own obligations.--## What it does--- Upload PDF documents-- Add up to 10 signers in routing order, and people who only receive a copy of the finished document-- Place signature, initials, date, text, number, checkbox, dropdown, and radio button fields-- Save a document as a template, and send it again by naming who signs this time-- Send secure signing links by email-- Let recipients sign without creating an account-- Give each envelope its own signing deadline, and change it while the envelope is out-- Track draft, sent, completed, declined, voided, and expired envelopes-- Generate a final signed PDF and audit certificate, with names and text in Latin, Greek, Cyrillic, Chinese, Japanese, and Korean scripts-- Send a reminder to the current signer yourself, or have one sent every few days-- Put your organization's logo and color on the site, the signing pages, and the emails-- Have more than one administrator-- Run on any Postgres database, locally or hosted--## Built with--- Next.js App Router-- React + TypeScript-- Better Auth-- Postgres (`pg`)-- Vercel Blob object storage (local disk in development)-- Resend for transactional email-- `pdf-lib` and `pdfjs-dist`-- Tailwind CSS 4 + shadcn/ui--## Run it locally--For development, or to try it on your own machine first.--### 1. Install dependencies--```bash-npm install-```+For documents that need more than an email link, ask a signer for an access code you give them yourself, or have SignuDoc email a one-time code when they open the link. The audit certificate records how each signer was checked, with their IP address and browser.-SignuDoc targets Node.js 24 and is built on Next.js 16.+### Follow every envelope-### 2. Create your environment file+The dashboard shows each document as a card with its first page, its status (draft, sent, completed, declined, voided or expired) and who it waits on, with search and a status filter. Each envelope has its own signing deadline, from 3 to 90 days, which you can change while it is out, and automatic reminders every 1, 2, 3 or 7 days, on top of the reminder you can send by hand.-```bash-cp .env.example .env-```--The example file is ready for local development as it is. Uploaded PDFs are kept on disk under `.data/storage` and outgoing email is written to `.data/outbox` as JSON files instead of being sent, so you need no storage or email account to try the whole product.--Every setting, and which ones are optional, is described in `.env.example`.--### 3. Start the database and apply the schema--With Docker installed, this starts Postgres and applies the migrations:--```bash-npm run db:start-```+-If you already have a Postgres server, point `DATABASE_URL` at it and run the migrations on their own:+-```bash-npm run db:migrate-```+### Templates for the documents you send every week-### 4. Start the dev server+Open any envelope and choose Save as template. The template keeps the document, the fields and the signing order, with roles instead of names. Using it asks who signs this time and opens a draft ready to send.-```bash-npm run dev-```+### Sealed, certified, and checkable by anyone-Open [http://localhost:3000](http://localhost:3000).+When the last signer finishes, SignuDoc builds the signed PDF and an audit certificate, seals both, and emails them to every signer and copy recipient. Names and text in Latin, Greek, Cyrillic, Chinese, Japanese and Korean scripts are drawn correctly. Anyone can drop a copy on the Verify page to see whether it is exactly the file the site produced; the file never leaves their device, only its fingerprint does.-### 5. Set the site up+-The first time you open a new install it takes you to `/setup`. There you name your organization, give its support address, and create the first account, which becomes the administrator. After that the setup page is gone for good.+### Your name, logo and color-- **Support address.** Setup does not finish without one. It is the address signers and people with an account are told to write to, and where replies to the site's emails go. It is saved in your install's own settings and nowhere else; there is no SignuDoc address that it falls back to. The administrator can change it under Settings, Organization, but not remove it.+Signers see your organization, not SignuDoc. Give the install your name, logo and brand color, and they appear on the site, the signing pages and every email. Serve it at your own domain and link your own terms and privacy policy.-- **Who can sign up.** The install starts by letting people with an email address at the administrator's own domain create accounts (or nobody else, if the administrator used a public mailbox such as Gmail). The administrator can change this under Settings, Organization: people at listed domains, nobody, or anyone. People who are only sent a document to sign never need an account.-- **More administrators.** Settings, Organization lists everyone with an account under People, where an administrator can make someone else an administrator or take that away. There is always at least one. When an account is closed, its finished documents and their audit trails move to the longest-standing administrator, because they are the organization's records. If that person later stops being an administrator, those documents move on to one who stays, and the documents they sent themselves stay with them.-- **Email.** Settings, Organization also shows whether email is working. While no sender address is set, mail goes out from Resend's test address, which only reaches the owner of the Resend account. Enter a sender address at your domain and the page shows the DNS records to add and checks them for you. Mail from that address is not delivered until its domain is verified.-- **`SETUP_TOKEN`.** A new install can be claimed by whoever opens it first. If its URL will be public before you get to it, set `SETUP_TOKEN` to a secret of your own and the setup page will ask for it.-- **An install from before this page existed** has accounts but no administrator. Set `SETUP_TOKEN`, sign in with the account that should be in charge, and open `/setup`. It asks for a support address if the install has none. Sign-up stays open, as it was, until that administrator changes it.+-### Hosted mode+### Run by your administrators-`HOSTED_MODE=1` runs SignuDoc as a public service under its own name: the landing page at `/`, the built-in terms, privacy, contact and accessibility pages, and sign-up open to anyone. Leave it unset for an install that belongs to one organization.+The first account is the administrator, and you can make more. Choose who may create an account: people at your email domains, nobody, or anyone. People who only sign never need one. Set how long finished documents are kept, and answer a signer who asks for their data with a built-in export or erasure tool.-## Development notes+### On your phone-### Storage+SignuDoc works on small screens as well as large ones: check on your documents from your phone, and signers sign from theirs.-Documents, signed PDFs, audit certificates, drawn signature images, and the small first-page pictures shown on the dashboard are stored in one of two places:+<p align="center">+ <img src="docs/images/phone.png" width="300" alt="The dashboard on a phone">+</p>-- **Vercel Blob**, in a private store. This is used whenever a Blob store is connected to the project (Vercel sets `BLOB_READ_WRITE_TOKEN`, or `BLOB_STORE_ID` for a store that signs in with the project's OIDC token), and always on Vercel. Nothing in the store has a public URL; every download goes through the app, which checks who is asking first.-- **Local disk**, under `.data/storage` (change it with `STORAGE_LOCAL_DIR`). This is the default everywhere else, including local development.+## SignuDoc and DocuSign, side by side-`STORAGE_DRIVER=blob` or `STORAGE_DRIVER=local` overrides the choice.+DocuSign does more, and charges for it per user. SignuDoc does the everyday signing loop well, and it's yours. DocuSign's plans are as [DocuSign listed them](https://ecom.docusign.com/plans-and-pricing/esignature) in October 2026, for the US.-On Vercel Blob, the upload page sends the PDF straight from the browser to the store with a short-lived signed URL, because a request to a Vercel Function cannot be larger than 4.5 MB. The upload lands in a pending folder, the app reads it back and validates it like any other upload, stores its own copy, and deletes the pending one. A pending upload that is never picked up is deleted by Blob after a day.--To run the end-to-end test against a real Blob store instead of local disk:--```bash-E2E_STORAGE_DRIVER=blob BLOB_READ_WRITE_TOKEN=... npm run test:e2e-```+<p align="center">+ <img src="docs/images/versus.png" alt="Where SignuDoc takes the lead: price, envelope limits, where documents live, source code, features included in every install, checking a signed copy, a hash-chained audit trail and your own web address">+</p>-### Database+### Price and ownership-SignuDoc uses Postgres as its only database and talks to it with `pg`. Any Postgres 15 or newer works, including Neon and Supabase.+| | SignuDoc | DocuSign eSignature |+| -------------------------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |+| **Price** | Free and open source. You pay Vercel, and Resend once you send more than 100 emails a day | $10 (Personal), $25 (Standard) or $40 (Business Pro) per user a month, billed annually |+| **Envelopes** | No limit of its own | 5 a month on Personal, 100 per user a year on Standard and Business Pro |+| **Where it runs** | Your Vercel account, with your Neon database and Blob store | DocuSign's cloud |+| **Where data is kept** | The region you choose, the EU included | DocuSign's data centers, the EU included |+| **Source code** | MIT license, on GitHub | Closed |+| **Your own domain and branding** | ✅ your domain, logo and color, on every plan | Logo and colors from Standard |-The schema lives in `db/migrations` as plain SQL files. `npm run db:migrate` applies the ones that have not run yet and records them in the `signudoc_migrations` table, so it is safe to run on every deploy.+### The signing loop-### Email delivery+| | SignuDoc | DocuSign eSignature |+| -------------------------------------------- | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |+| **Signing without an account** | ✅ | ✅ |+| **Signing order** | ✅ in order, up to 10 signers | ✅ in order, at the same time, or mixed |+| **People who only get a copy** | ✅ | ✅ and more roles: approvers, editors, in-person signers |+| **Field types** | ✅ signature, initials, date, text, number, checkbox, dropdown, radio, each required or optional | ✅ 20+, with formulas and attachments on Business Pro |+| **Templates** | ✅ | ✅ from Personal, shared from Standard |+| **Deadlines and automatic reminders** | ✅ | ✅ |+| **Access code and emailed one-time code** | ✅ | ✅ plus SMS, phone, knowledge-based questions and ID checks, as paid add-ons |+| **Consent to electronic records** | ✅ versioned, recorded in the audit trail | ✅ |+| **Sealed PDF and certificate of completion** | ✅ PAdES seal, self-signed by default or your own trusted certificate | ✅ seal trusted by PDF readers |+| **Audit trail** | ✅ hash-chained | ✅ |+| **Public check of a signed copy** | ✅ the Verify page | — |+| **Retention rules and signer data requests** | ✅ built in | ✅ |+| **Phones** | ✅ in the browser | ✅ native iPhone and Android apps |-SignuDoc sends transactional email through Resend.+### Where DocuSign does more-- The support address, where replies go, is asked for when the site is set up. It and the address email is sent from can be changed by the administrator under Settings, Organization. The sender address must be at a domain verified with Resend; the same page adds the domain to Resend, lists the DNS records and checks them. With a Resend API key that is only allowed to send, it points you at Resend's dashboard for that step instead.-- `RESEND_FROM_EMAIL` and `SUPPORT_EMAIL` are optional. When set they take the place of the addresses saved in Settings, which then cannot be changed there, and with `SUPPORT_EMAIL` set the setup page does not ask for a support address.-- Until a sender address is set, mail goes out from `[email protected]`, which Resend only delivers to the owner of the Resend account.-- In hosted mode the support address is also the contact shown on the Terms, Privacy, and Accessibility pages.-- For local development, `EMAIL_DRIVER=capture` writes each email to `.data/outbox` as a JSON file instead of sending it. Open the newest file to find a verification or signing link. This driver refuses to run in production.+| | SignuDoc | DocuSign eSignature |+| ------------------------------------------------------- | ------------------------------ | ----------------------------------------------------- |+| **More than one document per envelope, and Word files** | — PDF only, one per envelope | ✅ |+| **Signing at the same time** | — in order only | ✅ |+| **Bulk send, web forms, payments** | — | ✅ on Business Pro |+| **API and webhooks** | — not yet | ✅ API plans from $50 a month |+| **Integrations** | — | ✅ 1,000+, including Salesforce, Microsoft and Google |+| **Languages** | — signing pages in English | ✅ signing in 44 languages |+| **Single sign-on** | — email and password | ✅ SAML SSO on Enhanced |+| **Advanced and qualified signatures (eIDAS)** | — simple electronic signatures | ✅ |+| **HIPAA, 21 CFR Part 11, certifications** | — | ✅ on Enhanced or as add-ons |+| **Support** | GitHub issues | ✅ 24/7 on Enhanced |-### Upload constraints+If your agreements run through Salesforce, need SMS checks or qualified signatures, or go out by the thousand in bulk, DocuSign earns its price. If you want to send everyday agreements, keep the evidence, and own the whole thing, SignuDoc is built for you.-Document import currently enforces these limits:+## What it costs-- PDF files only-- 20 MB maximum upload size-- password-protected or encrypted PDFs are rejected-- pure XFA or unsupported PDF variants are rejected+SignuDoc is free. Vercel and its Marketplace partners run it, at their own prices:-## Common scripts+| | What you pay |+| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| **Vercel** | $0 on Hobby, which Vercel [limits to personal, non-commercial use](https://vercel.com/docs/limits/fair-use-guidelines). An organization belongs on [Pro](https://vercel.com/docs/plans/pro-plan), $20 a month for the one person who deploys it. The people who send and sign need no Vercel seat. |+| **Database** | $0 on [Neon's free plan](https://neon.com/faqs/free-plan-limits-and-quotas): 1 GB and 100 compute hours a month. Past that, Neon's Launch plan charges for use, with no monthly minimum. |+| **Files** | 1 GB of [Vercel Blob](https://vercel.com/docs/vercel-blob/usage-and-pricing) free on Hobby. On Pro, Blob is paid from the plan's $20 monthly credit, at $0.023 per GB a month. |+| **Email** | $0 on [Resend's free plan](https://resend.com/pricing), up to 100 emails a day and 3,000 a month. Resend Pro is $20 a month for 50,000. Every invitation, code, reminder and finished copy is an email. |+| **Your own domain, if you want one** | Whatever your registrar charges. Vercel Pro includes one free for the first year. |-```bash-npm run dev-npm run build-npm run start-npm run db:start-npm run db:stop-npm run db:reset-npm run db:migrate-npm run auth:generate-npm run lint-npm run typecheck-npm run format-npm run format:check-npm test-npm run test:db-npm run test:e2e-```+<p align="center">+ <img src="docs/images/cost.png" alt="A year of e-signatures. 5 people: DocuSign Business Pro $2,400, Standard $1,500, SignuDoc $240. 10 people: $4,800, $3,000, $480. 25 people: $12,000, $7,500, $480. 50 people: $24,000, $15,000, $480.">+</p>-`npm test` runs the unit tests, which need nothing else running. `npm run test:db` runs the few tests that need a real Postgres (the rate limit counter, the cleanup job's lock and first-run setup) against the `signudoc_e2e` database.+| A year, billed annually | DocuSign Standard | DocuSign Business Pro | SignuDoc |+| ----------------------- | ----------------- | --------------------- | ------------------------------------------------------------ |+| **5 people** | $1,500 | $2,400 | $240 |+| **10 people** | $3,000 | $4,800 | $480 |+| **25 people** | $7,500 | $12,000 | $480 |+| **50 people** | $15,000 | $24,000 | $480, plus any database or file use past the free allowances |-`npm run test:e2e` runs the Playwright end-to-end test. It starts the app against a separate `signudoc_e2e` database on the same Postgres server, sets the site up as its first visitor, signs up a sender, sends a PDF, signs it as the recipient and downloads the results. Install the browser once with `npx playwright install chromium`.+SignuDoc's figures assume Vercel Pro, plus Resend Pro for any team of 10 or more. A small team that stays under Resend's 100 emails a day pays only for Vercel. DocuSign's figures are its list prices; Standard stops at 50 users, and larger plans are quoted. Prices change, so check them before you quote these.-## How the workflow fits together+## Get started-1. Upload a PDF and create a draft envelope.-2. Add signers in the order they should receive it.-3. Place fields on the document.-4. Review and send.-5. The first signer receives a secure link.-6. Each signer completes their turn in order.-7. SignuDoc finalizes the signed PDF and audit certificate when the last signer finishes.+### Deploy to Vercel-People added to receive a copy do not sign. They are sent the finished document and its certificate at step 7 and nothing before it.+1. **Click Deploy with Vercel** above, and sign in to Vercel. It copies SignuDoc into your GitHub account and builds your site from that copy.+2. **Add the three things Vercel offers to create**, each on a free plan: a [Neon](https://neon.com) Postgres database, a private [Vercel Blob](https://vercel.com/docs/vercel-blob) store, and [Resend](https://resend.com) for email.+3. **Click Deploy.** The build creates the database tables by itself.+4. **Open your new site.** Name your organization, give the email address people should write to for help, and create the first account, which is the administrator.+5. **Set up the address you send from.** Under Settings, Organization, enter an address at your own domain. The site lists the DNS records to add and checks them for you.-A document you send often can be kept as a template: open any envelope, sent or not, and choose Save as template. The template keeps the document, the fields and the signing order, and no one's name or email address. Using it asks who signs this time and opens a draft at step 4.+There is nothing to type in Vercel and no terminal to open. Until step 5 is done, email reaches only the address on your Resend account, so you can try the whole product straight away by sending a document to yourself. The [self-hosting guide](docs/self-hosting.md) covers your own domain, locking down a new install, keeping it up to date, running in the EU, and every optional setting.-## Self-hosting somewhere else+### Try it on your computer-SignuDoc is a regular Next.js app and runs anywhere Node.js 24 and Postgres do:+With Node.js 24 and Docker:```bash-npm run db:migrate-npm run build-npm run start-```--Away from Vercel, a few things Vercel does for you are yours to set:--- `DATABASE_URL`, pointing at your Postgres. Run `npm run db:migrate` on every deploy; it only applies what is new.-- `APP_URL`, the site's public HTTPS address.-- `BETTER_AUTH_SECRET`, at least 32 characters (`openssl rand -hex 32`). Without it a secret is derived from the database password, which must then be at least 12 characters long.-- `RESEND_API_KEY`, from your Resend account.-- Files are kept on the machine's disk under `.data/storage` (`STORAGE_LOCAL_DIR` changes where), so that disk must survive restarts. To use a Vercel Blob store from elsewhere, set `BLOB_READ_WRITE_TOKEN`.-- Leave `EMAIL_DRIVER` unset. The capture driver is for development only.--Self-hosted operators are responsible for:--- linking to their own terms and privacy policy under Settings, Organization;-- keeping the support address pointed at a mailbox someone reads, and verifying a sending domain for email;-- configuring retention, consent, and compliance requirements for their own deployment; and-- scheduling the [daily cleanup](#daily-cleanup) if they are not on Vercel, where it is scheduled for them.--## Daily cleanup--Once a day the app deletes drafts nobody has touched for 30 days, finishes account deletions that were requested, and clears expired download links and finished rate limit counters. The same run sends the automatic reminders that are due and tells a sender when an envelope has passed its signing deadline. The work is done by a request to:--```text-/api/internal/retention+npm install+cp .env.example .env+npm run db:start # Postgres in Docker, with the schema applied+npm run dev # SignuDoc at http://localhost:3000```-- **On Vercel** this is already scheduled: `vercel.json` has a cron job that calls it once a day. There is nothing to set up.-- **Anywhere else**, have your own scheduler send it a `GET` or `POST` once a day.--A new install has no secret for this route, so the route looks after itself: it runs at most once an hour, never twice at the same time, and answers with an empty response either way. Someone who finds the URL can only make the day's cleanup happen earlier.--To close the route, set a secret. A caller then has to send `Authorization: Bearer <secret>`, and gets a summary of what was cleaned up in return.+Files stay on disk and emails are written to `.data/outbox` instead of being sent, so you need no outside account. [Development](docs/development.md) says more.-- `CRON_SECRET` is the one to use on Vercel, because Vercel sends it on its own cron calls.-- `RETENTION_JOB_SECRET` does the same for a scheduler of your own. On Vercel, a deployment that sets only this one turns Vercel's cron call away, so store the secret as `CRON_SECRET` there instead.+## Built on Vercel-## Rate limits+- **Vercel-native from end to end.** Next.js 16 on Vercel Functions, Neon Postgres and Resend from the Vercel Marketplace, private Vercel Blob storage with direct browser uploads, a daily Vercel cron job for reminders and cleanup, and optional [Vercel BotID](https://vercel.com/docs/botid).+- **Secure by default.** Private file storage with no public URLs, a strict Content Security Policy, rate limits kept in Postgres, signing links that are hashed at rest, and a setup page that only the first visitor, or the holder of a `SETUP_TOKEN`, can use.+- **Tested.** Unit tests, database tests against a real Postgres, and a browser test that sets up a fresh install, sends a document and signs it, run on every pull request.-Sign-in, sign-up, password reset, the signing pages, uploads and sending are rate limited per visitor. The counts are kept in the `rate_limits` table in Postgres, so they hold across every instance of the app. On Vercel the visitor's address is read from the header Vercel sets itself, which a visitor cannot forge. If the database cannot be reached, each instance falls back to counting in its own memory.+## Using SignuDoc for real agreements-## Bot protection+SignuDoc is not a law firm and does not give legal advice, and nothing here is a promise that a signature made with it will be accepted for a given purpose. It gives you the features that electronic signature laws such as the US ESIGN Act and UETA and the EU's eIDAS regulation look for in a simple electronic signature: each signer's consent to electronic records, a record of who signed, when and how, optional identity checks, and a sealed copy that shows any change. Whether that is enough for a particular document depends on the document, where you and the signers are, and how you use it. Ask a lawyer when it matters.-The app can use [Vercel BotID](https://vercel.com/docs/botid), an invisible check that a request comes from a real browser, on the requests a script would go for: creating an account, signing in, asking for a password reset or verification email, the contact form and first-run setup.+Every install has a page at `/electronic-signatures` that says what it is for, and senders confirm it before each send. It is meant for ordinary business agreements, such as contracts, NDAs, statements of work, offer letters, purchase orders and approvals. It is **not** built for:-It is off by default. To turn it on, set `BOTID=1` on a Vercel deployment and redeploy; the setting is read when the app is built. BotID's basic check is free on every Vercel plan, and its deeper check is a paid option you switch on in the Vercel dashboard. It does nothing anywhere other than Vercel.--It is opt-in for now because it has not yet been proven against a live Vercel deployment. If you turn it on, try signing in from a private window straight away, and remove `BOTID` and redeploy if that fails. A check that cannot reach Vercel lets the request through, so an outage on that side does not lock people out; the rate limits apply either way.--## Project structure--```text-src/app Next.js routes, layouts, and API handlers-src/components UI shells and reusable components-src/lib Auth, database, services, schemas, and domain logic-db SQL migrations and the script that applies them-e2e The Playwright end-to-end test-public/pdfjs PDF.js worker and standard font assets-```+- documents that need an advanced or qualified electronic signature (AdES or QES) under eIDAS;+- FDA 21 CFR Part 11 records, or protected health information under HIPAA;+- documents that many laws keep out of electronic signature, such as wills, family-law matters, court orders, notices of foreclosure, eviction, utility shut-off or insurance cancellation, and in most EU countries real estate transfers and documents that need a notary.-## License+Your install carries your organization's name, and your organization is responsible for how it is used: linking your own terms and privacy policy, keeping the support address pointed at a mailbox someone reads, choosing how long documents are kept, and answering signers' data requests. [Your responsibilities](docs/self-hosting.md#your-responsibilities) has the details.-SignuDoc is licensed under the MIT License. See [LICENSE](./LICENSE).+## Learn more-This repository also redistributes third-party assets, including bundled fonts and PDF.js runtime assets, under their own licenses. See [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md) for details.+- [Self-hosting guide](docs/self-hosting.md): deploying, first-run setup, what it costs, your own domain, updates, the EU, the seal, cleanup, rate limits, bot protection and every optional setting.+- [Development](docs/development.md): running SignuDoc locally, storage, the database, email, tests and the code's layout.+- [Contributing](CONTRIBUTING.md), [Security](SECURITY.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).-## Contributing+## License and credits-Issues and pull requests are welcome.+SignuDoc is [MIT licensed](LICENSE). It redistributes third-party assets, including bundled fonts and PDF.js, under their own licenses: see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).-If you plan to contribute, keep the project style simple: small components, explicit server-side logic, and schema-validated inputs.+The project has no email address of its own. Report a security problem privately through GitHub, as [SECURITY.md](SECURITY.md) describes. For help with one particular site that runs SignuDoc, write to the organization that runs it.-The project has no email address of its own. Report a security problem privately through GitHub, as [SECURITY.md](./SECURITY.md) describes, and a conduct problem as the [Code of Conduct](./CODE_OF_CONDUCT.md) describes. For help with one particular site that runs SignuDoc, write to the organization that runs it.+DocuSign is a trademark of DocuSign, Inc. SignuDoc is not created by, affiliated with, or supported by DocuSign, Inc. DocuSign's features and prices are as its website listed them in October 2026.diff --git a/SECURITY.md b/SECURITY.mdindex 32b3334..1228e5a 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -4,7 +4,7 @@If you find a security vulnerability in SignuDoc, please report it privately. **Do not put the details in a public GitHub issue, discussion or pull request.**-Send your report through GitHub's private vulnerability reporting: open the [Report a vulnerability](https://github.com/NYLLON-SOFTWARE/signudoc/security/advisories/new) form, which is also on this repository's security advisories page. The report stays between you and the repository's maintainers. Include:+Send your report through GitHub's private vulnerability reporting: open the [Report a vulnerability](https://github.com/NYLLON-SOFTWARE/SignuDoc/security/advisories/new) form, which is also on this repository's security advisories page. The report stays between you and the repository's maintainers. Include:- A description of the vulnerability.- Steps to reproduce or a proof of concept.diff --git a/docs/development.md b/docs/development.mdnew file mode 100644index 0000000..ea806a7--- /dev/null+++ b/docs/development.md@@ -0,0 +1,153 @@+# Development++How to run SignuDoc on your own machine, test it, and find your way around the code. For deploying and running an install, see the [self-hosting guide](self-hosting.md).++## Run it locally++For development, or to try it on your own machine first.++### 1. Install dependencies++```bash+npm install+```++SignuDoc targets Node.js 24 and is built on Next.js 16.++### 2. Create your environment file++```bash+cp .env.example .env+```++The example file is ready for local development as it is. Uploaded PDFs are kept on disk under `.data/storage` and outgoing email is written to `.data/outbox` as JSON files instead of being sent, so you need no storage or email account to try the whole product.++Every setting, and which ones are optional, is described in `.env.example`.++### 3. Start the database and apply the schema++With Docker installed, this starts Postgres and applies the migrations:++```bash+npm run db:start+```++If you already have a Postgres server, point `DATABASE_URL` at it and run the migrations on their own:++```bash+npm run db:migrate+```++### 4. Start the dev server++```bash+npm run dev+```++Open [http://localhost:3000](http://localhost:3000).++### 5. Set the site up++The first time you open the app it takes you to `/setup`, where you name the organization, give a support address and create the administrator. [Set the site up](self-hosting.md#set-the-site-up), in the self-hosting guide, explains each choice.++## Built with++- Next.js App Router+- React + TypeScript+- Better Auth+- Postgres (`pg`)+- Vercel Blob object storage (local disk in development)+- Resend for transactional email+- `pdf-lib` and `pdfjs-dist`+- Tailwind CSS 4 + shadcn/ui++## How the workflow fits together++1. Upload a PDF and create a draft envelope.+2. Add signers in the order they should receive it.+3. Place fields on the document.+4. Review and send.+5. The first signer receives a secure link.+6. Each signer completes their turn in order.+7. SignuDoc finalizes the signed PDF and audit certificate when the last signer finishes.++People added to receive a copy do not sign. They are sent the finished document and its certificate at step 7 and nothing before it.++A document you send often can be kept as a template: open any envelope, sent or not, and choose Save as template. The template keeps the document, the fields and the signing order, and no one's name or email address. Using it asks who signs this time and opens a draft at step 4.++## Storage++Documents, signed PDFs, audit certificates, drawn signature images, and the small first-page pictures shown on the dashboard are stored in one of two places:++- **Vercel Blob**, in a private store. This is used whenever a Blob store is connected to the project (Vercel sets `BLOB_READ_WRITE_TOKEN`, or `BLOB_STORE_ID` for a store that signs in with the project's OIDC token), and always on Vercel. Nothing in the store has a public URL; every download goes through the app, which checks who is asking first.+- **Local disk**, under `.data/storage` (change it with `STORAGE_LOCAL_DIR`). This is the default everywhere else, including local development.++`STORAGE_DRIVER=blob` or `STORAGE_DRIVER=local` overrides the choice.++On Vercel Blob, the upload page sends the PDF straight from the browser to the store with a short-lived signed URL, because a request to a Vercel Function cannot be larger than 4.5 MB. The upload lands in a pending folder, the app reads it back and validates it like any other upload, stores its own copy, and deletes the pending one. A pending upload that is never picked up is deleted by Blob after a day.++To run the end-to-end test against a real Blob store instead of local disk:++```bash+E2E_STORAGE_DRIVER=blob BLOB_READ_WRITE_TOKEN=... npm run test:e2e+```++## Database++SignuDoc uses Postgres as its only database and talks to it with `pg`. Any Postgres 15 or newer works, including Neon and Supabase.++The schema lives in `db/migrations` as plain SQL files. `npm run db:migrate` applies the ones that have not run yet and records them in the `signudoc_migrations` table, so it is safe to run on every deploy.++## Email delivery++SignuDoc sends transactional email through Resend.++- The support address, where replies go, is asked for when the site is set up. It and the address email is sent from can be changed by the administrator under Settings, Organization. The sender address must be at a domain verified with Resend; the same page adds the domain to Resend, lists the DNS records and checks them. With a Resend API key that is only allowed to send, it points you at Resend's dashboard for that step instead.+- `RESEND_FROM_EMAIL` and `SUPPORT_EMAIL` are optional. When set they take the place of the addresses saved in Settings, which then cannot be changed there, and with `SUPPORT_EMAIL` set the setup page does not ask for a support address.+- Until a sender address is set, mail goes out from `[email protected]`, which Resend only delivers to the owner of the Resend account.+- In hosted mode the support address is also the contact shown on the Terms, Privacy, and Accessibility pages.+- For local development, `EMAIL_DRIVER=capture` writes each email to `.data/outbox` as a JSON file instead of sending it. Open the newest file to find a verification or signing link. This driver refuses to run in production.++## Upload constraints++Document import currently enforces these limits:++- PDF files only+- 20 MB maximum upload size+- password-protected or encrypted PDFs are rejected+- pure XFA or unsupported PDF variants are rejected++## Common scripts++```bash+npm run dev+npm run build+npm run start+npm run db:start+npm run db:stop+npm run db:reset+npm run db:migrate+npm run auth:generate+npm run lint+npm run typecheck+npm run format+npm run format:check+npm test+npm run test:db+npm run test:e2e+```++`npm test` runs the unit tests, which need nothing else running. `npm run test:db` runs the few tests that need a real Postgres (the rate limit counter, the cleanup job's lock and first-run setup) against the `signudoc_e2e` database.++`npm run test:e2e` runs the Playwright end-to-end test. It starts the app against a separate `signudoc_e2e` database on the same Postgres server, sets the site up as its first visitor, signs up a sender, sends a PDF, signs it as the recipient and downloads the results. Install the browser once with `npx playwright install chromium`.++## Project structure++```text+src/app Next.js routes, layouts, and API handlers+src/components UI shells and reusable components+src/lib Auth, database, services, schemas, and domain logic+db SQL migrations and the script that applies them+e2e The Playwright end-to-end test+public/pdfjs PDF.js worker and standard font assets+```diff --git a/docs/images/banner.png b/docs/images/banner.pngnew file mode 100644index 0000000..e02a8d6Binary files /dev/null and b/docs/images/banner.png differdiff --git a/docs/images/branding.png b/docs/images/branding.pngnew file mode 100644index 0000000..1705debBinary files /dev/null and b/docs/images/branding.png differdiff --git a/docs/images/cost.png b/docs/images/cost.pngnew file mode 100644index 0000000..176b824Binary files /dev/null and b/docs/images/cost.png differdiff --git a/docs/images/dashboard.png b/docs/images/dashboard.pngnew file mode 100644index 0000000..57a9a1dBinary files /dev/null and b/docs/images/dashboard.png differdiff --git a/docs/images/envelope.png b/docs/images/envelope.pngnew file mode 100644index 0000000..c8c4e70Binary files /dev/null and b/docs/images/envelope.png differdiff --git a/docs/images/phone.png b/docs/images/phone.pngnew file mode 100644index 0000000..ee914e6Binary files /dev/null and b/docs/images/phone.png differdiff --git a/docs/images/prepare.png b/docs/images/prepare.pngindex 8b5b926..daf36e5 100644Binary files a/docs/images/prepare.png and b/docs/images/prepare.png differdiff --git a/docs/images/signing.png b/docs/images/signing.pngnew file mode 100644index 0000000..fc035ffBinary files /dev/null and b/docs/images/signing.png differdiff --git a/docs/images/verify.png b/docs/images/verify.pngnew file mode 100644index 0000000..87526b3Binary files /dev/null and b/docs/images/verify.png differdiff --git a/docs/images/versus.png b/docs/images/versus.pngnew file mode 100644index 0000000..84eee13Binary files /dev/null and b/docs/images/versus.png differdiff --git a/docs/self-hosting.md b/docs/self-hosting.mdnew file mode 100644index 0000000..4b81198--- /dev/null+++ b/docs/self-hosting.md@@ -0,0 +1,182 @@+# Self-hosting SignuDoc++Everything about running your own SignuDoc: deploying it, setting it up, what it costs, keeping it up to date, and the settings you can change. For working on the code, see [Development](development.md).++- [Deploy to Vercel](#deploy-to-vercel)+- [Set the site up](#set-the-site-up)+- [Your responsibilities](#your-responsibilities)+- [Signed PDFs and the seal](#signed-pdfs-and-the-seal)+- [Running in the EU](#running-in-the-eu)+- [Daily cleanup](#daily-cleanup)+- [Rate limits](#rate-limits)+- [Bot protection](#bot-protection)+- [Hosted mode](#hosted-mode)+- [Self-hosting somewhere else](#self-hosting-somewhere-else)++## Deploy to Vercel++1. **Click "Deploy with Vercel"** in the [README](../README.md).+2. **Sign in to Vercel** and let it copy this repository into your GitHub account. Your site is built from that copy.+3. **Add the three things Vercel offers to create.** Each has a free plan:+ - a Postgres database from [Neon](https://neon.com) (pick the region closest to you),+ - a private file store, [Vercel Blob](https://vercel.com/docs/vercel-blob), for the documents,+ - [Resend](https://resend.com) for sending email.+4. **Click Deploy.** The build creates the database tables by itself.+5. **Open your new site.** It takes you to a setup page, where you name your organization, give the email address people should write to for help, and create the first account. That account is the administrator.+6. **Set up the address you send from.** Under Settings, Organization, enter an address at your own domain in "Send email from" and save (the setup page offers the same field). The site lists the DNS records for that domain and checks them for you. Add them where your domain is managed. If your Resend key is not allowed to manage domains, the page sends you to Resend's dashboard for this step instead.++++Step 6 is the one part that cannot be done for you: every email provider asks for proof that you own the domain you send from. While "Send email from" is empty, email goes out from Resend's test address, which Resend delivers only to the email address of the Resend account itself, normally the one on your Vercel account. So to try the whole product straight away, leave that field empty and send a document to that address. Once you save an address of your own, email is sent from it, and Resend does not deliver it until the domain shows as verified. Add the records before you count on it.++If the site opens on a page that says to connect a database, the database was not connected when the site was built. Connect it under Storage in the Vercel project, deploy again and reload.++### What it costs++[What it costs](../README.md#what-it-costs), in the README, puts a year of SignuDoc next to DocuSign for teams of 5 to 50.++- **Vercel.** The free Hobby plan is enough to run SignuDoc, but Vercel [limits Hobby to personal, non-commercial use](https://vercel.com/docs/limits/fair-use-guidelines). An organization using this for its work belongs on Vercel Pro. Everything here works the same on both.+- **Neon, Vercel Blob and Resend** each have a free plan with limits: see [Neon](https://neon.com/faqs/free-plan-limits-and-quotas), [Vercel Blob](https://vercel.com/docs/vercel-blob/usage-and-pricing) and [Resend](https://resend.com/pricing). The one you are most likely to meet first is Resend's, which at the time of writing allows 100 emails a day and 3,000 a month on its free plan. Every signing invitation, reminder and completed copy is an email.++### Use your own web address++Add your domain to the project in Vercel (Settings, Domains), then deploy once more. The site works out its own address from the project's production domain, so the links in its emails follow the new domain after that deployment. Nothing needs to be set by hand.++### Lock down a new install++A new install is claimed by whoever opens it first. That is normally you, seconds after the deployment finishes. If its address will be known to others before you get there, add a `SETUP_TOKEN` environment variable in Vercel with a secret of your own and deploy again: the setup page then asks for it.++### Keep your install up to date++The Deploy button makes a copy of this repository, and a copy does not receive new versions by itself. To take a new version, bring the changes into your copy and push. Vercel builds the push, and the build applies any new database migrations.++```bash+git clone https://github.com/<your-account>/signudoc.git+cd signudoc+git remote add upstream https://github.com/NYLLON-SOFTWARE/SignuDoc.git+git fetch upstream+git merge upstream/main+git push+```++If git answers `refusing to merge unrelated histories`, your copy was made without this project's history. As long as you have not changed the code yourself, take the new version as it is:++```bash+git reset --hard upstream/main+git push --force-with-lease+```++After that first time, `git merge upstream/main` works as above.++### Optional settings++A deployment made with the button needs no environment variables. These are there if you want them, under Settings, Environment Variables in the Vercel project. Deploy again after changing one.++| Variable | What it does |+| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `SETUP_TOKEN` | A secret the setup page asks for. See [Lock down a new install](#lock-down-a-new-install). |+| `CRON_SECRET` | Closes the daily cleanup route to everyone but Vercel's own cron call. See [Daily cleanup](#daily-cleanup). |+| `BOTID` | `1` turns on Vercel BotID for sign-in, sign-up and setup. See [Bot protection](#bot-protection). |+| `RESEND_FROM_EMAIL`, `SUPPORT_EMAIL` | Fix the sender and support addresses from the environment instead of in Settings. |+| `BETTER_AUTH_SECRET` | Your own secret for signing sessions. Without it one is derived from the database password, so changing that password signs everyone out. |+| `APP_URL` | The site's public address, if it should not be the project's production domain. |+| `HOSTED_MODE` | `1` runs SignuDoc as a public service under its own name. See [Hosted mode](#hosted-mode). |+| `RESEND_REGION` | Where Resend sends from when the app adds your domain, for example `eu-west-1`. See [Running in the EU](#running-in-the-eu). |+| `SEAL_P12_BASE64`, `SEAL_P12_PASSWORD` | Seal finished PDFs with a certificate from a certificate authority instead of the install's own. See [Signed PDFs and the seal](#signed-pdfs-and-the-seal). |+| `SEAL_TIMESTAMP_URL` | An RFC 3161 timestamp server that adds a trusted time to each seal. |++## Set the site up++The first time you open a new install it takes you to `/setup`. There you name your organization, give its support address, and create the first account, which becomes the administrator. After that the setup page is gone for good.++The first time you open a new install it takes you to `/setup`. There you name your organization, give its support address, and create the first account, which becomes the administrator. After that the setup page is gone for good.++- **Support address.** Setup does not finish without one. It is the address signers and people with an account are told to write to, and where replies to the site's emails go. It is saved in your install's own settings and nowhere else; there is no SignuDoc address that it falls back to. The administrator can change it under Settings, Organization, but not remove it.++- **Who can sign up.** The install starts by letting people with an email address at the administrator's own domain create accounts (or nobody else, if the administrator used a public mailbox such as Gmail). The administrator can change this under Settings, Organization: people at listed domains, nobody, or anyone. People who are only sent a document to sign never need an account.+- **More administrators.** Settings, Organization lists everyone with an account under People, where an administrator can make someone else an administrator or take that away. There is always at least one. When an account is closed, its finished documents and their audit trails move to the longest-standing administrator, because they are the organization's records. If that person later stops being an administrator, those documents move on to one who stays, and the documents they sent themselves stay with them.+- **Email.** Settings, Organization also shows whether email is working. While no sender address is set, mail goes out from Resend's test address, which only reaches the owner of the Resend account. Enter a sender address at your domain and the page shows the DNS records to add and checks them for you. Mail from that address is not delivered until its domain is verified.+- **`SETUP_TOKEN`.** A new install can be claimed by whoever opens it first. If its URL will be public before you get to it, set `SETUP_TOKEN` to a secret of your own and the setup page will ask for it.+- **An install from before this page existed** has accounts but no administrator. Set `SETUP_TOKEN`, sign in with the account that should be in charge, and open `/setup`. It asks for a support address if the install has none. Sign-up stays open, as it was, until that administrator changes it.++## Your responsibilities++Your install carries your organization's name, not SignuDoc's. In Settings, link your own terms and privacy policy (without a privacy link, signers see a notice built from your settings at `/signer-privacy`; check it), keep the support address you gave at setup pointed at a mailbox someone reads, and choose how long finished documents are kept. Under GDPR your organization is the controller; Settings, Organization has the tools to answer a signer who asks for their data or for its erasure.++## Signed PDFs and the seal++Every finished PDF and audit certificate is sealed with a PAdES signature, so any change after signing shows in Adobe Acrobat and other PDF readers, and its SHA-256 is recorded. Anyone can check a copy at `/verify`. The audit trail in the database is a hash chain, so an edited or deleted row shows too.++By default each install makes its own seal key and self-signed certificate the first time it seals, and keeps the key encrypted in the database with a key derived from `BETTER_AUTH_SECRET` (or the database password, when that is unset). Keep that secret stable: a new one makes a new seal key, and old PDFs still verify but under the old certificate. Readers show a self-signed seal as "validity unknown" until the certificate is trusted. For a seal readers trust on sight, buy a document-signing certificate and set `SEAL_P12_BASE64` and `SEAL_P12_PASSWORD`. `SEAL_TIMESTAMP_URL` adds a trusted time from a timestamp server.++## Running in the EU++By default the parts of an install run in the US. To keep signers' data in the EU:++1. **Functions.** Add `"regions": ["fra1"]` to `vercel.json` (or pick Frankfurt under Settings, Functions in the Vercel project).+2. **Database.** Create the Neon database in an EU region (Frankfurt) when you connect it.+3. **Files.** Create the Vercel Blob store in an EU region (Frankfurt).+4. **Email.** Set `RESEND_REGION=eu-west-1` before you add your domain in Settings, or create the domain in Resend's dashboard with the Ireland region. Resend still keeps account data and email logs in the US.+5. **Agreements.** Accept the data processing agreements of Vercel, Neon and Resend, which include the EU standard contractual clauses, and list them in your privacy policy.++Some data still leaves the EU: Vercel's and Resend's account metadata and logs, for example. The processors' agreements and the EU-US Data Privacy Framework cover that, but check it against your own obligations.++## Daily cleanup++Once a day the app deletes drafts nobody has touched for 30 days, finishes account deletions that were requested, and clears expired download links and finished rate limit counters. The same run sends the automatic reminders that are due and tells a sender when an envelope has passed its signing deadline. The work is done by a request to:++```text+/api/internal/retention+```++- **On Vercel** this is already scheduled: `vercel.json` has a cron job that calls it once a day. There is nothing to set up.+- **Anywhere else**, have your own scheduler send it a `GET` or `POST` once a day.++A new install has no secret for this route, so the route looks after itself: it runs at most once an hour, never twice at the same time, and answers with an empty response either way. Someone who finds the URL can only make the day's cleanup happen earlier.++To close the route, set a secret. A caller then has to send `Authorization: Bearer <secret>`, and gets a summary of what was cleaned up in return.++- `CRON_SECRET` is the one to use on Vercel, because Vercel sends it on its own cron calls.+- `RETENTION_JOB_SECRET` does the same for a scheduler of your own. On Vercel, a deployment that sets only this one turns Vercel's cron call away, so store the secret as `CRON_SECRET` there instead.++## Rate limits++Sign-in, sign-up, password reset, the signing pages, uploads and sending are rate limited per visitor. The counts are kept in the `rate_limits` table in Postgres, so they hold across every instance of the app. On Vercel the visitor's address is read from the header Vercel sets itself, which a visitor cannot forge. If the database cannot be reached, each instance falls back to counting in its own memory.++## Bot protection++The app can use [Vercel BotID](https://vercel.com/docs/botid), an invisible check that a request comes from a real browser, on the requests a script would go for: creating an account, signing in, asking for a password reset or verification email, the contact form and first-run setup.++It is off by default. To turn it on, set `BOTID=1` on a Vercel deployment and redeploy; the setting is read when the app is built. BotID's basic check is free on every Vercel plan, and its deeper check is a paid option you switch on in the Vercel dashboard. It does nothing anywhere other than Vercel.++It is opt-in for now because it has not yet been proven against a live Vercel deployment. If you turn it on, try signing in from a private window straight away, and remove `BOTID` and redeploy if that fails. A check that cannot reach Vercel lets the request through, so an outage on that side does not lock people out; the rate limits apply either way.++## Hosted mode++`HOSTED_MODE=1` runs SignuDoc as a public service under its own name: the landing page at `/`, the built-in terms, privacy, contact and accessibility pages, and sign-up open to anyone. Leave it unset for an install that belongs to one organization.++## Self-hosting somewhere else++SignuDoc is a regular Next.js app and runs anywhere Node.js 24 and Postgres do:++```bash+npm run db:migrate+npm run build+npm run start+```++Away from Vercel, a few things Vercel does for you are yours to set:++- `DATABASE_URL`, pointing at your Postgres. Run `npm run db:migrate` on every deploy; it only applies what is new.+- `APP_URL`, the site's public HTTPS address.+- `BETTER_AUTH_SECRET`, at least 32 characters (`openssl rand -hex 32`). Without it a secret is derived from the database password, which must then be at least 12 characters long.+- `RESEND_API_KEY`, from your Resend account.+- Files are kept on the machine's disk under `.data/storage` (`STORAGE_LOCAL_DIR` changes where), so that disk must survive restarts. To use a Vercel Blob store from elsewhere, set `BLOB_READ_WRITE_TOKEN`.+- Leave `EMAIL_DRIVER` unset. The capture driver is for development only.++Self-hosted operators are responsible for:++- linking to their own terms and privacy policy under Settings, Organization;+- keeping the support address pointed at a mailbox someone reads, and verifying a sending domain for email;+- configuring retention, consent, and compliance requirements for their own deployment; and+- scheduling the [daily cleanup](#daily-cleanup) if they are not on Vercel, where it is scheduled for them.diff --git a/e2e/signing-flow.spec.ts b/e2e/signing-flow.spec.tsindex aa97a1e..dcef1fa 100644--- a/e2e/signing-flow.spec.ts+++ b/e2e/signing-flow.spec.ts@@ -238,7 +238,7 @@ test("a new install is set up, a sender sends a PDF and a recipient signs it", a// run by the project to send anyone to.await expect(footer.getByRole("link", { name: "Powered by SignuDoc" }),- ).toHaveAttribute("href", "https://github.com/NYLLON-SOFTWARE/signudoc");+ ).toHaveAttribute("href", "https://github.com/NYLLON-SOFTWARE/SignuDoc");}// A signer with a question is sent to the organization's own address.diff --git a/src/lib/branding.ts b/src/lib/branding.tsindex 52dadcd..2b6d23b 100644--- a/src/lib/branding.ts+++ b/src/lib/branding.ts@@ -12,7 +12,7 @@ import type { ResolvedSettings } from "./settings.ts";export const SIGNUDOC_NAME = "SignuDoc";// The project's home is its repository. There is no SignuDoc-run site that// an install should send its visitors to, and no address there to write to.-export const SIGNUDOC_URL = "https://github.com/NYLLON-SOFTWARE/signudoc";+export const SIGNUDOC_URL = "https://github.com/NYLLON-SOFTWARE/SignuDoc";/** Where the install's logo is served. Public: it is shown to signers. */export const BRAND_LOGO_PATH = "/api/brand/logo";diff --git a/src/lib/deploy-button.test.ts b/src/lib/deploy-button.test.tsindex 931f8c8..560eba3 100644--- a/src/lib/deploy-button.test.ts+++ b/src/lib/deploy-button.test.ts@@ -13,9 +13,9 @@ const repoRoot = path.resolve(import.meta.dirname, "..", "..");const readme = readFileSync(path.join(repoRoot, "README.md"), "utf8");function readDeployLink(): URL {- const match = /\]\((https:\/\/vercel\.com\/new\/clone\?[^)\s]+)\)/.exec(- readme,- );+ // A Markdown link or, as the README centres it, an <a href="...">.+ const match =+ /(?:\]\(|href=")(https:\/\/vercel\.com\/new\/clone\?[^)"\s]+)/.exec(readme);assert.ok(match?.[1], "README.md has no Deploy with Vercel link");@@ -27,7 +27,7 @@ test("the button copies this repository and pre-fills its name", () => {assert.equal(link.searchParams.get("repository-url"),- "https://github.com/NYLLON-SOFTWARE/signudoc",+ "https://github.com/NYLLON-SOFTWARE/SignuDoc",);assert.equal(link.searchParams.get("project-name"), "signudoc");assert.equal(link.searchParams.get("repository-name"), "signudoc");@@ -78,26 +78,39 @@ test("the button's demo card is complete and its picture is in the repository",// the repository, where the README shows the product.assert.equal(link.searchParams.get("demo-url"),- "https://github.com/NYLLON-SOFTWARE/signudoc",+ "https://github.com/NYLLON-SOFTWARE/SignuDoc",);const image = link.searchParams.get("demo-image") ?? "";const prefix =- "https://raw.githubusercontent.com/NYLLON-SOFTWARE/signudoc/main/";+ "https://raw.githubusercontent.com/NYLLON-SOFTWARE/SignuDoc/main/";assert.ok(image.startsWith(prefix), image);assert.ok(existsSync(path.join(repoRoot, image.slice(prefix.length))));});-test("every picture the README shows is in the repository", () => {- const pictures = [...readme.matchAll(/!\[[^\]]*\]\((?!https?:)([^)\s]+)\)/g)];+test("every picture and page the README and the guides link to is in the repository", () => {+ // Markdown pictures and links, and the <img> tags the README centres.+ const localTarget =+ /!?\[[^\]]*\]\((?!https?:|#|mailto:)([^)\s#]+)[^)]*\)|<img[^>]*\ssrc="(?!https?:)([^"]+)"/g;++ for (const document of [+ "README.md",+ "docs/self-hosting.md",+ "docs/development.md",+ ]) {+ const text = readFileSync(path.join(repoRoot, document), "utf8");+ const targets = [...text.matchAll(localTarget)].map(+ (match) => match[1] ?? match[2] ?? "",+ );- assert.ok(pictures.length > 0);+ assert.ok(targets.length > 0, document);- for (const [, relativePath] of pictures) {- assert.ok(- existsSync(path.join(repoRoot, relativePath ?? "")),- relativePath,- );+ for (const target of targets) {+ assert.ok(+ existsSync(path.join(repoRoot, path.dirname(document), target)),+ `${document}: ${target}`,+ );+ }}});diff --git a/src/lib/project-contact.test.ts b/src/lib/project-contact.test.tsindex 7358b22..8ce7ff5 100644--- a/src/lib/project-contact.test.ts+++ b/src/lib/project-contact.test.ts@@ -94,7 +94,7 @@ test("security and conduct reports go through GitHub, not to an email address",assert.ok(readFileSync(path.join(repoRoot, "SECURITY.md"), "utf8").includes(- "https://github.com/NYLLON-SOFTWARE/signudoc/security/advisories/new",+ "https://github.com/NYLLON-SOFTWARE/SignuDoc/security/advisories/new",),);assert.match(diff --git a/src/proxy.ts b/src/proxy.tsindex 7e9ba93..4a98652 100644--- a/src/proxy.ts+++ b/src/proxy.ts@@ -92,7 +92,7 @@ function buildContentSecurityPolicy() {preview && "https://vercel.live",// BotID's deeper check runs in a hidden frame on this same site.// Not yet confirmed against a live deployment; see the note on- // BotID in the README.+ // BotID in docs/self-hosting.md.botProtection && "'self'",!preview && !botProtection && "'none'",],