Storage
Configure S3-compatible storage for file uploads
Storage
LaunchSaaS supports S3-compatible storage for file uploads. This works with AWS S3, Cloudflare R2, MinIO, and other S3-compatible services.
Setup
1. Enable Storage
NEXT_PUBLIC_STORAGE_ENABLED=true2. Configure Provider
Choose an S3-compatible storage provider:
Cloudflare R2 (Recommended)
- Go to Cloudflare Dashboard → R2
- Create a bucket
- Create an API token with R2 permissions
- Add to your
.env:
STORAGE_PROVIDER=s3
STORAGE_ACCESS_KEY_ID="your-access-key-id"
STORAGE_SECRET_ACCESS_KEY="your-secret-access-key"
STORAGE_BUCKET="your-bucket-name"
STORAGE_REGION="auto"
STORAGE_API_ENDPOINT="https://<account-id>.r2.cloudflarestorage.com"
STORAGE_PUBLIC_ENDPOINT="https://pub-<id>.r2.dev"AWS S3
- Go to AWS S3 Console
- Create a bucket
- Create an IAM user with S3 permissions
- Add to your
.env:
STORAGE_PROVIDER=s3
STORAGE_ACCESS_KEY_ID="your-access-key-id"
STORAGE_SECRET_ACCESS_KEY="your-secret-access-key"
STORAGE_BUCKET="your-bucket-name"
STORAGE_REGION="us-east-1"
STORAGE_API_ENDPOINT="https://s3.us-east-1.amazonaws.com"
STORAGE_PUBLIC_ENDPOINT="https://your-bucket-name.s3.us-east-1.amazonaws.com"MinIO (Self-Hosted)
- Deploy MinIO server
- Create a bucket
- Create access credentials
- Add to your
.env:
STORAGE_PROVIDER=s3
STORAGE_ACCESS_KEY_ID="your-access-key"
STORAGE_SECRET_ACCESS_KEY="your-secret-key"
STORAGE_BUCKET="your-bucket-name"
STORAGE_REGION="us-east-1"
STORAGE_API_ENDPOINT="https://your-minio-server.com"
STORAGE_PUBLIC_ENDPOINT="https://your-minio-server.com/your-bucket-name"Environment Variables
| Variable | Description |
|---|---|
NEXT_PUBLIC_STORAGE_ENABLED | Enable storage (true / false) |
STORAGE_PROVIDER | Storage provider (currently s3) |
STORAGE_ACCESS_KEY_ID | Access key ID |
STORAGE_SECRET_ACCESS_KEY | Secret access key |
STORAGE_BUCKET | Bucket name |
STORAGE_REGION | Region (e.g., us-east-1, auto for R2) |
STORAGE_API_ENDPOINT | S3 API endpoint URL |
STORAGE_PUBLIC_ENDPOINT | Public URL for accessing files |
CORS Configuration
For browser uploads, configure CORS on your bucket:
[
{
"AllowedOrigins": ["https://yourdomain.com"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE"],
"AllowedHeaders": ["*"],
"MaxAgeSeconds": 3600
}
]