Engineering
Database Design
FlowMint relies on a relational model (PostgreSQL) due to the strict hierarchical nature of the data and the necessity for ACID transactions during state changes.
Entity Relationship Diagram (Conceptual)
Key Design Principles
-
State Machine Logging: Every status change must be appended to an
audit_logstable. We do not just update the status row; we recordwho,when, andwhythe status changed for compliance. -
Storage Optimization (S3/R2):
- Attachments are stored with UUID-based keys.
- The database stores an array of
file_versionsfor team-level assets. The latest index is always treated as the "Current" version.
-
JSONB for Dynamic Tasks: Because workflows are dynamic, the actual submission data is stored as a
JSONBpayload, allowing for infinite flexibility without schema migrations, while metadata (state, timestamps, owners) remains relational for fast querying.