Development of Electronic Document Management System (ECM/BPM)
ECM (Enterprise Content Management) + BPM (Business Process Management) are systems for creating, approving, storing, and searching documents with automated business processes. They replace paper procedures and Excel spreadsheets with approval statuses.
Key Concepts
Document — not just a file. An object with metadata (type, author, counterparty, amount, date), versions, change history, related documents, and lifecycle (draft → review → approved → archived).
Approval Route — graph of stages and participants. Stages can be:
- Sequential (step 2 starts after step 1)
- Parallel (multiple approvers simultaneously)
- Conditional (if amount > 1M → add CFO)
Approval Task — specific task for specific user: approve, review, sign, fill requisites.
BPM Engines
Implementing workflow engine from scratch is time-consuming. Mature solutions:
Camunda BPM — Java, BPMN 2.0-compatible engine. REST API allows embedding in any stack. Visio-like route editor in browser (Camunda Modeler). Supports DMN for business rules.
Activiti — lightweight Java engine, embedded in Spring Boot.
Temporal.io — code-first workflow engine (Go/Java/TS). Reliable under failures, supports long-lived processes (hours, days, months).
Example of process definition in BPMN (simplified):
<process id="invoice-approval">
<startEvent id="start"/>
<userTask id="manager-review" name="Manager Approval"
camunda:assignee="${document.manager_id}"/>
<exclusiveGateway id="gateway-1"/>
<userTask id="cfo-review" name="CFO Approval"
camunda:assignee="[email protected]"/>
<!-- ... -->
</process>
Document Versioning
Each document revision is stored separately:
CREATE TABLE document_versions (
id, document_id, version_number INT,
file_path TEXT, file_hash VARCHAR(64),
author_id, created_at,
change_summary TEXT
);
Current version is record with maximum version_number. On edit, new record is created, old ones aren't deleted. Diff between versions — for text documents via diff-match-patch, for DOCX — via LibreOffice conversion + diff.
Electronic Signature
Integration with digital signature providers:
- CryptoPro — GOST algorithms, requires plugin or desktop client
- Diadoc (Kontur) — cloud signature, API for embedded signing
- Digital Signature from Gov Services — via ESIA
For internal document management, "simple" electronic signature is sufficient: identity verification via authentication + document hash fixation and timestamp.
Full-Text Search
Search by document text (including PDF, DOCX, XLSX content):
- Text extraction: Apache Tika or LibreOffice headless
- Indexing: Elasticsearch with Cyrillic morphology (plugin
analysis-morphology) - Search by metadata + full-text with weights
1C Integration
Bidirectional synchronization:
- 1C → ECM: document creation (invoices, UPD, acts) automatically appear in ECM with "requires approval" status
- ECM → 1C: after approval document is marked in 1C as "approved", journal entries are created automatically
Implemented via 1C HTTP services or COM object (for on-premise).
Archive and Storage
Legislation requires storing primary documents 5 years, HR documents 75 years. Archive must:
- Be immutable (WORM — Write Once Read Many)
- Support fast search
- Allow export for tax inspection
Object storage (S3/MinIO) with Immutable Object Lock for WORM mode.
Timelines
MVP (document creation, simple sequential routes, versioning, search): 3–5 months. Full ECM/BPM system with Camunda, digital signature, 1C integration, full-text search, and archive: 6–12 months.







