Pollmodoro is a blazing-fast, open-source polling platform built with SvelteKit and CloudFlare Workers. While still in early development, you can try it out at pollmodoro.com.
Pollmodoro leverages CloudFlare's edge computing infrastructure to deliver a fast, globally distributed polling platform:
- SvelteKit - Full-stack web framework with server-side rendering
- Svelte 5 - Reactive JavaScript framework with compiled components
- TypeScript - Type-safe JavaScript development
- Tailwind CSS - Utility-first CSS framework
- shadcn-svelte - Beautifully designed components built with Radix UI and Tailwind CSS
- Bits UI - Unstyled, accessible component primitives for Svelte
- Lucide Svelte - Beautiful & consistent icon toolkit
- Vite - Fast build tool and development server
- Cloudflare Workers - Serverless compute platform at the edge
- Cloudflare Durable Objects - Stateful objects with strong consistency
- tRPC - End-to-end typesafe APIs
- Drizzle ORM - TypeScript ORM with zero dependencies
- SQLite - Embedded database for Durable Objects
- Zod - TypeScript-first schema validation
- Wrangler - Cloudflare's command-line tool for development and deployment
- ESLint - JavaScript/TypeScript linting
- Prettier - Code formatting
- Drizzle Kit - Database migrations and introspection toolkit
- Cloudflare Turnstile - Privacy-preserving CAPTCHA alternative
- nanoid - URL-safe unique string ID generator
-
Request Routing: When a user creates a poll, their browser sends a tRPC request to a CloudFlare Worker deployed at CloudFlare's global edge network.
-
Geographic Distribution: CloudFlare automatically routes the request to the geographically closest data center, minimizing latency and ensuring optimal performance worldwide.
-
Durable Object Creation: The Worker generates a unique poll ID using nanoid and creates a CloudFlare Durable Object instance with that ID as its globally unique identifier.
-
Stateful Storage: Each Durable Object contains:
- SQLite Database: Zero-latency embedded SQLite storage for poll metadata, options, and votes
- Strong Consistency: All data operations are strongly consistent and transactional
- In-Memory State: Fast access to frequently used data and WebSocket connection management
-
Real-Time Updates: The Durable Object maintains WebSocket connections for real-time vote updates, broadcasting results to all connected clients instantly.
-
Global Coordination: Since each poll has a globally unique Durable Object identifier, users worldwide can vote on the same poll while maintaining data consistency and coordination.
Location Optimization: Each Durable Object is created in the CloudFlare data center closest to the poll creator. This design assumes that the poll creator is typically located near most potential voters, optimizing for the common use case.
Cross-Region Trade-offs: If voters are geographically distant from the poll creator (e.g., creator in USA, voters in Brazil), those voters will experience higher latency since all requests must travel to the Durable Object's fixed location. This is a fundamental trade-off of the single-object-per-poll architecture that ensures strong consistency.
- Strong Consistency: Unlike traditional distributed systems, all poll data is guaranteed to be consistent across all operations
- Zero Infrastructure Management: No databases, servers, or load balancers to manage
- Horizontal Scaling: Each poll is an independent Durable Object with up to 1,000 requests/second capacity, with unlimited polls supported across the platform
- Global Edge Deployment: Low latency access from anywhere in the world
- Real-Time Capabilities: WebSocket support for instant vote result updates
- Node.js (v18 or later)
- npm or yarn
- CloudFlare Account (free tier works)
-
Install dependencies
# Backend cd backend npm install # Frontend cd ../frontend npm install
-
Configure Wrangler CLI
npx wrangler login
-
Start the backend (CloudFlare Worker)
cd backend npm run devThe backend will run on
http://localhost:8787 -
Start the frontend (SvelteKit)
cd frontend npm run devThe frontend will run on
http://localhost:5173