Supported Drivers
fs (File System)
Local file system
s3 (AWS S3)
AWS S3 compatible storage
fs Driver
Stores files in the local file system.Basic Configuration
Configuration Options
- location
- urlBuilder
- visibility
File storage locationRecommended: Relative path from project root
Practical Examples
Development Environment
Static File Serving
You need to serve static files with Fastify:s3 Driver
Stores files in AWS S3 or compatible storage.Basic Configuration
Required Environment Variables
Configuration Options
- credentials
- region
- bucket
- urlBuilder
AWS credentialsHow to obtain:
- AWS Console → IAM
- Create user
- Grant S3 permissions (
AmazonS3FullAccess) - Create Access Key
Practical Examples
Basic S3 Configuration
CloudFront CDN Integration
- Fast transfer speed (edge locations)
- Reduced bandwidth costs
- Caching
Public Bucket Configuration
To make an S3 bucket public:S3 Compatible Storage
Cloudflare R2
- Free egress (no transfer costs)
- S3 API compatible
- Cloudflare network
MinIO (Self-hosted)
Driver Comparison
| Feature | fs | S3 |
|---|---|---|
| Cost | Free (disk space) | Paid (storage + transfer) |
| Scalability | Limited (server disk) | Unlimited |
| Speed | Very fast | Fast (network) |
| Backup | Manual | Automatic (versioning) |
| CDN | Requires separate setup | CloudFront integration |
| Use case | Development, small scale | Production, large scale |