API: POST /shorten(longUrl), GET /{code}. Store mapping code->longUrl with createdAt and optional expiry. Generate codes with a monotonically increasing ID + base62. Cache hot mappings in Redis. Use redirects (301/302). For scale: partition by code prefix, add read replicas, and run analytics asynchronously.
API: POST /shorten(longUrl), GET /{code}. Store mapping code->longUrl with createdAt and optional expiry. Generate codes with a monotonically increasing ID + base62. Cache hot mappings in Redis. Use redirects (301/302). For scale: partition by code prefix, add read replicas, and run analytics asynchronously.