Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_url-shortener

URL Shortener (read-heavy key-value design)

13 COMPONENTS · 16 FLOWS · UPDATED 2026-11-19
GITHUB README / PR PREVIEW CARD
[![URL Shortener (read-heavy key-value design) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_url-shortener/opengraph-image)](https://archos.sageideas.dev/d/dgm_url-shortener)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_url-shortener)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_url-shortener" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="URL Shortener (read-heavy key-value design) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  creator_0[("Link Creator")]
  visitor_1[("Link Visitor")]
  lb_2["Layer 7 load balancer"]
  shorten_3["Shorten service"]
  redirect_4["Redirect service"]
  idgen_5[("Unique ID generator")]
  db_6[("System of record")]
  cache_7[("Distributed cache")]
  queue_8[("Message queue")]
  consumer_9["Idempotent consumer"]
  rollup_10[("Analytics rollup store")]
  telemetry_11[("Traces, metrics and logs")]
  capacity_12["Capacity estimate"]
  creator_0 -->|"1a. Submits long URL (REST) · HTTPS"| lb_2
  visitor_1 -->|"1b. Opens short link · HTTPS"| lb_2
  lb_2 -->|"2a. Create request · HTTP/2"| shorten_3
  lb_2 -->|"2b. Follow request · HTTP/2"| redirect_4
  shorten_3 -->|"3a. Stores short code · SQL"| db_6
  shorten_3 -->|"3b. Short link · HTTP/2"| lb_2
  redirect_4 -->|"3c. Looks up link · RESP"| cache_7
  redirect_4 -->|"3d. Reads leader on miss · SQL"| db_6
  redirect_4 -->|"3e. Redirect · HTTP/2"| lb_2
  redirect_4 -.->|"3f. Publishes click event · AMQP"| queue_8
  lb_2 -->|"4a. Relays short link (REST) · HTTPS"| creator_0
  lb_2 -->|"4b. Sends 302 redirect · HTTPS"| visitor_1
  queue_8 -.->|"4c. Delivers events · AMQP"| consumer_9
  consumer_9 -->|"5. Counts clicks · SQL"| rollup_10
  shorten_3 -->|"Requests id block · RPC"| idgen_5
  lb_2 -->|"Exports (OTLP) · OTLP"| telemetry_11

COMPONENT STACK (12)

  • Link CreatorSTATEFUL
    Submits a long URL to shorten
  • Link VisitorSTATEFUL
    Opens a short link in a browser
  • Layer 7 load balancerSTATELESS
    Routes create and follow requests by path
  • Shorten serviceSTATELESS
    Builds short codes from leased ids
  • Redirect serviceSTATELESS
    Looks up a link and sends the redirect
  • Unique ID generatorSTATEFUL
    Hands out id blocks from one durable counter
  • System of recordSTATEFUL
    Stores every short code and its long URL
  • Distributed cacheSTATEFUL
    Keeps hot links in memory (cache-aside)
  • Message queueSTATEFUL
    Buffers click events off the redirect path
  • Idempotent consumerSTATELESS
    Skips repeated click ids, then counts the click
  • Analytics rollup storeSTATEFUL
    Counts clicks per link and hour (rollup rows)
  • Traces, metrics and logsSTATEFUL
    Request rate, latency and error rate

REQUEST & DATA FLOW (16)

  1. Link Creator → Layer 7 load balancer (Submits long URL (REST))[HTTPS]
  2. Link Visitor → Layer 7 load balancer (Opens short link)[HTTPS]
  3. Layer 7 load balancer → Shorten service (Create request)[HTTP/2]
  4. Layer 7 load balancer → Redirect service (Follow request)[HTTP/2]
  5. Shorten service → System of record (Stores short code)[SQL]
  6. Shorten service → Layer 7 load balancer (Short link)[HTTP/2]
  7. Redirect service → Distributed cache (Looks up link)[RESP]
  8. Redirect service → System of record (Reads leader on miss)[SQL]
  9. Redirect service → Layer 7 load balancer (Redirect)[HTTP/2]
  10. Redirect service → Message queue (Publishes click event)[AMQP]
  11. Layer 7 load balancer → Link Creator (Relays short link (REST))[HTTPS]
  12. Layer 7 load balancer → Link Visitor (Sends 302 redirect)[HTTPS]
  13. Message queue → Idempotent consumer (Delivers events)[AMQP]
  14. Idempotent consumer → Analytics rollup store (Counts clicks)[SQL]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →