---
id: catalog-blob
name: Catalog Blob Storage
version: 1.0.0
summary: Authoritative Azure Blob Storage container owned by the Catalog bounded context for binary book cover images and media assets.
owners:
  - catalog-experience-team
container_type: objectStore
badges:
  - content: Object Storage
    backgroundColor: teal
    textColor: teal
technology: azure-storage-account
authoritative: true
access_mode: readWrite
purpose: System of record for Catalog binary media assets, including book cover images.
classification: internal
retention: 10y
residency: eastasia
styles:
  icon: /icons/database/blob.svg
---

## Purpose & Ownership Boundary

Catalog Blob Storage (`catalog-blob`) is the authoritative object store owned exclusively by [[service|catalog-api]] in the Catalog bounded context for binary book cover images. Object storage keeps large binary payloads out of [[container|catalog-database]], which stores only permanent blob URNs (`books.image`) while [[service|catalog-api]] mints short-lived, read-only Shared Access Signature (SAS) URLs on demand.

## Data Store Profile

| Property                            | Value                                                                         |
| :---------------------------------- | :---------------------------------------------------------------------------- |
| **Bounded Context / Owner**         | Catalog — [[team\|catalog-experience-team]]                                   |
| **Engine / Technology**             | Azure Blob Storage (Azure Storage Account in cloud; Azurite emulator locally) |
| **Store Type**                      | Object Storage                                                                |
| **Primary Writer(s)**               | [[service\|catalog-api]]                                                      |
| **Primary Reader(s)**               | [[service\|catalog-api]] (SAS URL minting; clients fetch directly via SAS)    |
| **Authoritative / Source of Truth** | Yes                                                                           |
| **Data Classification**             | Internal                                                                      |
| **Retention / TTL Policy**          | 10 years (explicit delete on book/image removal; no automatic lifecycle TTL)  |

## Logical Data Layout & Key Patterns

| Container / Key Pattern                         | Stored Data                                                        | TTL / Eviction                                             | Invalidation / Update Trigger                                                             |
| :---------------------------------------------- | :----------------------------------------------------------------- | :--------------------------------------------------------- | :---------------------------------------------------------------------------------------- |
| `catalog-blob` / `{uuidv7}-{safeName}{safeExt}` | Binary book cover images (`image/jpeg`, `image/png`, `image/webp`) | `10y` retention; `1 hour` default read-only SAS URL expiry | Explicit deletion (including snapshots) on image replacement or [[entity\|book]] removal. |
| URN reference (`books.image` in `catalogdb`)    | `urn:{account}:catalog-blob:{blobName}`                            | Permanent until book/image is updated or deleted           | Validated on every read/delete to match target storage account and container.             |

## Consistency, Isolation & Security Guardrails

- **No public blob access:** Public container/blob access is disabled (`AllowBlobPublicAccess = false`); access requires Managed Identity RBAC (`StorageBlobDataContributor`) for [[service|catalog-api]] and HTTPS-only, read-only SAS URLs (User Delegation Keys in Azure, account-key SAS in local Azurite) for browser downloads.
- **Strict URN & overwrite protection:** Uploads enforce non-empty allowed image MIME types, sanitize filenames (`[a-zA-Z0-9._-]`, max 100 chars), and guard against accidental overwrites via `If-None-Match: *`. URN validation rejects path traversal (`/`, `\`, `..`) or cross-account mismatches.
- **No cross-store distributed transaction:** Because PostgreSQL and Blob Storage do not share a two-phase commit, a failed database transaction after upload can leave an unreferenced blob that requires periodic reconciliation against `books.image`.

:::warning
**Shared Storage Account Isolation:** `catalog-blob` shares the Azure Storage Account with [[container|chat-session-blob]] (`chatting-blob`) and Azure Functions host storage. Services must use container-scoped references—[[service|catalog-api]] must never access `chatting-blob`, and external services must never read `catalog-blob` directly or persist expiring SAS URLs.
:::

## Operational & Resilience Notes

<AccordionGroup>
	<Accordion title="Hosting, redundancy, and failure recovery">
		- **Local vs. Cloud:** Local development uses a persistent Azurite emulator with Azure Storage
		Explorer; cloud environments use Azure Storage Account with TLS 1.2 minimum (`StandardLrs` in
		Dev, `StandardZrs` in Staging, `StandardGzrs` in Production). - **Expired SAS (`403`):**
		Re-fetch the book from [[service|catalog-api]] to mint a fresh 1-hour SAS URL. -
		**Cross-environment URN mismatch:** Never copy `books.image` URNs across environments without
		migrating the corresponding blobs and updating the storage account segment.
	</Accordion>
</AccordionGroup>

## Architecture Visualizations

<NodeGraph />

<MermaidFileLoader file="mermaids/catalog-blob-diagram-1.mmd" />

## Related Documentation

- [[service|catalog-api]] — Owning service managing image uploads, URN persistence, and SAS minting.
- [[container|catalog-database]] — Relational store holding `books.image` URNs.
- [[container|chat-session-blob]] — Sibling container on the shared Azure Storage Account.
- [[adr|adr-005-blob-storage-for-book-images]] — Decision separating binary cover media from PostgreSQL.
- [[doc|operational/005-backup-restore-and-dr]] — Platform backup, restore, and disaster recovery runbook.
