Laravel URL Shortener
The project includes short URL creation, redirects, a visit event and a click-count listener. This makes it ideal for learning how a read-heavy Laravel system grows while keeping the redirect path fast.
1 user — direct lookup is perfect
1 APP SERVERLaravel job
Receives the short code, validates it, queries the indexed short_urls table and returns the redirect response.
No Redis yet
For one user, MySQL is already fast enough. Adding cache has little practical value.
Analytics
The visit event can update click counts after the redirect path so analytics does not become the critical response.
~100 users — cache repeated links
1–2 APP SERVERSWhy Redis?
If the same short links are requested repeatedly, Redis returns the destination from memory and removes repeated database reads.
Why two Laravel servers?
Only if one instance is saturated or you want redundancy. Both servers must use shared Redis/session state rather than local-only cache.
Invalidation
When a destination changes or a link is disabled, remove/update the Redis key so cache and database remain consistent.
~1 million users — distributed redirect tier
4–10 APP SERVERS*Critical path
Most redirects should terminate at Redis. MySQL becomes the source of truth and fallback instead of serving every request.
Read replicas
Admin dashboards and historical reporting can use replicas while link creation/edit operations remain on the primary.
Analytics
Buffer click events and aggregate them asynchronously instead of incrementing a database row on every redirect.
~10 million users — edge first
15–40+ ORIGIN APP SERVERS*Why edge caching?
Popular redirects can be answered near the user without reaching your Laravel servers at all, dramatically reducing origin traffic and latency.
Origin fleet
Laravel still handles uncached redirects, link creation, authentication and admin operations. App count depends on edge hit ratio and peak requests per second.
Data partitioning
Partition by short-code hash/range only when storage size or write/query throughput proves that a single primary design is no longer enough.
*Server count is a capacity example
A URL shortener can serve huge registered-user numbers with surprisingly few Laravel servers when edge and Redis cache hit rates are high. The important metric is redirects per second reaching the origin, not total accounts.