File Storage Configuration
LibreChat supports multiple file storage strategies for avatars, images, and documents. You can use a single strategy for all files or configure granular strategies for different file types.Storage Strategies
LibreChat supports four storage backends:Local Storage
Store files on the server’s local filesystem. Simple but not suitable for distributed deployments.
AWS S3
Store files in Amazon S3 or S3-compatible services (MinIO, Hetzner, Backblaze B2).
Firebase Storage
Use Google Firebase Cloud Storage with automatic optimization.
Azure Blob Storage
Store files in Microsoft Azure Blob Storage.
Configuration Methods
- Single Strategy (Legacy)
- Granular Strategies (Recommended)
Use one storage strategy for all file types:Options:
librechat.yaml
"local", "s3", "firebase", "azure_blob"Local Storage
Stores files on the server’s filesystem.Configuration
librechat.yaml
File Locations
Files are stored in the following directories:Pros and Cons
Advantages
- No external dependencies
- Simple setup
- Free
- Fast for single-server deployments
- Full data control
Disadvantages
- Not suitable for distributed/scaled deployments
- No automatic backups
- Storage limited by server disk space
- Files lost if container/server is destroyed
AWS S3
Store files in Amazon S3 or S3-compatible services.Environment Variables
AWS access key ID
AWS secret access key
AWS region for the S3 bucket
S3 bucket name
Custom S3 endpoint URL (for S3-compatible services)
Use path-style URLs instead of virtual-hosted-style
Required for S3-compatible providers (MinIO, Hetzner, Backblaze B2, etc.) that don’t support virtual-hosted-style URLs. Not needed for AWS S3.
YAML Configuration
librechat.yaml
S3 Bucket Setup
S3-Compatible Services
MinIO
MinIO
.env
Hetzner Object Storage
Hetzner Object Storage
.env
Backblaze B2
Backblaze B2
.env
DigitalOcean Spaces
DigitalOcean Spaces
.env
Firebase Storage
Use Google Firebase Cloud Storage with automatic optimization.Environment Variables
Firebase API key
Firebase auth domain
Firebase project ID
Firebase storage bucket name
Firebase messaging sender ID
Firebase app ID
YAML Configuration
librechat.yaml
Firebase Setup
Create Firebase Project
- Go to Firebase Console
- Create a new project
- Enable Firebase Storage
Get Configuration
- Go to Project Settings
- Scroll to “Your apps” section
- Click “Web app” and copy the configuration values
Features
- Automatic image optimization and resizing
- CDN delivery for fast global access
- Built-in security rules
- Generous free tier (5GB storage, 1GB/day downloads)
- Automatic backups
Azure Blob Storage
Store files in Microsoft Azure Blob Storage.Environment Variables
Azure storage account connection string
Azure blob container name
Enable public access to blobs
YAML Configuration
librechat.yaml
Azure Setup
Create Storage Account
- Go to Azure Portal
- Create a new Storage Account
- Choose performance and replication options
Create Container
- In your storage account, go to Containers
- Create a new container named
files - Set access level (Private or Blob)
Get Connection String
- Go to Access keys in your storage account
- Copy the connection string from key1 or key2
File Upload Configuration
Configure file upload limits per endpoint inlibrechat.yaml:
librechat.yaml
Migrating Between Storage Strategies
When changing storage strategies, existing files won’t be automatically migrated.Migration Steps
Performance Optimization
CDN Integration
For production deployments, consider using a CDN:- CloudFront (S3)
- Azure CDN
- Firebase Hosting
- Create CloudFront distribution pointing to S3 bucket
- Configure origin access identity
- Update S3 bucket policy
- Use CloudFront URL for file access
Caching Headers
Configure static file caching:.env
Image Optimization
Enable client-side image resizing to reduce upload sizes:librechat.yaml
Comparison
| Feature | Local | S3 | Firebase | Azure Blob |
|---|---|---|---|---|
| Setup Complexity | Easy | Medium | Medium | Medium |
| Cost | Free | Pay-per-use | Free tier + pay | Pay-per-use |
| Scalability | Limited | Excellent | Excellent | Excellent |
| CDN | No | Optional | Built-in | Optional |
| Automatic Optimization | No | No | Yes | No |
| Best For | Development | Production | Production | Enterprise |
| Distributed Deployments | No | Yes | Yes | Yes |
Recommendations
Development
Use local storage for simplicity:
Small Production
Use Firebase for automatic optimization:
Enterprise
Use S3 or Azure based on your cloud provider:
Hybrid
Use granular strategies for optimization:
Troubleshooting
Files not uploading
Files not uploading
- Verify storage credentials are correct
- Check bucket/container permissions
- Ensure CORS is configured correctly
- Review file size limits
- Check network connectivity to storage service
Images not loading
Images not loading
- Verify files were uploaded successfully
- Check bucket/container public access settings
- Ensure CORS allows your domain
- Verify file URLs are accessible
- Check browser console for CORS errors
S3-compatible service issues
S3-compatible service issues
- Set
AWS_FORCE_PATH_STYLE=truefor most S3-compatible services - Verify endpoint URL is correct
- Check if service supports virtual-hosted-style URLs
- Test credentials with S3 CLI tools
Performance issues
Performance issues
- Enable CDN for faster delivery
- Configure caching headers
- Enable client-side image resizing
- Consider using granular strategies
- Review file size limits
Next Steps
AI Endpoints
Configure AI providers
Authentication
Set up user authentication
Environment Variables
Complete environment reference
YAML Configuration
Advanced configuration options