Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Architecting for 10k users on Cloudflare's free tier (github.com/0xrelogic)
2 points by 0xrelogic 6 months ago | hide | past | favorite
I architected a GitHub streak notification service that scales to 10,000+ users while staying on free tiers. Here's the infrastructure design and cost optimization strategy.

Production: https://streakyy.vercel.app GitHub: https://github.com/0xReLogic/Streaky Architecture: Open source, MIT license

=== Architecture Overview ===

Challenge: Build a daily cron system that processes 10k+ users in parallel, sends Discord/Telegram notifications, stays within Cloudflare free tier limits, maintains 99.9% uptime, and costs $0/month.

Solution: Distributed queue system with Service Bindings + Rust proxy for IP isolation

=== Infrastructure Design ===

1. Distributed Processing (Cloudflare Workers)

Problem: Sequential processing doesn't scale. Single Worker has 30s CPU limit.

Solution: Fan-out architecture with Service Bindings - Main scheduler initializes batch queue - Dispatches N workers via env.SELF.fetch() - Each worker = isolated execution context with fresh CPU budget - Automatic load balancing by Cloudflare

Capacity: 100k requests/day (10k users = 10% utilization) Performance: 10 users in ~10 seconds, linear scalability

2. Queue Management (Cloudflare D1)

D1 SQLite with atomic operations for distributed queue without external dependencies.

Benefits: Atomic claim, no race conditions, built-in idempotency Capacity: 50k writes/day (30k used = 60% utilization)

3. IP Isolation Layer (Rust VPS)

Problem: Cloudflare Workers share IP pools → rate limiting (429 errors)

Solution: Lightweight Rust proxy on Koyeb - Axum framework - AES-256-GCM encryption - Stateless, zero-trust architecture - Cold start ~10s, warm ~3.6s - 100% success rate

Cost: Koyeb free tier (512MB RAM) - $0/month

4. Data Layer (Cloudflare D1)

Schema: users, notifications, cron_queue Capacity: 5GB storage (10MB used = 0.2%)

=== Cost Analysis ===

Current (10k users): $0/month - Cloudflare Workers: 10k/100k req/day - D1: 30k/50k writes/day - Koyeb: ~1GB/100GB bandwidth - Vercel: ~5GB/100GB bandwidth

50k users: $10/month ($0.0002/user) - D1: $5/month, Koyeb: $5/month

100k users: $25/month ($0.00025/user) - Workers: $5, D1: $10, Koyeb: $10

Total Cost: $0/month for 10k users

Happy to discuss infrastructure decisions, scaling strategies, or cost optimization techniques.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: