Skip to content
Middle+0 views

Design a system for managing a document archive with search, retention periods, and legally compliant destruction.

Practice

Asked at

AI answer

Architecture and storage

The API and archive interface manage documents, metadata, permissions, retention policies, and destruction requests. Metadata and the operations log are stored in a relational database; file versions are stored in encrypted, versioned object storage. Text extraction, antivirus scanning, and indexing run asynchronously through a queue; the search index can be rebuilt from primary data.

Search and retention periods

Support full-text search and filters by type, owner, date, category, and status. Index only permitted metadata and text; enforce access checks both during search and when returning a document. Each record has a retention category, start date, period, basis, and applicable holds (legal hold). Policies are versioned; the destruction date calculation is transparent and audited. Automatic destruction is suspended while a legal hold is in effect.

Legally significant destruction

Process: identify candidates → check retention periods and holds → obtain approval from authorized personnel → destroy the file and its copies/versions and remove it from the index → confirm the result. The operation must be idempotent and leave an immutable audit record containing the document identifier, basis, policy, time, executor, and result, but no unnecessary document content. Account for replicas, caches, and backups: define a documented procedure for deletion or backup expiration, and prevent already destroyed objects from being restored.

Restrict access by roles and attributes, encrypt data and backups, and audit reads and changes. Monitor indexing errors, overdue destruction tasks, and deletion latency; test recovery, access permissions, and the complete destruction lifecycle.