PackagesStorage

Storage

File storage for merchant assets, on Cloudflare R2. Nothing in the dashboard uploads through it yet.

Prood stores files in Cloudflare R2 through @prood/storage-s3, which implements the StorageProvider interface from @prood/types. Public files are served by the prood-media Worker in infra/cloudflare/media-worker.

Tenant namespacing

No app calls uploadForTenant() yet: uploading product photos in the dashboard is coming later.

Every upload uses tenant-prefixed keys so merchants cannot collide with each other:

ts
import { uploadForTenant } from '@prood/commerce'

await uploadForTenant(orgId, {
  file: buffer,
  filename: 'hero.jpg',
  contentType: 'image/jpeg',
  directory: `products/${productId}`,
})
// key: org/{orgId}/products/{productId}/...

Configuration

Set in root .env.local (see Environment variables):

  • The S3_* variables. The key is scoped to the prood-public bucket only.