Skip to content

feat: Add Discord network status integration + fix CDN caching#1

Merged
cj-vana merged 3 commits intomainfrom
feature/discord-integration-and-cache-fix
Jan 1, 2026
Merged

feat: Add Discord network status integration + fix CDN caching#1
cj-vana merged 3 commits intomainfrom
feature/discord-integration-and-cache-fix

Conversation

@cj-vana
Copy link
Contributor

@cj-vana cj-vana commented Jan 1, 2026

Summary

  • Discord Integration: Push network health updates to Discord channel via webhook

    • Scheduled summaries every 6 hours with full network metrics
    • Immediate alerts on status changes (healthy↔degraded↔offline)
    • Alerts on 15+ point score drops or 2+ nodes going offline
    • Rate-limited API with Bearer token authentication
  • CDN Cache Fix: Resolve stale data issues on production

    • Add no-store headers for Cloudflare and Netlify CDN layers
    • Force dynamic rendering on /api/health, /api/stats, /api/nodes
    • Prevents cached data from being served for real-time metrics

New Files

  • src/lib/discord.ts - Webhook utilities and embed builders
  • src/app/api/discord-webhook/route.ts - API endpoint for Discord posts
  • netlify/functions/discord-scheduled.ts - 6-hour cron for summaries
  • netlify/functions/discord-status-check.ts - 5-min cron for alerts

Environment Variables Required

DISCORD_WEBHOOK_URL=<webhook URL>
DISCORD_WEBHOOK_SECRET=<secret for auth>

Test plan

  • Tested Discord webhook integration locally - messages appear correctly
  • Verified health API returns fresh data with recency score of 10
  • Verify cache headers work on production after deploy
  • Verify scheduled functions trigger on Netlify

🤖 Generated with Claude Code

Discord Integration:
- Add Discord webhook API route with Bearer auth and rate limiting
- Create embed builders for health summaries and status change alerts
- Add Netlify scheduled functions (6h summary, 5min status check)
- Track network status state in DB for change detection
- Alert on status changes, 15+ point score drops, 2+ node outages

CDN Cache Fix:
- Disable caching on /api/health, /api/stats, /api/nodes
- Add no-store headers for Cloudflare and Netlify
- Force dynamic rendering to prevent stale data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Jan 1, 2026

Deploy Preview for denvermc ready!

Name Link
🔨 Latest commit e5ad24f
🔍 Latest deploy log https://app.netlify.com/projects/denvermc/deploys/6956d77e6eee900008cacaac
😎 Deploy Preview https://deploy-preview-1--denvermc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

cj-vana and others added 2 commits January 1, 2026 13:19
Next.js 16 built-in global-error fails during prerendering.
Custom client component avoids useContext issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Netlify Next.js cache was restoring stale build artifacts causing
the global-error prerender failure. Now explicitly clearing .next
before each build and using NODE_ENV=production consistently.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cj-vana cj-vana merged commit 81fa110 into main Jan 1, 2026
6 checks passed
@cj-vana cj-vana deleted the feature/discord-integration-and-cache-fix branch January 1, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant