Architecture: Image Processing Pipeline
By Engineering Team•September 21, 2026•6 min read
This is the architecture behind the decision recorded in ADR-00001, satisfying the requirements in BRD-001 and SR-001.
Diagram

Components
| Component | Language / Runtime | Role |
|---|---|---|
media-access-service |
Rust (Axum) | Issues short-lived signed GCS URLs — upload and download — and never touches raw image bytes itself. |
| Staging Bucket / Asset Bucket | GCS | Staging holds a raw upload until it’s transcoded; Asset Bucket holds the derived WebP/AVIF variants served by the CDN. |
firebase-function |
Node.js (Firebase Cloud Functions) | Fires on GCS onObjectFinalized/onObjectDeleted storage events and republishes them as Pub/Sub messages — no HTTP surface, no Nginx gateway in front of it. |
content-processor |
Go | Consumes the upload event, transcodes into WebP/AVIF at 1.0x/2.0x/3.0x via a per-use-case strategy (multi-variant catalog image, single master logo, square avatar crop), uploads the derived assets, records the source→derived mapping in MongoDB, and fans the result back out. |
Pub/Sub — product-image-uploads |
GCP Pub/Sub | firebase-function → content-processor. One topic, one subscription — content-processor is its only consumer. |
Pub/Sub — product-image-processed / product-image-removed |
GCP Pub/Sub | content-processor → downstream domain services. One topic pair, four independent subscriptions, routed by transaction_name rather than by topic. |
| Downstream consumers | Go / Rust | product-catalog (product & variant images — the default, unprefixed subscription), shop-service (shop banners), tenant-service (tenant logos), user-secure-engine (customer avatars). Each owns its own subscription and can be added or removed without any change to content-processor. |
| CDN | — | Serves derived assets from the Asset Bucket via the signed download URLs media-access-service issues. |
End-to-end flow
- A client (seller uploading a product photo, an admin uploading a tenant logo, a shopper setting an avatar, etc.) asks the API Gateway for an upload slot.
media-access-serviceissues a short-lived, cryptographically signed GCS upload URL scoped to the Staging Bucket (FR-01). Signing credentials never leave this service (NFR-06).- The client
PUTs the raw image bytes directly to GCS using that URL — the API Gateway and every application service stay off the raw-binary path entirely (FR-02, NFR-01). firebase-function’s storage trigger fires ononObjectFinalizedfor the staging bucket and publishes an ingestion event onto theproduct-image-uploadsPub/Sub topic, carryingtenant_id/correlation_id/traceparentso the trace begun at the presigned-URL request continues unbroken (FR-03).content-processorconsumes the event, downloads the raw image, and picks the transcoding strategy for the use case it was uploaded for — a multi-density product/variant catalog image, a single master tenant logo, or a square avatar crop — producing WebP and AVIF at 1.0x/2.0x/3.0x (FR-04).content-processoruploads every derived variant to the Asset Bucket and writes the source-to-derived asset mapping to MongoDB (FR-05).content-processorpublishes a “processing complete” event toproduct-image-processed(orproduct-image-removedon delete), carrying the derived asset paths and the same tracing/tenant context (FR-06).product-catalog,shop-service,tenant-service, anduser-secure-engineeach hold their own subscription on that topic pair and independently update their own database models — none of them call each other, and none of them are known tocontent-processorby name (FR-07).- When any of those domain services later needs to render the image,
media-access-serviceissues a signed download URL for the specific asset, and the CDN serves it (FR-08).
Related Documents
- BRD-001 — Image Processing Pipeline
- SR-001 — Image Processing System Requirements
- ADR-00001 — Direct Upload, Event-Driven Pipeline
- Technical Debt — Image Pipeline Reliability Gaps — tracked retry/DLQ and CDN cache-policy gaps for this pipeline