Skip to main content

Overview

The Cloud Storage System is a URL-based file serving system for multimodal LLM processing. Files are stored to disk or S3 and accessed via secure, token-authenticated URLs that multimodal AI providers fetch directly.

Architecture

File Upload Flow

1

Client Upload

Frontend sends multipart form data to the API Gateway.
2

Authentication

Gateway verifies user permissions and organization context.
3

Validation

File type, size, and organization limits are checked.
4

Storage

File saved to disk/cloud with secure naming convention.
5

Database Record

Attachment record created with metadata and 64-character access token.
6

Response

Returns attachment metadata and secure access URL.

Database Schema

message_attachments

file_storage_config

Security Architecture

Token-Based Authentication

  • Each file gets a unique access token (64-character hex string)
  • Tokens required for file downloads
  • Configurable expiration times per organization

Organization Isolation

  • All files partitioned by organization ID
  • Cross-organization access prevented at database level
  • Storage paths include organization-specific directories

Storage Path Structure

File Validation Pipeline

API Endpoints

LLM Provider Integration

LLM services access files directly via URL — no base64 encoding needed:

Performance Improvements

Error Handling