Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_nearby-friends

Nearby friends (WebSocket gateways, publish-subscribe fan-out, cell-filtered location cache)

14 COMPONENTS · 13 FLOWS · UPDATED 2026-11-21
GITHUB README / PR PREVIEW CARD
[![Nearby friends (WebSocket gateways, publish-subscribe fan-out, cell-filtered location cache) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_nearby-friends/opengraph-image)](https://archos.sageideas.dev/d/dgm_nearby-friends)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_nearby-friends)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_nearby-friends" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Nearby friends (WebSocket gateways, publish-subscribe fan-out, cell-filtered location cache) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0[("Mobile Client")]
  friend_1[("Friend Client")]
  gw_2["API gateway"]
  pdp_3["Policy decision point (PDP)"]
  secrets_4[("Secrets manager")]
  svc_5["Resource server"]
  cache_6[("Distributed cache")]
  pubsub_7[("Publish-subscribe")]
  svc2_8["Resource server"]
  gw2_9["API gateway"]
  dlq_10[("Dead-letter queue (DLQ)")]
  tsdb_11[("Time-series database (TSDB)")]
  alerting_12[("Alerting")]
  capacity_13["Capacity Estimate"]
  client_0 -->|"1. Sends with JWT · WebSocket"| gw_2
  gw_2 -->|"2. Forwards (mTLS) · HTTP/2"| svc_5
  svc_5 -->|"3a. Saves location · TCP"| cache_6
  svc_5 -.->|"3b. Publishes update · TCP"| pubsub_7
  pubsub_7 -.->|"4a. Delivers · TCP"| svc2_8
  pubsub_7 -.->|"4b. Parks failed deliveries · TCP"| dlq_10
  svc2_8 -->|"Reads locations · TCP"| cache_6
  svc2_8 -->|"5. Hands friend (mTLS) · HTTP/2"| gw2_9
  gw2_9 -.->|"6. Pushes · WebSocket"| friend_1
  gw_2 -->|"Asks, fails closed · HTTPS"| pdp_3
  tsdb_11 -->|"Scrapes dead-letter depth · HTTPS"| dlq_10
  tsdb_11 -->|"Feeds alerts · HTTP"| alerting_12
  secrets_4 -->|"Supplies credentials · HTTPS"| gw2_9

COMPONENT STACK (13)

  • Mobile ClientSTATEFUL
    Sends its location every 30 s
  • Friend ClientSTATEFUL
    Receives nearby friends as they move
  • API gatewaySTATELESS
    Keeps the sender connection, checks the JWT
  • Policy decision point (PDP)STATELESS
    Allows only the user to post own location
  • Secrets managerSTATEFUL
    Holds TLS certificates for the friend gateway
  • Resource serverSTATELESS
    Location service: computes the cell
  • Distributed cacheSTATEFUL
    Latest location and cell id; expires by TTL
  • Publish-subscribeSTATEFUL
    Topic per user, at-least-once
  • Resource serverSTATELESS
    Nearby service: cell check, then distance
  • API gatewaySTATELESS
    Keeps the friend connection and pushes
  • Dead-letter queue (DLQ)STATEFUL
    Parks failed updates
  • Time-series database (TSDB)STATEFUL
    Stores dead-letter depth over time
  • AlertingSTATEFUL
    Pages on-call when dead letters grow

REQUEST & DATA FLOW (13)

  1. Mobile Client → API gateway (Sends with JWT)[WebSocket]
  2. API gateway → Resource server (Forwards (mTLS))[HTTP/2]
  3. Resource server → Distributed cache (Saves location)[TCP]
  4. Resource server → Publish-subscribe (Publishes update)[TCP]
  5. Publish-subscribe → Resource server (Delivers)[TCP]
  6. Publish-subscribe → Dead-letter queue (DLQ) (Parks failed deliveries)[TCP]
  7. Resource server → Distributed cache (Reads locations)[TCP]
  8. Resource server → API gateway (Hands friend (mTLS))[HTTP/2]
  9. API gateway → Friend Client (Pushes)[WebSocket]
  10. API gateway → Policy decision point (PDP) (Asks, fails closed)[HTTPS]
  11. Time-series database (TSDB) → Dead-letter queue (DLQ) (Scrapes dead-letter depth)[HTTPS]
  12. Time-series database (TSDB) → Alerting (Feeds alerts)[HTTP]
  13. Secrets manager → API gateway (Supplies credentials)[HTTPS]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →