Skip to main content

File Storage Architecture

Source: equa-server/modules/file-storage/, equa-server/modules/data-room/

Overview

Equa uses AWS S3 for file storage with a virtual directory structure persisted in PostgreSQL. Files are uploaded through the API, stored in S3, and organized into data rooms per organization.

Architecture

Entities

Files

FieldTypeDescription
iduuidFile identifier
hashHashContent hash
filenamestringOriginal filename
urlstringS3 URL
extensionstringFile extension
contentTypestringMIME type
sizenumberFile size in bytes
owneruuidUploading user

DirectoryItems (Virtual File System)

FieldTypeDescription
organizationuuidOrganization (part of composite PK)
parentPathstringParent directory path (part of composite PK)
namestringItem name (part of composite PK)
typesmallintFile or folder
fileuuidReference to Files entity
sizenumberSize in bytes

DataRoomsMembers (Access Control)

FieldTypeDescription
dataRoomNamestringData room identifier (part of composite PK)
memberuuidMember with access (part of composite PK)
permissionuuidPermission level (part of composite PK)

Upload Flow

  1. Frontend sends multipart form data via postMultipart() (axios)
  2. Backend receives file, validates size (max 10MB default)
  3. File uploaded to S3
  4. Files record created in PostgreSQL with S3 URL
  5. DirectoryItems record created to place file in data room

Configuration

VariableDefaultDescription
AWS_S3_UPLOAD_SIZE_LIMIT_MB10Maximum file upload size
STATIC_FILE_URLBase URL for serving static files

Data Room Access

Data rooms are per-organization virtual directories. Access is controlled via the DataRoomsMembers junction table linking members to specific data rooms with permission levels.