Create and store a short link
A signed-in owner sends the long URL, optional alias and optional expiry. The create service validates the URL shape, asks the abuse checker for a quick decision, chooses or claims a code, writes the durable link record and warms the cache. If the cache warm fails, the link still exists: the first redirect falls back to the store and fills the cache then.
- The client calls
POST /v1/through the API gateway with owner auth.links - The create service validates the destination and runs a quick abuse lookup.
- Generated codes come from the chosen code scheme; custom aliases go straight to the duplicate-refusing write.
- The link store writes one row keyed by
code, then optionally warms the cache and returns the short URL.
Diagram as text
Components: Owner app (Client); API gateway (API gateway); Create service (Service); Fast abuse lookup (External API); Code source (Service); Links store (NoSQL DB); Cache warm (Cache). Connections: Owner app → API gateway (POST /v1/links); API gateway → Create service; Create service → Fast abuse lookup (check); Create service → Code source (candidate); Create service → Links store (conditional write); Create service → Cache warm (optional warm), asynchronous.
Read:Learn: API contract designLearn: Storage choice justification
Check yourself
If cache warming fails after the store write succeeds, is the link broken?
Show answerHide answer
No. The store is the source of truth. A later redirect misses the cache, reads the store, fills the cache and then redirects.