.env
file in the ImageFlow project root. If you don’t have a .env
yet, copy from .env.example
first.
Copy
cp .env.example .env
.env
Copy
# === API key ===
# Set a strong and unique API key to protect upload and management APIs.
API_KEY=your_api_key_here
# === Storage configuration ===
# Choose the backend for storing images.
# Options: 'local' (local storage) or 's3' (S3-compatible storage, e.g., AWS S3, R2)
STORAGE_TYPE=local
# --- Local storage settings (when STORAGE_TYPE=local) ---
# Image storage path relative to the application root.
LOCAL_STORAGE_PATH=static/images
# --- S3 storage settings (when STORAGE_TYPE=s3) ---
# Required when STORAGE_TYPE is 's3'.
S3_ENDPOINT= # S3-compatible endpoint URL (e.g., s3.amazonaws.com)
S3_REGION= # Region of the S3 bucket (e.g., us-east-1)
S3_ACCESS_KEY= # S3 access key ID
S3_SECRET_KEY= # S3 secret access key
S3_BUCKET= # S3 bucket name to use
S3_USE_SSL=true # Whether S3 connection uses SSL/TLS (true/false)
CUSTOM_DOMAIN= # Custom domain for the S3 bucket
# === Redis configuration (optional) ===
# Enable Redis to improve performance for storing metadata and tags.
# If false, metadata will be stored as JSON files next to the images.
# Other stores may be supported in the future.
METADATA_STORE_TYPE=redis
# --- Redis connection (when REDIS is enabled) ---
REDIS_HOST=localhost # Redis host or IP
REDIS_PORT=6379 # Redis port
REDIS_PASSWORD= # Redis password (leave empty if none)
REDIS_DB=0 # Redis DB index
REDIS_TLS_ENABLED=false # Enable TLS/SSL for Redis (true/false)
# === Image processing configuration ===
# Max images allowed per upload request.
# WebP/AVIF conversion quality (1-100; higher = better quality, larger size).
# Number of worker threads.
# Range: 0-8; 0=slowest/highest quality, 8=fastest/lowest quality.
# Size of the concurrent worker pool.
MAX_UPLOAD_COUNT=20
IMAGE_QUALITY=75
WORKER_THREADS=4
SPEED=5
WORKER_POOL_SIZE=4
# Frontend configuration (only needed for a separated frontend)
# If you only want to export a static site, set the following to empty (must be set for separation)
NEXT_PUBLIC_API_URL=https://backend:8686
# Next.js Image component remote patterns (comma-separated)
# Examples:
# Single domain: example.com
# Multiple domains: example.com,cdn.example.com
# With protocol: https://example.com,http://cdn.example.com
# Typically include the backend domain and any S3 custom domain
NEXT_PUBLIC_REMOTE_PATTERNS=https://backend:8686,https://CUSTOM_DOMAIN
# Enable debug mode (`true|false`).
DEBUG_MODE=false