DocuSign

E-signature integration for document signing workflows. Used for signing renovation contracts, funding documents, and other legal paperwork within Projects.

Architecture

ComponentPath
API Clientbackend/src/lib/docusign-client.ts
Servicebackend/src/services/docusign-service.ts
Routesbackend/src/routes/docusign/

Database Tables

TablePurpose
signatureRequestsTracks signing envelopes sent to signers
signedDocumentsStores signed document references
signedDocumentsMetadataMetadata for signed documents (timestamps, signers)

Authentication

OAuth 2.0 authorization code flow:

  1. User initiates DocuSign connection from admin settings
  2. OAuth redirect to DocuSign consent screen
  3. Callback stores encrypted access/refresh tokens in database
  4. Automatic token refresh before expiry

Tokens are encrypted at rest using ENCRYPTION_MASTER_KEY via backend/src/lib/encryption.ts. See Library Utilities.

Signing Workflow

  1. System generates a PDF Templates document for the Projects context
  2. Creates a DocuSign envelope with document + signer info from Contacts
  3. Sends envelope to signer(s) via DocuSign
  4. DocuSign webhook notifies on status changes (viewed, signed, declined)
  5. Signed document is stored in Files storage