▲ 4 points
back
2 comments
This is awesome. What were the hardest parts of porting it to Cloudflare?
Thanks! Hardest part was redesigning the data model.. GoatCounter does complex aggregations at query time, but D1's 10ms CPU limit means you have to pre-aggregate everything (hourly rollups, per-dimension stats tables). Session dedup was tricky too since Workers are stateless so I ended up using KV with IP+UA hash and 8hr TTL. The other annoyance is Pages doesn't support cron, so daily cleanup needs a separate Worker. Still some way to go implementing Zero Trust auth etc..