Storage
File upload and storage with S3-compatible providers
Overview
The storage module provides a unified interface for file uploads using S3-compatible storage providers (AWS S3, Cloudflare R2, MinIO, etc.).
Architecture
The storage system is organized in src/lib/storage/:
src/lib/storage/
├── index.ts # Client-safe exports
├── server.ts # Server-side storage instance
├── types.ts # Type definitions and bucket config
├── utils.ts # Utility functions
└── providers/
└── s3.ts # S3 storage provider implementationKey Concepts
Storage Provider
The storage provider is a class that implements the storage interface. Currently, the S3 provider is available which works with any S3-compatible service.
Buckets
Buckets define different storage areas with specific configurations:
- File size limits - Maximum upload size per bucket
- Allowed MIME types - Restrict file types
- Path prefixes - Organize files in the bucket
Upload Flow
- Client requests a presigned upload URL
- Server validates the request and generates a signed URL
- Client uploads directly to storage
- Server stores the file path in the database
Getting Started
- Configure your storage provider credentials
- Define your buckets in
types.ts - Use the
FileUploadcomponent for uploads
Continue to Configuration to set up your storage provider.