Skip to content

Open-source document signature platform. Not affiliated with DocuSign.

TypeScript

Document the local setup without Supabase, R2 or Resend

Claude22ce1ba8cefd
diff --git a/.env.example b/.env.example
index 65a67cf..3e16e31 100644
--- a/.env.example
+++ b/.env.example
@@ -1,22 +1,26 @@
-# Supabase
-DATABASE_URL=replace-with-supabase-database-url
+# Postgres. `npm run db:start` runs one locally with these credentials.
+DATABASE_URL=postgres://signudoc:[email protected]:5432/signudoc
# Public application URL used for absolute links, auth callbacks, and emails.
-APP_URL=replace-with-app-url
+APP_URL=http://localhost:3000
-# Better Auth
+# Better Auth. Generate the secret with: openssl rand -hex 32
BETTER_AUTH_SECRET=replace-with-better-auth-secret
-BETTER_AUTH_URL=replace-with-better-auth-url
+BETTER_AUTH_URL=http://localhost:3000
# Shared secret for the internal retention job route.
RETENTION_JOB_SECRET=replace-with-internal-retention-job-secret
-# Resend
+# Email. "capture" writes each email to .data/outbox as JSON instead of
+# sending it, which is all local development needs. Use "resend" to send.
+EMAIL_DRIVER=capture
RESEND_API_KEY=replace-with-resend-api-key
RESEND_FROM_EMAIL=replace-with-resend-from-email
SUPPORT_EMAIL=replace-with-support-email
-# Cloudflare R2
+# File storage. "local" keeps PDFs under .data/storage. Use "r2" for
+# Cloudflare R2 and fill in the four values below.
+STORAGE_DRIVER=local
R2_ACCOUNT_ID=replace-with-r2-account-id
R2_ACCESS_KEY_ID=replace-with-r2-access-key-id
R2_SECRET_ACCESS_KEY=replace-with-r2-secret-access-key
diff --git a/README.md b/README.md
index 8a5003c..c7ab4d2 100644
--- a/README.md
+++ b/README.md
@@ -22,14 +22,14 @@ The open source project is designed to be self-hostable, and the hosted version
- Track draft, sent, completed, declined, and voided envelopes
- Generate a final signed PDF and audit certificate
- Send manual reminders to the current signer
-- Run with Supabase Postgres for local and hosted deployments
+- Run on any Postgres database, locally or hosted
## Built with
- Next.js App Router
- React + TypeScript
- Better Auth
-- Supabase Postgres (`pg`)
+- Postgres (`pg`)
- Cloudflare R2 object storage
- Resend for transactional email
- `pdf-lib` and `pdfjs-dist`
@@ -51,41 +51,39 @@ SignuDoc currently targets Node.js 20.9+ and is built on Next.js 16.
cp .env.example .env
```
-Then fill in the values in `.env`.
+The example file is ready for local development as it is, apart from `BETTER_AUTH_SECRET`, which you generate with `openssl rand -hex 32`. Locally, 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.
-The app now requires explicit values for every env-backed dependency. Leaving placeholders in place is treated as unconfigured, and the related feature will fail when used.
+A value that still starts with `replace-with-` is treated as not set.
For production deployments:
- `APP_URL` and `BETTER_AUTH_URL` must be absolute HTTPS URLs.
- `APP_URL` and `BETTER_AUTH_URL` must not point at localhost.
- `BETTER_AUTH_SECRET` must be a strong secret. The app enforces a minimum length of 32 characters in production.
+- Leave `EMAIL_DRIVER` and `STORAGE_DRIVER` unset, or set them to `resend` and `r2`. The local drivers are for development only.
At a minimum, you should review these groups:
- **App/Auth**: `APP_URL`, `BETTER_AUTH_SECRET`, `BETTER_AUTH_URL`
- **Database**: `DATABASE_URL`
-- **Storage**: `R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_BUCKET_NAME`
-- **Email**: `RESEND_API_KEY`, `RESEND_FROM_EMAIL`, `SUPPORT_EMAIL`
+- **Storage**: `STORAGE_DRIVER`, `R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_BUCKET_NAME`
+- **Email**: `EMAIL_DRIVER`, `RESEND_API_KEY`, `RESEND_FROM_EMAIL`, `SUPPORT_EMAIL`
- **Internal jobs**: `RETENTION_JOB_SECRET`
See `.env.example` for the full list.
-### 3. Apply the database schema
+### 3. Start the database and apply the schema
-This repo already includes the committed `supabase/` directory and migrations.
-
-For a hosted Supabase project, link the repo to your project and push the schema:
+With Docker installed, this starts Postgres and applies the migrations:
```bash
-npx supabase link --project-ref <your-project-ref>
-npm run db:push
+npm run db:start
```
-If you prefer local Supabase development, Docker is required:
+If you already have a Postgres server, point `DATABASE_URL` at it and run the migrations on their own:
```bash
-npm run db:start
+npm run db:migrate
```
### 4. Start the dev server
@@ -102,34 +100,21 @@ Open [http://localhost:3000](http://localhost:3000).
Documents, signed PDFs, audit certificates, and drawn signature images are stored in Cloudflare R2 using its S3-compatible API.
-### Database
-
-SignuDoc uses Supabase Postgres as its only database. The checked-in `supabase/config.toml` is Postgres-only for local development; Supabase Auth, Storage, Realtime, Edge Runtime, and Inbucket are disabled because SignuDoc uses Better Auth, Cloudflare R2, and Resend.
-
-This repo already includes the committed `supabase/` directory and migrations.
-
-For a hosted Supabase project:
+For local development, `STORAGE_DRIVER=local` keeps the same files on disk under `.data/storage`.
-```bash
-npx supabase link --project-ref <your-project-ref>
-npm run db:push
-```
+### Database
-Then point `DATABASE_URL` at the Supabase connection string from the dashboard. Because SignuDoc uses a persistent `pg.Pool` in a long-lived Next.js server, use a **Direct connection** string by default. If your network requires IPv4, use the **Session pooler** instead. Avoid the Transaction pooler, which is designed for serverless/edge workloads.
+SignuDoc uses Postgres as its only database and talks to it with `pg`. Any Postgres 15 or newer works, including Neon and Supabase.
-If you want a local Supabase stack instead, Docker is required and the local DB URL is typically:
-
-```bash
-postgresql://postgres:postgres@localhost:54322/postgres
-```
+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 only.
+SignuDoc sends transactional email through Resend.
- `RESEND_FROM_EMAIL` must use a verified Resend sending domain or subdomain.
- `SUPPORT_EMAIL` is used as the default reply-to address for outbound mail **and** as the public support contact displayed on the Terms, Privacy, and Accessibility pages. If it is missing, those pages will fail to render.
-- There is no local email outbox fallback. If email env values are missing or still placeholder-like, email flows fail when used.
+- 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
@@ -149,14 +134,17 @@ npm run start
npm run db:start
npm run db:stop
npm run db:reset
-npm run db:push
+npm run db:migrate
npm run auth:generate
npm run lint
npm run typecheck
npm run format
npm run format:check
+npm run test:e2e
```
+`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, signs up, sends a PDF, signs it as the recipient and downloads the results. Install the browser once with `npx playwright install chromium`.
+
## How the workflow fits together
1. Upload a PDF and create a draft envelope.