Storage Configuration
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Overview
Section titled “Overview”Rebase supports two storage backends:
- Local filesystem — Files stored on disk (great for development)
- S3-compatible — AWS S3, MinIO, Cloudflare R2, DigitalOcean Spaces
Configuration
Section titled “Configuration”Storage is configured in the storage block of initializeRebaseBackend:
Local Storage
Section titled “Local Storage”const backend = await initializeRebaseBackend({ // ... storage: { type: "local", basePath: "./uploads" // Directory for file storage }});S3 Storage
Section titled “S3 Storage”const backend = await initializeRebaseBackend({ // ... storage: { type: "s3", bucket: env.S3_BUCKET!, region: env.S3_REGION || "auto", accessKeyId: env.S3_ACCESS_KEY_ID || "", secretAccessKey: env.S3_SECRET_ACCESS_KEY || "", endpoint: env.S3_ENDPOINT, // For MinIO, R2, etc. forcePathStyle: env.S3_FORCE_PATH_STYLE // Required for MinIO }});Multiple Storage Backends
Section titled “Multiple Storage Backends”You can configure multiple named backends and route different fields to different storage:
storage: { "(default)": { type: "local", basePath: "./uploads" }, "media": { type: "s3", bucket: "media-bucket", region: "us-east-1", ... }}Then in your collection properties, reference a specific backend:
image: { type: "string", name: "Image", storage: { storagePath: "products", backend: "media" // Routes to the "media" S3 backend }}Storage Endpoints
Section titled “Storage Endpoints”| Method | Path | Description |
|---|---|---|
POST | /api/storage/upload | Upload a file |
GET | /api/storage/files/:path | Download/serve a file |
DELETE | /api/storage/files/:path | Delete a file |
Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
STORAGE_TYPE | "local" or "s3" |
STORAGE_PATH | Local storage directory (default: ./uploads) |
S3_BUCKET | S3 bucket name |
S3_REGION | AWS region (default: "auto") |
S3_ACCESS_KEY_ID | AWS access key |
S3_SECRET_ACCESS_KEY | AWS secret key |
S3_ENDPOINT | Custom S3 endpoint (for MinIO, R2) |
S3_FORCE_PATH_STYLE | Use path-style URLs (required for MinIO) |
Production Tips
Section titled “Production Tips”- Mount a persistent volume if using local storage on Docker/Kubernetes
- Use S3 or compatible (R2, MinIO) for production deployments
- Configure a CDN (CloudFront, Cloudflare) in front of your S3 bucket for performance
Next Steps
Section titled “Next Steps”- Frontend Storage & File Uploads — File upload fields and hooks
- Properties — Storage property configuration