Serverless Flashcards on Cloudflare

A flashcard app that runs entirely on Cloudflare’s edge infrastructure. No servers to manage, globally fast, and cards authored as plain text files.

The Stack

Why Edge-First

Traditional flashcard apps either run locally (like Anki) or require a backend server. This approach:

The Card Format

Borrowed from hashcards, a plain-text spaced repetition system. Cards are written in markdown files using a lightweight notation:

Question/Answer cards:

Q: What is the fundamental charge?
A: The magnitude of the electric charge of a proton or electron (~1.6 × 10⁻¹⁹ C).

Cloze deletion cards:

C: The [mitochondria] is the [powerhouse] of the cell.

Cards are identified by the hash of their content. Edit a card, and it’s treated as a new card (progress resets). This keeps things simple and content-addressable.

What D1 and R2 Are

D1 is Cloudflare’s managed SQLite database. It uses standard SQLite syntax, runs at the edge, and integrates with Pages Functions. Each database can hold up to 10GB – more than enough for flashcard progress data.

R2 is Cloudflare’s object storage (similar to S3, but with no egress fees). Useful if cards include images or audio files that shouldn’t live in the git repo.

Spaced Repetition

The app would implement FSRS (Free Spaced Repetition Scheduler), the same algorithm hashcards uses. FSRS is a modern alternative to SM-2, optimizing review intervals based on card difficulty and user performance.

Progress data stored in D1:

Open Questions