Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_ad-click-aggregation

Ad Click Event Aggregation (event-time windows, effectively-once counts)

15 COMPONENTS · 14 FLOWS · UPDATED 2026-11-20
GITHUB README / PR PREVIEW CARD
[![Ad Click Event Aggregation (event-time windows, effectively-once counts) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_ad-click-aggregation/opengraph-image)](https://archos.sageideas.dev/d/dgm_ad-click-aggregation)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_ad-click-aggregation)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_ad-click-aggregation" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Ad Click Event Aggregation (event-time windows, effectively-once counts) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  viewer_0[("Ad viewer")]
  advertiser_1[("Advertiser")]
  gw_2["API gateway"]
  policy_3["Policy decision point (PDP)"]
  metrics_4[("Traces, metrics and logs")]
  alerting_5[("Alerting")]
  collector_6["Click collector"]
  kafka_7[("Event log")]
  proc_8[("Stream processing application")]
  store_9[("Curated layer")]
  lake_10[("Raw layer")]
  qsvc_11["Query service"]
  dlq_12[("Dead-letter queue (DLQ)")]
  secrets_13[("Secrets manager")]
  capacity_14["Capacity card"]
  viewer_0 -->|"1. Calls with JWT · HTTPS"| gw_2
  gw_2 -->|"2. Forwards (mTLS) · HTTP/2"| collector_6
  collector_6 -->|"3. Appends · TCP"| kafka_7
  kafka_7 -->|"4a. Consumes · TCP"| proc_8
  kafka_7 -->|"4b. Archives raw · TCP"| lake_10
  proc_8 -->|"5a. Upserts · HTTPS"| store_9
  proc_8 -->|"5b. Parks late events · TCP"| dlq_12
  store_9 -->|"6. Reads counts (SQL) · SQL"| qsvc_11
  qsvc_11 -->|"7. Returns counts (JWT) · HTTPS"| advertiser_1
  collector_6 -->|"Asks permission (mTLS) · gRPC"| policy_3
  secrets_13 -->|"Supplies credentials · HTTPS"| proc_8
  metrics_4 -->|"Scrapes metrics (HTTPS) · HTTPS"| proc_8
  metrics_4 -->|"Feeds alerts · HTTPS"| alerting_5
  qsvc_11 -->|"Asks permission (mTLS) · gRPC"| policy_3

COMPONENT STACK (15)

  • Ad viewerSTATEFUL
    Clicks an ad on a phone or browser
  • AdvertiserSTATEFUL
    Reads clicks per ad per minute
  • API gatewaySTATELESS
    Checks the JWT, stamps a trace id
  • Policy decision point (PDP)STATELESS
    Decides if this caller may report clicks
  • Traces, metrics and logsSTATEFUL
    Consumer lag, late events, window delay
  • AlertingSTATEFUL
    Pages on-call when lag or dead letters grow
  • Click collectorSTATELESS
    Validates, adds click id, writes to the log
  • Event logSTATEFUL
    Partitioned log keyed by ad id; replayable
  • Stream processing applicationSTATEFUL
    Counts per minute; drops repeat ids
  • Curated layerSTATEFUL
    Counts per ad per minute; upsert by key
  • Raw layerSTATEFUL
    Raw clicks kept for replay and audit
  • Query serviceSTATELESS
    Checks the JWT and PDP, then reads counts
  • Dead-letter queue (DLQ)STATEFUL
    Parks events too late or unreadable
  • Secrets managerSTATEFUL
    Holds the processor's credentials
  • Capacity cardSTATELESS
    Illustrative sizing for the drawn design

REQUEST & DATA FLOW (14)

  1. Ad viewer → API gateway (Calls with JWT)[HTTPS]
  2. API gateway → Click collector (Forwards (mTLS))[HTTP/2]
  3. Click collector → Event log (Appends)[TCP]
  4. Event log → Stream processing application (Consumes)[TCP]
  5. Event log → Raw layer (Archives raw)[TCP]
  6. Stream processing application → Curated layer (Upserts)[HTTPS]
  7. Stream processing application → Dead-letter queue (DLQ) (Parks late events)[TCP]
  8. Curated layer → Query service (Reads counts (SQL))[SQL]
  9. Query service → Advertiser (Returns counts (JWT))[HTTPS]
  10. Click collector → Policy decision point (PDP) (Asks permission (mTLS))[gRPC]
  11. Secrets manager → Stream processing application (Supplies credentials)[HTTPS]
  12. Traces, metrics and logs → Stream processing application (Scrapes metrics (HTTPS))[HTTPS]
  13. Traces, metrics and logs → Alerting (Feeds alerts)[HTTPS]
  14. Query service → Policy decision point (PDP) (Asks permission (mTLS))[gRPC]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →