Storage Service Configuration
Configure file storage providers
TinyShip stores files through one interface. config/storage.ts accepts oss, s3, or r2 (StorageProviderType in libs/storage). For gettinyship.dev, use Cloudflare R2 or Amazon S3. Aliyun OSS is the China option.
The upload demo is /upload.
Providers
| Provider | STORAGE_PROVIDER | When to use it |
|---|---|---|
| Cloudflare R2 | r2 | Default global choice. No egress fee. |
| Amazon S3 | s3 | When you already run on AWS. |
| Aliyun OSS | oss | Optional, China. The file default is oss if STORAGE_PROVIDER is unset. |
Tencent COS appears in the Chinese guide. It is not a provider in config/storage.ts, so this page does not list COS credentials.
All three implemented providers can upload, download, sign URLs, delete, check existence, read metadata, and list a prefix.
Environment variables
config/storage.ts reads R2_ACCOUNT_ID for R2. It does not fall back to CLOUDFLARE_ACCOUNT_ID. That name is for Cloudflare Email (config/email.ts).
Set STORAGE_PROVIDER to r2 or s3 on gettinyship.dev:
STORAGE_PROVIDER="r2" # r2 | s3 | oss
# Cloudflare R2
R2_ACCOUNT_ID="your-cloudflare-account-id"
R2_ACCESS_KEY_ID="your-r2-access-key-id"
R2_ACCESS_KEY_SECRET="your-r2-access-key-secret"
R2_BUCKET="your-bucket-name"
# Amazon S3
S3_REGION="us-east-1"
S3_ACCESS_KEY_ID="your-s3-access-key-id"
S3_ACCESS_KEY_SECRET="your-s3-access-key-secret"
S3_BUCKET="your-bucket-name"
S3_ENDPOINT="" # optional, for S3-compatible endpoints
S3_FORCE_PATH_STYLE="false" # optionalAliyun OSS (China, optional)
OSS reuses ALIYUN_ACCESS_KEY_ID and ALIYUN_ACCESS_KEY_SECRET when the OSS_* key pair is unset.
STORAGE_PROVIDER="oss"
OSS_REGION="oss-cn-shanghai"
# OSS_ACCESS_KEY_ID="your-oss-access-key-id" # optional
# OSS_ACCESS_KEY_SECRET="your-oss-access-key-secret" # optional
OSS_BUCKET="your-bucket-name"
OSS_ENDPOINT="oss-cn-shanghai.aliyuncs.com" # optionalSigned URL lifetime defaults to 3600 seconds for R2 and S3, and 60 seconds for OSS (defaultExpiration in config/storage.ts).