GovPass
Government Visa Application Management System
Problem
Processing visa applications for a government agency with strict regulatory constraints: mandatory document retention, audit trails for every state transition, role-based access across 15+ officer tiers, and zero tolerance for data loss. The existing paper-based workflow processed ~200 applications/day with a 30% error rate from manual data entry.
Architecture
State machine driven: each application progresses through a directed acyclic graph of states (submitted → document_review → background_check → approved/rejected). Every transition is an immutable event appended to an audit log — no updates, only inserts. Document processing uses a pipeline: upload → virus scan → OCR extraction → validation → storage with checksums. Role-based access uses a permission matrix evaluated at the middleware layer before any controller logic runs.
Trade-offs
Event-sourced audit log means storage grows monotonically and queries against "current state" require projecting from the event stream or maintaining a materialized view. We chose dual-write: event log for compliance + materialized status table for queries. The consistency risk (view vs log divergence) is mitigated by a nightly reconciliation job that flags mismatches.