System Design Interview: An E-Signature Service Like DocuSign
10 views
"Design an electronic signature platform" tests document storage, workflow orchestration, security and legal auditability. Here is a structured approach for a 45-minute interview.
1. Requirements
Functional: a sender uploads a document (PDF), places signature and form fields, adds recipients with a signing order, and sends an envelope. Recipients receive an email link, verify identity, review, and sign. Everyone gets the completed document and a certificate of completion. Senders can track status, send reminders, void envelopes and use templates. Non-functional: documents are confidential, every action is auditable and tamper-evident, signed documents must never change, high availability for signing links, and a few seconds of latency on status updates is acceptable. Scale: 5 million envelopes per day, average 3 recipients, documents up to 25 MB.
2. Core entities
Envelope (id, sender, status, created_at, expires_at), Document (envelope_id, version, storage key, SHA-256 hash), Recipient (envelope_id, email, role, routing order, status, auth method), Field (document, page, coordinates, type, assigned recipient, value), and AuditEvent (envelope_id, actor, action, IP, user agent, timestamp, previous_event_hash).
3. Architecture
- API service for creating and managing envelopes.
- Document service: uploads go to object storage encrypted with per-tenant keys; a converter normalizes files to PDF and renders page images for the signing UI.
- Workflow engine: a state machine per envelope (Draft, Sent, Partially Signed, Completed, Declined, Voided, Expired) that determines which recipients are active based on routing order.
- Notification service: emails, SMS codes and reminders through queues.
- Signing service: serves the signing session and records field values.
- Finalization service: flattens fields into the PDF, applies a digital signature, and produces the certificate.
4. Signing links and identity
Each recipient gets a unique, high-entropy, single-envelope token in the email link, valid for a limited time. For higher assurance, add an access code, SMS one-time code or ID verification. Store only hashed tokens. Rate-limit attempts to prevent brute force.
5. Tamper evidence
Interviewers focus here. Hash the original document at send time and store the hash. Write each audit event with the hash of the previous event, forming a hash chain per envelope; optionally anchor chain heads periodically in a separate system or with a trusted timestamping authority. On completion, the final PDF is signed with the platform's certificate (PAdES-style digital signature), so any later modification breaks the signature visibly in PDF readers.
6. Concurrency and ordering
With parallel signers, two recipients may submit at the same moment. Update the envelope state with optimistic locking (version column) and process completion idempotently: only one worker finalizes the document, guarded by a conditional state transition from "all signed" to "finalizing."
7. Storage and retention
Documents live in object storage with versioning and write-once retention policies for completed envelopes. Metadata goes in a relational database sharded by account. Audit events go to an append-only store. Support customer-specific retention and legal holds, and data residency by storing documents in the region the customer chooses.
8. Reliability
Email delivery failures are common: track bounces and surface them to senders. Signing pages should be served from multiple regions; finalization is async with retries via a queue.
9. Wrap-up
Summarize: state-machine workflow, secure links with optional extra authentication, hash-chained audit trail, digitally sealed final PDFs, and idempotent finalization. When an interviewer digs into security trade-offs, it helps to keep your structure in view. Linkjob AI (https://linkjob.ai) provides real-time help during live job interviews and technical interviews, prompting the next point so your design discussion stays organized.