Summary
Pull real bot statistics from Discord and display them on the public homepage. Stats should be cached in Redis to avoid hammering the Discord API on every page load.
Metrics to Display
- Server count — number of guilds the bot is in
- Total members — aggregate member count across all guilds
- Commands served — total slash command invocations (tracked in DB)
- Active conversations — current AI conversation count
- Uptime — bot process uptime
- Messages processed — total messages handled
Implementation
Backend (/api/public/stats)
- New public endpoint (no auth required, rate-limited)
- Collect stats from Discord client (
client.guilds.cache.size, member counts, etc.)
- Query DB for command usage, message counts
- Cache results in Redis with configurable TTL (default: 5 minutes)
- Return JSON payload with all metrics +
cachedAt timestamp
Frontend (Homepage)
- Animated counter components for each stat
- Auto-refresh on an interval (e.g., every 60s)
- Graceful fallback if API is unavailable (show last known or placeholder)
- Mobile-responsive grid layout
Redis Caching
- Key:
bot:stats:public
- TTL: 300s (5 min) — configurable via
config.stats.cacheTtlSeconds
- Invalidate on significant events (guild join/leave) or let TTL expire naturally
Acceptance Criteria
Closes #(self)
Summary
Pull real bot statistics from Discord and display them on the public homepage. Stats should be cached in Redis to avoid hammering the Discord API on every page load.
Metrics to Display
Implementation
Backend (
/api/public/stats)client.guilds.cache.size, member counts, etc.)cachedAttimestampFrontend (Homepage)
Redis Caching
bot:stats:publicconfig.stats.cacheTtlSecondsAcceptance Criteria
/api/public/statsreturns server count, member count, uptime, and at least 2 other metricsCloses #(self)