Features Pricing Testimonials FAQ Blog
Log in Get Started Free
Back to Blog

Why We Built CloudTodo on Cloudflare

Why We Built CloudTodo on Cloudflare

When we set out to build CloudTodo, we had a clear vision: create the fastest, most reliable todo app in the world. Here’s why we chose Cloudflare’s edge platform to make that vision a reality.

The Challenge

Traditional web applications face several fundamental challenges:

  • Latency: Users far from servers experience slow load times
  • Downtime: Single points of failure can take entire apps offline
  • Scalability: Traffic spikes can overwhelm infrastructure
  • Complexity: Managing servers, databases, and deployments is time-consuming

We needed a solution that addressed all of these without compromising on developer experience.

Enter Cloudflare’s Edge Platform

Cloudflare’s global network spans 275+ cities in over 100 countries. By deploying CloudTodo on this network, we achieved something remarkable.

Lightning-Fast Performance

Every request is handled by the data center closest to the user:

Traditional Server:
User (Tokyo) → Server (US-East) → 150ms latency

Cloudflare Edge:
User (Tokyo) → Edge (Tokyo) → 15ms latency

That’s a 10x improvement in response time!

Our Technology Stack

Here’s what powers CloudTodo:

Frontend: Astro 5

We chose Astro for its:

  • Performance-first approach: Ships minimal JavaScript
  • Island architecture: Interactive components only where needed
  • Developer experience: Intuitive and fast to build with
  • SSG + SSR: Best of both worlds

Backend: Hono + Cloudflare Workers

Our API runs on Cloudflare Workers:

  • Zero cold starts: Workers are always warm and ready
  • Automatic scaling: Handles 1 or 1 million requests seamlessly
  • Cost-effective: Pay only for what you use
  • Simple deployment: Push to git, deploy to the edge

Database: Cloudflare D1

D1 is Cloudflare’s distributed SQLite database:

  • Blazing fast: Read replicas at every edge location
  • Familiar: Standard SQL syntax
  • Reliable: Built-in backups and point-in-time recovery
  • Affordable: Generous free tier

ORM: Drizzle

For database interactions, we use Drizzle:

// Type-safe database queries
const todos = await db
  .select()
  .from(todosTable)
  .where(eq(todosTable.userId, userId))
  .orderBy(desc(todosTable.createdAt));

Benefits:

  • Type safety: Catch errors at compile time
  • Performance: Optimized SQL generation
  • Developer experience: Intuitive API
  • Lightweight: Minimal runtime overhead

Real-World Performance

Let’s talk numbers. Here’s how CloudTodo performs globally:

MetricResult
Average Response Time45ms
P95 Response Time120ms
P99 Response Time250ms
Uptime (Last 90 Days)99.98%
Time to First Byte28ms

These aren’t theoretical benchmarks—this is real production data from thousands of users worldwide.

The Developer Experience

Building on Cloudflare isn’t just about performance—it’s about productivity:

Local Development

# Start the entire stack locally
npm run dev

# Frontend: Astro dev server
# Backend: Wrangler (Workers) dev server
# Database: Local D1 instance

Everything runs locally with hot reload. No Docker, no complex setup.

Deployment

# Deploy to production
npm run deploy

# That's it. Your app is now on 275+ edge locations.

From git push to global deployment in under 60 seconds.

Cost Efficiency

Let’s compare hosting costs for 100,000 active users:

Traditional Stack (AWS/GCP):

  • Application servers: ~$500/month
  • Database: ~$300/month
  • CDN: ~$200/month
  • Total: ~$1,000/month

Cloudflare Stack:

  • Workers: ~$5/month
  • D1: ~$5/month
  • Pages: $0 (free tier)
  • Total: ~$10/month

That’s a 99% cost reduction without sacrificing performance or reliability.

Security & Compliance

Cloudflare provides enterprise-grade security out of the box:

  • DDoS Protection: Automatic mitigation of attacks
  • WAF: Web application firewall included
  • SSL/TLS: End-to-end encryption
  • GDPR Compliant: Data residency controls
  • SOC 2 Type II: Certified infrastructure

Challenges We Solved

It wasn’t all smooth sailing. Here are some challenges we overcame:

1. Database Migrations

Problem: D1 doesn’t have native migration tools.

Solution: We use Drizzle Kit for schema management:

# Generate migration
npm run db:generate

# Apply to production
npm run db:migrate:prod

2. Session Management

Problem: Workers don’t have traditional session storage.

Solution: Hybrid approach with JWT + D1:

  • Access tokens (JWT): Short-lived, verified at edge
  • Refresh tokens: Stored in D1 with rotation

3. File Uploads

Problem: No local filesystem in Workers.

Solution: Direct upload to R2 (Cloudflare’s S3-compatible storage):

// Generate pre-signed URL
const uploadUrl = await generateUploadUrl(fileKey);

// Client uploads directly to R2
await fetch(uploadUrl, { method: 'PUT', body: file });

Future Plans

We’re excited about upcoming Cloudflare features:

  • Durable Objects: For real-time collaboration
  • Vectorize: For AI-powered task suggestions
  • Hyperdrive: For even faster database queries
  • Queue: For background job processing

Lessons Learned

After building on Cloudflare for 6 months, here’s what we learned:

  1. Embrace serverless: Don’t fight the stateless nature—design for it
  2. Think globally: Test from multiple regions, not just localhost
  3. Monitor edge metrics: Traditional APM tools don’t capture edge performance
  4. Cache aggressively: The edge is fast, but the cache is faster
  5. Read the docs: Cloudflare’s documentation is excellent—use it

Should You Build on Cloudflare?

Cloudflare’s edge platform is ideal if you:

  • ✅ Want global performance without global infrastructure
  • ✅ Need to scale from 0 to millions of users
  • ✅ Value developer productivity
  • ✅ Want to minimize operational overhead
  • ✅ Care about cost efficiency

It might not be the best fit if you:

  • ❌ Require long-running background jobs (>30s)
  • ❌ Need complex server-side sessions
  • ❌ Have very large database requirements (>100GB)
  • ❌ Require specific compliance certifications

Conclusion

Building CloudTodo on Cloudflare was one of the best technical decisions we made. The combination of performance, reliability, and developer experience is unmatched.

If you’re building a modern web application, we highly recommend considering Cloudflare’s edge platform. The future of web development is distributed, and that future is already here.


Interested in our tech stack? CloudTodo is built on open-source technologies. Check out our GitHub repository or start building your own edge app.

Have questions about our architecture? Reach out at tech@cloudtodo.app—we love talking tech!