8.5 KiB
DocuSeal Application Analysis
Overview
This document provides a comprehensive analysis of the original DocuSeal application, discovered through exploration of the codebase and server testing. All FloDoc-specific additions (cohorts, institutions, etc.) have been ignored as requested.
Application Architecture
Tech Stack
- Backend: Ruby 3.4.2, Rails 8.0.2.1
- Frontend: Vue.js 3 with Composition API, TailwindCSS 3.4.17, DaisyUI 3.9.4
- Database: PostgreSQL (primary), with SQLite fallback
- Authentication: Devise with 2FA support
- Background Jobs: Sidekiq with Redis
- PDF Processing: HexaPDF
- Asset Pipeline: Shakapacker 8.0 (Webpack)
Core Models Hierarchy
Account (Tenant/Organization)
├── Users (Devise authentication)
├── Templates (Document templates with form fields)
│ ├── TemplateDocuments (PDF files)
│ └── TemplateFolders (Organization)
├── Submissions (Completed document workflows)
│ ├── Submitters (Signers/participants)
│ ├── CompletedDocuments (Final PDFs)
│ └── SubmissionEvents (Audit trail)
└── AccountConfig (Settings)
Core DocuSeal Features
1. User Authentication & Management
Routes: /users/sign_in, /users/sign_up, /users, /settings/profile
- Devise-based authentication with modules:
database_authenticatableregisterablerecoverablerememberablevalidatableomniauthabletwo_factor_authenticatable
- 2FA Support: MFA setup via
/mfa_setup - User Management: Create, update, destroy users
- Profile Management: Contact info, password updates, app URL configuration
2. Template Management System
Routes: /templates, /templates/new, /templates/:id/edit, /templates/:id/preview
-
WYSIWYG PDF Form Builder with 12 field types:
- Signature fields
- Date pickers
- File uploads
- Checkboxes
- Radio buttons
- Text inputs
- Dropdowns
- Initials
- And more...
-
Template Features:
- PDF upload or HTML-based creation
- Multiple submitters per template
- Field tagging system for dynamic content
- Template sharing via links
- Template folders organization
- Template archiving/restoration
- Field detection from PDFs
- Template cloning and replacement
-
Template Preview:
/templates/:id/preview -
Form Preview:
/templates/:id/form -
Share Links: Template sharing with configurable access
3. Submission Workflow Engine
Routes: /submissions, /submissions/archived, /submissions/:id
-
Multi-signer Document Workflows:
- Sequential or parallel signing
- Email invitations to submitters
- Reminders and re-invitations
- State tracking (pending → completed)
-
Submission Features:
- Document generation from templates
- Digital signature embedding
- Email notifications
- Audit trail via
SubmissionEvents - Submission archiving
- Bulk operations
-
Submitter Management:
- Individual participant management
- Field-specific filling permissions
- Email click tracking
- Form view tracking
- Download capabilities
4. API System
Routes: /api/*
-
RESTful API Endpoints:
GET /api/templates- List templatesPOST /api/templates- Create templateGET /api/submissions- List submissionsPOST /api/submissions- Create submissionGET /api/users- User infoPOST /api/attachments- File uploadsPOST /api/submitters/:id/complete- Complete submitter workflow
-
Authentication: Bearer token in Authorization header
-
Format: JSON responses
-
Webhook Events: API-driven event system
5. Webhook System
Events:
submission.created- New submission startedsubmission.completed- All signers finishedsubmitter.completed- Individual signer finishedtemplate.created- New template
Features:
- Configurable webhook URLs
- Retry with exponential backoff
- Event payload tracking
- Delivery status monitoring
6. PDF Processing & Document Management
-
HexaPDF Integration:
- PDF generation from templates
- Form field rendering
- Digital signature embedding
- Signature verification
-
PDFium Integration:
- PDF rendering and preview
- Document manipulation
- Multi-page handling
-
Document Storage:
- Active Storage with multiple backends (S3, Google Cloud, Azure, local)
- Template documents storage
- Completed documents storage
- File attachment handling
7. Settings & Configuration
Routes: /settings/*
-
Account Settings:
- Storage configuration
- SMS settings
- Email SMTP settings
- SSO configuration
- Notification preferences
- E-signature settings
-
API Settings:
- API key management
- Webhook configuration
- Access token revelation
-
User Settings:
- Profile management
- Password updates
- Personalization preferences
8. Background Jobs (Sidekiq)
Queues:
default- General tasksmailers- Email deliverywebhooks- Webhook deliverypdf- PDF generationsms- SMS deliveryimages- Image processingrecurrent- Recurring tasksrollbar- Error reporting
Key Jobs:
SubmissionEmailJob- Send submission invitationsReminderJob- Send reminder emailsWebhookDeliveryJob- Deliver webhook eventsDocumentGenerationJob- Generate final PDFsTokenCleanupJob- Clean up expired tokens
9. Security & Authorization
- Cancancan for authorization
- Role-based access control via
AccountAccessmodel - Template sharing via
TemplateSharing - Single-use tokens with Redis enforcement
- 2FA/MFA support
- SSL/TLS support for production
10. Frontend Architecture
- Vue.js 3 with Composition API
- TailwindCSS 3.4.17 + DaisyUI 3.9.4
- Shakapacker 8.0 for asset compilation
- Hotwire Turbo for Rails UJS
- Web Components + Vue hybrid approach
Key UI Components:
- Template builder interface
- Submission form interface
- Dashboard with analytics
- Settings panels
- API documentation
FloDoc Additions (Ignored)
As requested, the following FloDoc-specific additions were ignored during exploration:
FloDoc Models (Ignored)
Institution- Training institution managementCohort- Cohort management systemCohortEnrollment- Student enrollment trackingCohortAdminInvitation- Admin invitation systemSecurityEvent- Security audit logging
FloDoc Routes (Ignored)
/cohorts- Cohort management/institutions- Institution management/api/v1/institutions- Institution API/api/v1/admin/*- Admin-specific API endpoints
FloDoc Workflow (Ignored)
- Three-portal system (Admin, Student, Sponsor)
- Cohort creation and enrollment workflow
- Excel export functionality
- Custom UI/UX (non-DaisyUI)
Database Schema Summary
Core Tables
users- User authentication and profilesaccounts- Multi-tenancy roottemplates- Document templatestemplate_documents- Template PDF filestemplate_folders- Template organizationsubmissions- Document workflowssubmitters- Signers/participantscompleted_documents- Final signed PDFssubmission_events- Audit trail
Supporting Tables
account_access- User permissionstemplate_sharing- Sharing linkswebhook_events- Webhook delivery trackingemail_events- Email delivery trackingencrypted_configs- Encrypted settingsuser_configs- User preferences
Key Discovery: Server Setup Requirements
During exploration, we discovered that the DocuSeal app requires:
-
JavaScript Asset Compilation: Shakapacker needs either:
bin/shakapacker-dev-serverrunningbin/shakapacker -wwith compile enabled- Precompiled assets for production
-
Redis Connection: Required for Sidekiq and token enforcement
-
Database: PostgreSQL/MySQL/SQLite via DATABASE_URL
-
Sidekiq Embed: Can be disabled for development exploration
Conclusion
The original DocuSeal application is a comprehensive document signing platform with:
- Robust authentication (Devise + 2FA)
- Flexible template system (12 field types, PDF/HTML creation)
- Multi-signer workflows (submissions with state tracking)
- Complete API (RESTful with webhooks)
- PDF processing (HexaPDF + PDFium)
- Modern frontend (Vue.js + TailwindCSS)
- Background processing (Sidekiq queues)
- Multi-tenancy support (account-based isolation)
All FloDoc additions (cohorts, institutions, three-portal system) were successfully ignored during this exploration, focusing purely on the original DocuSeal functionality.