How supabase/storage works
Main Components
a. Client Interface Layer
• HTTP/REST API endpoints
• TUS Protocol handler
• S3 Compatible API interface
b. Authentication & Authorization Layer
• JWT authentication
• API Key validation
• SignatureV4 verification (for S3)
• Row Level Security (RLS) integration
c. Core Service Layer
• Storage Service Manager
• Object Manager
• Bucket Manager
• Renderer Service (for image transformations)
• Event System
d. Backend Storage Layer
• S3-compatible storage backend
• File system storage backend
• Database metadata storage (PostgreSQL)
e. Monitoring & Infrastructure
• OpenTelemetry integration
• Prometheus metrics
• Grafana dashboards
• PubSub system
Relationships and Data Flow
• Client requests flowing through authentication
• Storage operations passing through the core service layer
• Metadata operations to PostgreSQL
• Object storage operations to backend storage
• Event notifications through PubSub
• Monitoring data flow to observability stack
Key Technical Elements
Specific components from the codebase:
• Storage Backend Adapters (src/storage/backend)
• Database Adapters (src/storage/database)
• Protocol Handlers (src/storage/protocols)
• Renderer Service (src/storage/renderer)
• Event System (src/storage/events)
Additional Details
Annotations for:
• Security boundaries
• Authentication flows
• Transformation pipelines
• Event workflows
• Migration processes
The comprehensive monitoring and observability setup
This will create a clear and accurate representation of the Supabase Storage Engine's architecture while maintaining the necessary level of detail for a principal software engineer to understand the system's complete design.