How to Build a Flashcard App with Spaced Repetition
A flashcard app is only as good as its scheduler. Here is how spaced repetition decides what to show next, and the data model and screens to build around it.

Key takeaways
- Spaced repetition shows each card just before you would forget it. Every answer updates the card's interval and its next due date.
- Store the scheduling state per card per learner (interval, ease, due date) plus a log of every review. The log lets you change the algorithm later.
- The study screen should be fast and thumb-friendly: show, flip, grade, next, with no loading between cards.
To build a flashcard app, you need decks of cards with a front and back, a study screen that flips a card and asks how well you remembered it, and a spaced repetition scheduler that uses each answer to decide when the card comes back. The scheduler is what makes flashcards work: cards you know drift out to weeks and months, cards you miss come back tomorrow. It is a small piece of logic, and you can understand it completely in five minutes.
Spaced repetition in plain words
Memory fades over time, and each successful recall makes it fade more slowly. Spaced repetition exploits that: review a card when you are close to forgetting it, and the next gap can be longer. In practice, every card has an interval (days until the next review) and an ease (how quickly that interval grows). After each review the learner grades themselves, and the card updates:
- Again (forgot): the interval resets to the start, often 1 day, or a few minutes within the same session, and the ease drops a little so this card grows more slowly from now on.
- Hard: the interval grows only slightly, say times 1.2, and the ease drops a little.
- Good: the interval is multiplied by the ease, which starts around 2.5. A card at 4 days goes to about 10.
- Easy: the interval grows by the ease plus a bonus, and the ease rises.
New cards go through a few short learning steps (for example 1 minute, then 10 minutes, then 1 day) before entering this cycle. That is essentially the SM-2 family of algorithms, which older and well-known flashcard apps use in variations. Newer schedulers model memory more precisely and adapt to each learner, but SM-2 is understandable, predictable and good enough for a first version. Cap intervals (a year or so) and keep the ease above a floor (around 1.3) so hard cards do not get stuck.
The data model
- decks: owner, title, description, and visibility (private, shared by link, public).
- cards: deck id, front, back, optional image or audio on each side, optional tags and a created date. Content only, no scheduling.
- card_states: one row per learner per card: state (new, learning, review, relearning), interval in days, ease, due date and time, number of reviews, and number of lapses (times forgotten after learning).
- review_log: every answer ever given: learner, card, grade, the interval before and after, the time taken to answer, and when.
- settings per learner or deck: new cards per day, maximum reviews per day, and the learning steps.
Splitting cards from card states is the important call. It lets a shared or public deck be studied by many learners, each with their own schedule, and lets a deck author fix a typo without resetting anyone's progress. The review log looks like overkill until you want to show a heatmap, compute retention, or switch to a better algorithm and replay history.
Building the study session
A session starts by gathering the queue: cards in learning that are due now, review cards due today (up to the daily maximum), and a few new cards (up to the new-cards limit). Interleave new cards among reviews so the session does not end with a wall of unfamiliar ones.
- 01Show the front. Big text, centered, nothing else competing.
- 02Tap anywhere or press space to flip. Show the back below the front, not instead of it.
- 03Four grade buttons at thumb height, each labeled with the next interval ("Again 1m, Hard 2d, Good 5d, Easy 9d") so learners understand the consequence.
- 04Write the new state and the log entry, and show the next card instantly. Load the whole queue at session start so there is no wait between cards.
- 05At the end, a summary: cards studied, time spent, and when the next cards are due.
Run the scheduling math in the app for instant response, and save each answer in the background. If several answers are waiting to sync because the learner is on a train, queue them locally and send them in order when the connection returns. Flashcards are studied in the gaps of a day, which often means weak signal.
Making cards less tedious
Most people quit flashcards while making them, not while studying. Help with:
- Fast entry: front and back fields, Enter to save and start the next card, the deck remembered.
- CSV import: two columns, front and back. Many learners already have word lists in spreadsheets.
- Cloze cards: write "The capital of Australia is {{Canberra}}" and the app hides the braces as a blank.
- AI drafting: paste a page of notes and get draft cards to accept, edit or reject. With the App AI gateway, the app can call invokeLLM with a schema for an array of front and back pairs, with no keys of its own; text calls are billed as runtime usage you can cap per app (AI docs). Always let the learner review drafts: generated cards are often too long or test the wrong thing.
- Audio and images: pronunciation clips for language decks, diagrams for anatomy. Store them in a storage bucket and keep only the path on the card.
Stats and motivation
A review heatmap (one square per day, darker for more reviews), a streak count, the number of cards due tomorrow and a retention percentage (share of review cards answered Good or Easy) are enough. A daily reminder email or notification at the learner's chosen time helps, and a Startbase Cloud scheduled job can send the email version to anyone with cards due who has not studied today; see Jobs.
Web, phone or both
Card creation is easier on a laptop, studying is easier on a phone. A responsive web app covers both from one codebase and publishes in one click. If you want a native-feeling phone app, build it with Expo: you can run it on your own phone through Expo Go while building and feel the flip and grade buttons under your thumb. App Store and Play Store builds are not available from Startbase right now, so a store release comes from your own Expo build of the exported code; web app vs mobile app helps you choose.
What to leave out of version one
- A marketplace of public decks with ratings and search.
- Collaborative deck editing.
- Custom card templates with many fields (reading, meaning, example sentence). Front and back, plus cloze, covers most needs.
- An adaptive machine learning scheduler. Ship SM-2 with a review log, and upgrade later using that log.
A brief you can paste
Build a flashcard app for medical students. Users sign in with email and create decks. Cards have front and back text with optional images, and support cloze deletions written as {{answer}}. Import cards from CSV (front, back). Keep scheduling in a separate per-user card state table: state (new, learning, review, relearning), interval days, ease starting at 2.5 with a floor of 1.3, due time, reviews and lapses. Use SM-2 style scheduling: learning steps of 1 minute and 10 minutes, then 1 day; Again resets to relearning and lowers ease by 0.2; Hard multiplies by 1.2; Good by ease; Easy by ease times 1.3 and raises ease by 0.15; cap at 365 days with 5 percent random fuzz. Log every review. Study screen: front, tap to flip, four grade buttons showing the next interval, whole queue loaded at start, answers saved in the background and queued when offline. Daily limits of 20 new and 200 reviews, editable per deck. Stats page with a review heatmap, streak, cards due tomorrow and retention. A paste-notes box that drafts cards with AI for me to accept or edit.
To test the scheduler without waiting for real days, ask the agent for a hidden developer setting that shifts "today" forward, then study across a simulated month and check that intervals grow the way the brief says. For the same machinery inside a full course with audio and streaks, see how to build a language learning app. To keep learners coming back after the first week, read how to improve app retention.
Frequently asked questions
How does spaced repetition work in a flashcard app?
Each card has an interval and an ease. When you remember a card, the interval grows by the ease, so it comes back later; when you forget, it resets and comes back soon. The app shows only cards that are due.
What is the SM-2 algorithm?
SM-2 is a classic spaced repetition algorithm. Each review grade adjusts an ease factor, and the next interval is the previous one multiplied by that ease. Many flashcard apps use variations of it.
How many new flashcards should I study per day?
Many learners start around 10 to 20 new cards a day. Every new card creates future reviews, so a high new-card count today means a heavy review load in the following weeks.
Can AI make flashcards for me?
It can draft cards from notes or a textbook page quickly, but review every draft. Good cards test one fact with a short answer, and generated cards are often too long or vague.
