Get Platform Statistics
Retrieve live aggregate statistics for the entire platform.Endpoint
Authentication
This endpoint is public and does not require authentication.
Response
Total number of shortened URLs ever created on the platform (includes both anonymous and authenticated links).
Cumulative count of all redirect events across every short URL.
Global average redirect latency in milliseconds, rounded to one decimal place.Returns
null when no redirects have been recorded yet (avoids showing “0 ms” on fresh instances).Calculated using the Welford online algorithm for running averages without storing historical data.Response Headers
Status Codes
Statistics successfully retrieved.
Database error or service unavailable.
Example Response
- Active Platform
- Fresh Instance
- New Platform
Implementation Details
Latency Calculation
The average latency is calculated using the Welford online algorithm, which updates the mean incrementally without storing historical values:μₙ= new average after n measurementsμₙ₋₁= previous averagexₙ= new measurementn= total number of measurements
- Memory efficient: No need to store all historical latencies
- Computationally efficient: O(1) update time per redirect
- Numerically stable: Minimizes floating-point rounding errors
Caching Strategy
The endpoint includes aCache-Control: max-age=30, public header to:
- Reduce database load during traffic spikes
- Allow CDN/proxy caching for better performance
- Balance freshness with scalability
Database Queries
The stats are computed using optimized aggregate queries:Use Cases
Landing Page Footer
Display real-time platform metrics to build trust and showcase usage.
Status Dashboard
Monitor platform health and performance trends.
Marketing Analytics
Track growth metrics for business reporting.
Public API
Provide transparency to users about platform scale.
Performance Considerations
Real-Time UpdatesDue to the 30-second cache, statistics may be slightly delayed. For near real-time dashboards, consider:
- Reducing cache duration (at the cost of database load)
- Using WebSocket connections for live updates
- Implementing server-sent events (SSE) for streaming stats