| Metric | Value |
|---|---|
| Total SLOC | 11,700 |
| Source Files | 79 |
| .js | 4,430 |
| .tsx | 3,416 |
| .md | 2,328 |
| .ts | 983 |
| .sql | 242 |
A simplified DocuSign-like platform demonstrating document workflows, electronic signatures, and secure audit trails. This educational project focuses on building a legally compliant signature system with multi-party signing flows.
- PDF upload and processing
- Template creation
- Field placement (signature, initial, date, text, checkbox)
- Version control
- Multi-party routing
- Signing order (serial/parallel)
- Role-based access
- Email notifications (simulated)
- Draw signature on canvas
- Type signature with custom font
- Field completion tracking
- Session-based auth with Redis
- Email verification for signers
- Tamper-proof hash chain
- Complete event logging
- IP addresses and timestamps
- Certificate of completion
- Node.js 20+
- Docker and Docker Compose
- pnpm, npm, or yarn
cd docusign
docker-compose up -dThis starts:
- PostgreSQL (port 5432)
- Redis (port 6379)
- MinIO (ports 9000, 9001)
Wait for services to be healthy:
docker-compose pscd backend
npm install
npm run devBackend runs on http://localhost:3001
cd frontend
npm install
npm run devFrontend runs on http://localhost:5173
Open http://localhost:5173 in your browser.
Test Accounts:
- Admin:
admin@docusign.local(any password) - User:
alice@example.com(any password) - User:
bob@example.com(any password)
If you prefer to run services natively:
# macOS with Homebrew
brew install postgresql@16
brew services start postgresql@16
createdb docusign
psql docusign < backend/db/init.sqlSet environment variables:
export POSTGRES_HOST=localhost
export POSTGRES_USER=your_username
export POSTGRES_PASSWORD=your_password# macOS with Homebrew
brew install redis
brew services start redis# macOS with Homebrew
brew install minio/stable/minio
minio server ~/minio-data --console-address ":9001"Create buckets:
mc alias set local http://localhost:9000 minioadmin minioadmin123
mc mb local/docusign-documents
mc mb local/docusign-signaturesPOST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- LoginPOST /api/v1/auth/logout- LogoutGET /api/v1/auth/me- Get current user
GET /api/v1/envelopes- List envelopesPOST /api/v1/envelopes- Create envelopeGET /api/v1/envelopes/:id- Get envelope detailsPOST /api/v1/envelopes/:id/send- Send for signingPOST /api/v1/envelopes/:id/void- Void envelope
POST /api/v1/documents/upload/:envelopeId- Upload PDFGET /api/v1/documents/:id/view- View document
POST /api/v1/recipients/:envelopeId- Add recipientGET /api/v1/recipients/envelope/:envelopeId- List recipients
POST /api/v1/fields/:documentId- Add fieldGET /api/v1/fields/document/:documentId- List fields
GET /api/v1/signing/session/:accessToken- Get signing sessionPOST /api/v1/signing/sign/:accessToken- Capture signaturePOST /api/v1/signing/finish/:accessToken- Complete signingPOST /api/v1/signing/decline/:accessToken- Decline to sign
GET /api/v1/audit/envelope/:envelopeId- Get audit eventsGET /api/v1/audit/verify/:envelopeId- Verify chain integrityGET /api/v1/audit/certificate/:envelopeId- Get certificate
GET /api/v1/admin/stats- System statisticsGET /api/v1/admin/users- List all usersGET /api/v1/admin/envelopes- List all envelopesGET /api/v1/admin/emails- View simulated emails
docusign/
├── docker-compose.yml # PostgreSQL, Redis, MinIO
├── backend/
│ ├── src/
│ │ ├── index.js # Express server
│ │ ├── routes/ # API endpoints
│ │ │ ├── auth.js
│ │ │ ├── envelopes.js
│ │ │ ├── documents.js
│ │ │ ├── recipients.js
│ │ │ ├── fields.js
│ │ │ ├── signing.js
│ │ │ ├── audit.js
│ │ │ └── admin.js
│ │ ├── services/ # Business logic
│ │ │ ├── auditService.js
│ │ │ ├── workflowEngine.js
│ │ │ └── emailService.js
│ │ ├── middleware/
│ │ │ └── auth.js
│ │ └── utils/
│ │ ├── db.js # PostgreSQL
│ │ ├── redis.js # Session storage
│ │ └── minio.js # Document storage
│ └── db/
│ └── init.sql # Database schema
└── frontend/
└── src/
├── routes/ # TanStack Router pages
├── stores/ # Zustand state
├── services/ # API client
└── types/ # TypeScript types
- Create Envelope - Name your signing package
- Upload Document - Add PDF documents
- Add Recipients - Specify who needs to sign and in what order
- Place Fields - Click on the document to add signature fields
- Send - Recipients receive email with signing link
- Sign - Recipients open link, view document, and sign
- Complete - All signatures collected, audit trail verified
# Terminal 1
npm run dev:server1 # Port 3001
# Terminal 2
npm run dev:server2 # Port 3002
# Terminal 3
npm run dev:server3 # Port 3003Backend (backend/.env):
PORT=3001
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=docusign
POSTGRES_USER=docusign
POSTGRES_PASSWORD=docusign_dev
REDIS_URL=redis://localhost:6379
MINIO_ENDPOINT=localhost
MINIO_PORT=9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin123
FRONTEND_URL=http://localhost:5173- Document Processing: Parse and render PDFs, place interactive fields
- Workflow Engine: Complex routing with conditions and parallel signing
- Legal Compliance: Meet e-signature laws (ESIGN, eIDAS, UETA)
- Audit Integrity: Tamper-proof logging with cryptographic verification
- Real-Time Collaboration: Multiple signers viewing same document
See architecture.md for detailed system design documentation.
See claude.md for development insights and design decisions.
- DocuSign Developer Center - Official API documentation and integration guides
- ESIGN Act (Electronic Signatures in Global and National Commerce Act) - US legal framework for e-signatures
- eIDAS Regulation - EU electronic identification and trust services
- pdf-lib Documentation - JavaScript library for PDF manipulation
- React-PDF - PDF rendering in React applications
- Certificate Transparency - Concepts applicable to audit trail integrity
- Merkle Trees and Hash Chains - Data structures for tamper-evident logging
- UETA (Uniform Electronic Transactions Act) - State-level e-signature legislation
- Designing Document Workflows - UX research on document management
- Digital Signatures and PKI - Cryptographic foundations for signing