Skip to main content

Parameter Reference

Quick reference for all available storage parameters:
ParameterDescription
STORAGE_REGIONS3 region
STORAGE_ACCESS_KEY_IDS3 access key ID
STORAGE_SECRET_ACCESS_KEYS3 secret access key
STORAGE_BUCKET_NAMES3 bucket name
STORAGE_ENDPOINTS3-compatible endpoint
STORAGE_PUBLIC_URLPublic URL for stored files
STORAGE_MAX_SOCKETSMaximum HTTP sockets
STORAGE_CONNECTION_TIMEOUTConnection timeout in ms
STORAGE_REQUEST_TIMEOUTRequest timeout in ms
STORAGE_SOCKET_TIMEOUTSocket timeout in ms
All STORAGE_* variables can also use the S3_* prefix (e.g., S3_REGION instead of STORAGE_REGION). Both formats are supported.

Local Mode (default)

Place your files in apps/api/public/

Cloud Mode

Openinary supports any S3-compatible storage provider with a universal configuration. No need to specify the provider - it’s automatically detected! Copy and configure:
cp apps/api/env.template apps/api/.env

Universal S3 Configuration

The configuration automatically detects your provider:
  • With STORAGE_ENDPOINT: S3-compatible provider (Cloudflare R2, Minio, DigitalOcean Spaces, Wasabi, etc.)
  • Without STORAGE_ENDPOINT: AWS S3 standard

AWS S3

STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=your_aws_access_key
STORAGE_SECRET_ACCESS_KEY=your_aws_secret_key
STORAGE_BUCKET_NAME=your-bucket-name
STORAGE_PUBLIC_URL=https://your-bucket-name.s3.us-east-1.amazonaws.com

Cloudflare R2

STORAGE_REGION=auto
STORAGE_ACCESS_KEY_ID=your_r2_access_key
STORAGE_SECRET_ACCESS_KEY=your_r2_secret_key
STORAGE_BUCKET_NAME=your-bucket-name
STORAGE_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com
STORAGE_PUBLIC_URL=https://your-custom-domain.com

Other S3-Compatible Providers

Works with Minio, DigitalOcean Spaces, Wasabi, Backblaze B2, and any other S3-compatible service:
STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=your_access_key
STORAGE_SECRET_ACCESS_KEY=your_secret_key
STORAGE_BUCKET_NAME=your-bucket-name
STORAGE_ENDPOINT=https://your-s3-compatible-endpoint.com
STORAGE_PUBLIC_URL=https://your-cdn-domain.com
Key difference: Set STORAGE_ENDPOINT for any non-AWS S3-compatible provider. For AWS S3, leave it empty.

Core Parameters

STORAGE_REGION
string
Set the S3 region for your storage provider.Examples:
  • us-east-1 - AWS US East (N. Virginia)
  • eu-west-1 - AWS Europe (Ireland)
  • auto - Automatic region detection (Cloudflare R2)
Alternative: S3_REGION
STORAGE_ACCESS_KEY_ID
string
required
S3 access key ID for authentication.Examples:
  • AKIAIOSFODNN7EXAMPLE - AWS access key format
  • your_r2_access_key - Cloudflare R2 access key
Alternative: S3_ACCESS_KEY_ID
Keep this key secure. Never commit it to version control.
STORAGE_SECRET_ACCESS_KEY
string
required
S3 secret access key for authentication.Examples:
  • wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY - AWS secret key format
  • your_r2_secret_key - Cloudflare R2 secret key
Alternative: S3_SECRET_ACCESS_KEY
This is highly sensitive. Store securely and never expose in logs or client-side code.
STORAGE_BUCKET_NAME
string
required
Name of the S3 bucket where files will be stored.Examples:
  • my-openinary-bucket - Standard bucket name
  • cdn-assets - CDN bucket
  • media-storage - Media files bucket
Alternative: S3_BUCKET_NAME
Bucket names must be globally unique and follow S3 naming conventions.
STORAGE_ENDPOINT
string
Custom S3-compatible endpoint URL.When to use:
  • Cloudflare R2: https://your-account-id.r2.cloudflarestorage.com
  • MinIO: http://minio.example.com:9000
  • DigitalOcean Spaces: https://nyc3.digitaloceanspaces.com
  • Wasabi: https://s3.wasabisys.com
When to omit:
  • AWS S3 (uses default AWS endpoints)
Alternative: S3_ENDPOINT
Leave empty for standard AWS S3. Required for all S3-compatible providers.
STORAGE_PUBLIC_URL
string
Custom public URL for accessing stored files.Use cases:
  • CDN URL: https://cdn.example.com
  • Custom domain: https://assets.example.com
  • Cloudflare R2 custom domain: https://r2.example.com
Examples:
  • https://cdn.example.com - CDN endpoint
  • https://your-bucket-name.s3.us-east-1.amazonaws.com - AWS S3 public URL
If not set, uses the default S3 endpoint URL. Set this when using a CDN or custom domain.

Advanced Parameters

STORAGE_MAX_SOCKETS
integer
default:"50"
Maximum number of simultaneous HTTP sockets for S3 connections.Examples:
  • 50 - Default (good for most use cases)
  • 100 - Higher concurrency for high-traffic scenarios
  • 25 - Lower concurrency for resource-constrained environments
Increase this value if you’re experiencing connection pool exhaustion during high load.
STORAGE_CONNECTION_TIMEOUT
integer
default:"0"
Connection timeout in milliseconds. Set to 0 for no timeout.Examples:
  • 0 - No timeout (default)
  • 5000 - 5 seconds
  • 10000 - 10 seconds
A value of 0 means the connection will wait indefinitely. Set a timeout for better error handling in production.
STORAGE_REQUEST_TIMEOUT
integer
default:"0"
Request timeout in milliseconds. Set to 0 for no timeout.Examples:
  • 0 - No timeout (default)
  • 30000 - 30 seconds
  • 60000 - 60 seconds
For large file uploads, consider setting a higher timeout (e.g., 300000 for 5 minutes).
STORAGE_SOCKET_TIMEOUT
integer
default:"0"
Socket timeout in milliseconds. Set to 0 for no timeout.Examples:
  • 0 - No timeout (default)
  • 60000 - 60 seconds
  • 120000 - 2 minutes
Socket timeout applies to the underlying TCP socket connection, not individual requests.

Configuration Examples

STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
STORAGE_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
STORAGE_BUCKET_NAME=my-openinary-bucket
STORAGE_PUBLIC_URL=https://my-openinary-bucket.s3.us-east-1.amazonaws.com
Standard AWS S3 configuration. No STORAGE_ENDPOINT needed.

Best Practices

Use S3-compatible storage

Leverage any S3-compatible provider for flexibility and cost optimization.

Set appropriate timeouts

Configure timeouts based on your file sizes and network conditions.