# Storage (https://prood.com/docs/packages/storage)

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 [#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 [#configuration]

Set in root `.env.local` (see [Environment variables](/docs/run-locally/environment)):

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

## Related pages [#related-pages]

<Cards>
  <Card title="S3 / R2" href="/docs/packages/storage/s3" description="S3-compatible object storage." />
</Cards>
