All work

Recurse · learning app · web and Android · TypeScript

Building Recurse, an app for learning Rust and computer science in a few minutes a day

Recurse teaches computer science in short daily lessons, a few minutes at a time, on your phone. I built all of it alone: the product idea, the design, the lessons, the website, the Android app and the marketing. It has five courses, from Rust to running AI models in production, and 3,281 questions. This page covers why each part works the way it does, and what broke along the way.

Role

Built it alone: product, design, code, marketing

Learners

100+ active

Courses

5, with 3,281 questions

Stack

Next.js, Hono, Expo, Postgres

What's in Recurse

Recurse runs on the web and as an Android app, which is in testing on Google Play.

Courses

Rust, operating systems, system design, data-intensive systems, and inference engineering, which is about running AI models in production. 126 units in all.

Lessons

Three to five minutes each, and every answer is a tap, so they work on a phone. A few short teaching cards come first, then questions of eight kinds: will it compile, what does it print, find the bug, put the lines in order, and more.

Practice

Mistakes come back on a review schedule. There's also a daily question, a 60-second speed round and a 10-minute interview mode.

Habit

Streaks with freezes, daily quests, a daily gift, gems and a shop, and rewards all the way to a 365-day streak.

Friends

Weekly leagues, friends, 1-on-1 races and streak buddies.

Android app

Home screen widgets, reminders, lessons that survive a bad network, and Google sign-in inside the app.

Who Recurse is for, and why lessons fit on a phone

The people I had in mind already write code, or are studying to. More and more of their code is written by AI. What they're missing is the layer underneath: why the borrow checker refuses a program, why two threads race, why a database query crawls. Someone on every team has to understand that, and interviews still test it.

They don't have an hour a day for a textbook. They have a few minutes in a queue or on the ride home, usually on a phone. Most decisions in the app follow from that: a lesson fits in five minutes, every answer is a tap, and code in a question is never longer than 12 lines, so it fits on the screen.

Before building anything I wrote down five rules, and I checked new features against them: small and daily beats long and rare; every code claim must be true; feedback should teach, whether you're right or wrong; rewards should mark real progress, not empty clicks; and a lesson has to respect the learner's time.

Welcome screen with Kapi the capybara and the line 'AI writes the code. Know why it works.'
The first screen says who it's for: people who let AI write code and want to understand it.
Welcome screen with a live Rust question, 'Will this compile?', and the answer 'No: value moved'
The second screen is a real question, so people try the product before they sign up.
Welcome screen showing a 12-day streak, weekly leagues, races and the home screen widget
The third one sells the habit: three minutes a day, a streak, leagues and a widget.

What I learned from studying how Duolingo builds a lesson

Before writing any code, I studied how Duolingo's web app builds a lesson. I recorded what it sends and receives while you learn, and wrote up how its lessons are put together: how many questions there are, how it picks them, and what happens to a wrong answer.

Then I went through it one piece at a time and decided what to keep and what to change. I kept the learning loop and made the look my own: the mascot is a capybara called Kapi, and none of Duolingo's brand, colours or art is used.

A lesson is about 17 questions

12 to 15 shorter ones, so a lesson fits in five minutes.

It picks questions you'll get right about 9 times in 10

The same idea: hard enough to teach you something, easy enough that you keep going.

Wrong answers come back at the end of the lesson

Kept exactly, and they come back again later on a review schedule.

Around 60 kinds of exercise

8 kinds made for code, like 'will it compile' and 'put the lines in order'.

Hearts that stop a lesson after too many mistakes

Left out of lessons. Getting things wrong is part of learning here. Only the skip-ahead tests use hearts.

Onboarding, and why each setup step is there

Setup takes under a minute, and every step earns its place.

Pick your first course

Five big coloured tiles and one tap. Choosing makes the course feel like yours from the start.

How well do you know it?

A beginner starts at lesson one. Someone who knows a bit takes a short test and skips ahead, so they aren't bored on day one.

Your daily goal

Five to twenty minutes. The smallest one is marked as the best start, because a goal you can keep beats a big one you drop.

When will you learn?

Picking a set time is what turns something into a habit. That hour becomes the reminder.

The reminder ask

Before Android asks for permission, Kapi explains it in plain words: one nudge a day, only when your streak needs it. People say yes more easily when they know what they're agreeing to.

How did you find us?

One tap, or skip it. It tells me which of my marketing actually brings people in.

Your plan, and "I'm in"

The plan repeats what they chose: Rust, 10 minutes a day, 7 PM. Pressing "I'm in" is a small promise to themselves, and the first lesson starts straight away.

Setup screen with five course tiles: Rust, Operating systems, System design, Data systems and Inference engineering
Pick your first course.
Setup screen asking 'When will you learn?' with morning, lunch, evening and night tiles
A set time turns it into a habit.
A sheet saying 'Kapi will remind you at 7 PM. One nudge a day, only when your streak needs it.'
The reminder is explained before Android asks.
Setup screen asking 'How did you find us?' with friend, search, video, social media, forum and school options
One tap that measures the marketing.
The plan screen: Rust basics in 12 days, 10 minutes a day, a 7 PM reminder, the first four units and an I'm in button
The plan, and a small promise.

How a lesson works: teach first, then ask

A lesson teaches first and asks after. Each detail below is there to keep someone learning for the next five minutes.

Teaching cards before questions

You see one idea and a tiny example before you're tested on it.

Watch the code run

Some cards step through the code a line at a time and show what's in memory. That's how you start to picture a program running, which reading alone doesn't give you.

A hint instead of a fail

A wrong answer on a teaching card gives a hint and lets you try again, because you're still learning the idea.

Every answer is explained

Right or wrong, a sentence or two says why.

Wrong answers come back

Anything you get wrong comes back at the end of the lesson, and again later on a review schedule.

Continue sits where Check was

You tap the same spot twice to check and move on, so your thumb never has to travel.

The end screen gives a reason to return

It shows the XP, the streak, the daily goal, and tomorrow's reward.

A teaching card: 'Give a value a name', with a key idea and a two-line Rust example
One idea and a tiny example first.
A card stepping through Rust code, showing the variable score in memory changing from 5 to 10
Step through the code and watch memory change.
A teaching card question with a hint after a wrong answer: 'Does this code do that? Try another answer.'
A wrong answer here gets a hint, not a fail.
A right answer with a green sheet: 'Nice! Right on the first try.' and an explanation
Right answers still explain why.
A wrong answer with a red sheet: 'Not quite', the correct answer and an explanation
Wrong answers show the right one and the reason.
Lesson complete screen with XP gained, questions solved, time, a 1-day streak, the daily goal and tomorrow's reward
The end screen points at tomorrow.

Five courses: Rust, operating systems, system design, databases and AI inference

Every course follows the same rules, and each explains its ideas through something everyday. Inference engineering starts with a chef: training a model is learning to cook once, and inference is cooking every night from what you know. Operating systems asks how many processes there are when you open the same notes app twice. System design starts with your browser asking a server for a page.

Inference engineering teaching card comparing training a model to a chef learning to cook
Inference engineering, explained with a chef.
Inference question: a model has 3B weights at 2 bytes each, how big is it? Answer: 6 GB
Back-of-the-envelope maths for model size.
Operating systems question: you open the same notes app in two windows, how many processes are there? Answer: two
Operating systems: programs and processes.
System design question: your browser loads a news page, which one is the server?
System design: who asks and who answers.
Data systems question: which one is an OLAP query? Answer: average basket size per city
Data systems: quick lookups versus big scans.

Gamification without dark patterns: streaks, leagues and rewards

Rewards are how an app like this keeps people coming back, so I used the techniques that are known to work. I set one rule first: nothing fake. No fake timers or numbers, no guilt trips, no hidden unsubscribe link, and no boxes ticked for you.

Show how close the next reward is

"5 XP to your daily goal", "3 to go" on a unit, and one "Next:" line on the end screen. A goal feels worth finishing when you can see how near it is.

Streaks you can save

Streak freezes, and if you miss exactly one day, two lessons the next day win the streak back. Losing a long streak to one bad day is when people quit.

Small surprises

About one lesson in 8 pays a bonus 10 XP, and a chest gives gems plus a surprise like a streak freeze or double XP.

Daily quests

Three small goals a day. Finishing all three starts 15 minutes of double XP, with a real countdown.

A gift for showing up

A 7-day calendar that grows each day, so day 7 is worth coming back for.

Leagues

Groups of 30 race on XP each week through five tiers: Byte, Stack, Heap, Kernel and Compiler. While Recurse is small, quiet tiers share a group, so nobody races alone.

Friends

1-on-1 races, a shared streak with a buddy, and a nudge for a friend who hasn't learned today.

Kapi has moods

On the home screen widget, Kapi wears shades once you've learned today, looks worried in the evening, cries in the last hours, and falls asleep if the streak is lost.

A long road

Rewards from day 2 all the way to day 365, where a 365-day streak earns a free Recurse T-shirt.

The streak reward road: day 21 double XP won, next the golden sunglasses at day 30 with 8 days to go
The reward road: golden sunglasses next, 8 days to go.
The daily gift opening: plus 5 gems and a tester cap for Kapi, day 1 of 7
The daily gift: day 1 of 7.
A course page showing time spent, lessons passed, the level, the next lesson and first-try accuracy
Each course shows how far you've come.

Social features: streak buddies, races and leagues

Learning alone is easy to skip. Most of the social features exist so that someone else notices when you don't show up.

Streak buddies

You and a friend share one flame, and it only lights when you both learn that day. Letting a friend down pulls harder than letting yourself down.

Nudges

Friends who haven't learned today get a gold bell next to their face. One tap reminds them.

1-on-1 races

A 7-day XP race with a friend, or with anyone you send a link to. The winner gets a badge.

Team quests

Team up with a friend for the week: earn 300 XP together and you both get 40 gems. Unlike a race, you win together.

Someone passed you

When a friend or someone in your league overtakes you, you hear about it, with at most one push a day.

Cheers and the feed

Your milestones show up in your friends' feed, where they can react with Kapi's faces, and anyone can cheer you once a day on your profile.

Friends and safety

Everyone has an @username, and friend requests need the other person to accept. Blocking works both ways at once, and the blocked person isn't told.

From my own account. Other learners' names and photos are blurred.

The streak page: a 22-day streak and a streak buddy, 5 days together, with a button to nudge the friend
A streak buddy: 5 days together, and a nudge for the friend who hasn't learned yet.
This week's league: 166 XP, first of 7, holding the top spot by 75 XP, with a podium
This week's league. "Hold the top spot: 75 XP lead" says exactly what to protect.
Last week's result: moved up to the Kernel league, 3rd of 15, plus 20 gems, with the podium
The first time you open the league in a new week, it shows how last week went.

XP, gems and the shop

There are two currencies, and each has one job. XP measures learning, and gems are for spending.

XP

Every lesson pays XP, with a combo for right answers in a row. Your daily goal, leagues, races and team quests all run on XP, so one number ties the whole game together.

An easy streak

Any learning keeps the streak alive: one daily question, right or wrong, a speed round or an interview. A streak should reward showing up, not punish a busy day.

Gems

5 per lesson, or 10 for a perfect one. Chests give 15 to 40 plus a surprise, the top places in a league win 50, 30 and 20, and every badge pays once. The server records every gem in and out, so a retry can never pay twice.

Shop and wardrobe

Gems buy streak freezes, double XP, stickers, and eight outfits for Kapi, from a bow tie to a wizard hat. You try an outfit on first, and if you can't afford it yet, it shows how many gems are left and becomes something to save for. Kapi then wears it on your map, profile and widgets.

Badges

Badges for streaks, XP, lessons, perfect lessons and finished units. Earned ones are never taken away, and the rest show how close you are, like "12 / 30".

Month in review

In the first week of each month, a card of last month: the days you learned, your best streak, your strongest skill, and a Share key.

My profile: 22-day streak, 1,329 XP, 62 lessons, 80 skills, and Kapi in the tester cap
My profile: the streak, XP, lessons and skills, with Kapi in the tester cap.
October in review: 9 days of learning, 39 lessons, 820 XP, best streak 5, Rust learned most
Month in review: October in numbers.
The shop's wardrobe: Kapi plain, in golden sunglasses earned with a 30-day streak, and in outfits bought with gems
The wardrobe. The golden sunglasses can only be earned, with a 30-day streak.
Trying on the party hat: Kapi wears it in a preview, with '595 more gems to go' and a Save for this button
Try an outfit on first. Then it becomes a goal: "595 more gems to go".

Practice modes: daily question, speed round and interview mode

Daily question

One question a day from the units you've reached, with how everyone did and what your friends picked. The percentage waits for 5 answers, so it never shows 100% from one person.

Speed round

60 seconds of one-tap questions, graded again on the server, with friends' best scores and a beat-my-score link.

Interview mode

10 harder questions on one clock, with no grading until the end, like a real interview. Afterwards, every answer is explained.

Workout

The Practice tab starts with your weak spots and the skills you're about to forget.

Skip ahead, or master a unit

A short test lets someone who already knows a section skip it. A harder test turns a finished unit gold with a crown.

Unit guides

Short notes for each unit, with a reading bar and a button into your next lesson, for people who like to read first.

Look back in a lesson

A back key shows earlier questions with your answer and the explanation, then returns you to where you were.

Report a problem

Every answer has a report link, and reports land on an admin page where I review them.

The Practice tab: 64 skills fading, today's workout of 12 questions, weak spots, and speed round and interview tiles
Practice starts with what you're forgetting: 64 skills fading, and a 4-minute workout.

Android app features: widgets, reminders and offline lessons

Home screen widgets

Three widgets: your streak, your week and XP, and today's question with its choices, which you can tap to answer. They change layout when you resize them, like other apps' widgets.

Reminders

Scheduled on the phone itself: a morning hello, a lunch nudge, your own hour, and a late warning when the streak would end at midnight. None of them come once you've learned that day.

Play first, sign up later

You can learn as a guest, and everything moves to your account when you sign in: XP, streak, badges and progress.

Sign in without leaving the app

"Continue with Google" opens Google's own account sheet inside the app, through a small native module I wrote, instead of jumping out to a browser.

App design, and the small details

The map is drawn as a git history, because the people using it are developers. Each section is a stretch of the main branch, each unit is a branch, and each lesson is a commit with a hash. Your next lesson is HEAD, a chest is a tag, and the unit review merges back in.

Kapi, the capybara in pixel sunglasses, is on every screen that needs a face: cheering a right answer, worried when a streak is at risk. Green and red only ever mean right and wrong, so they're never confused with decoration, and every text colour was checked for contrast in both light and dark.

Most of the work, though, went into small things people only notice when they're wrong.

Course names shrink to fit

On narrow phones, "Operating" was splitting across two lines as "Oper" and "ating".

Widgets work with large text

Android makes widget text bigger with the phone's text size, which was cutting labels in half.

Most taps only buzz

A tester said a click sound on every press was too much. Answers, combos and chests keep their sounds.

A lesson left halfway picks up where it was

Every answer is kept on the phone, so closing the app doesn't lose your place or your combo.

"1 day", not "1 days"

Small, but people notice.

Reminders change every day

Each kind of reminder has several lines in Kapi's voice, picked by learner and day so they don't get stale. A retry sends the same line, not a new one.

My map in the Inference engineering course: lesson 1 done, HEAD on lesson 2, Kapi in a tester cap
My own map, partway through Inference engineering.
The learn map drawn as a git history: a unit branch with lessons as commits, HEAD on the next lesson, a chest and a unit review
The map as a git history, with HEAD on your next lesson.

How I marketed it: campus posters and social posts

I treated marketing as part of the product, not something to do after it.

The campus posters each ask one question, and each is made for a place on campus where people wait or spend: the lift, the canteen, the stationery shop, the ride home, outside an interview room. You read the question, you want to know the answer, and the QR code is right there. Every poster comes in two versions: one points to the website now, and the other points to Google Play for after launch.

Poster: 'Answer this before the lift doors open', with an operating systems question and a QR code
For the lift.
Poster: 'One question before your chai goes cold', about why ChatGPT types its reply one word at a time
For the canteen.
Poster styled as a ticket: 'Your ride home: 20 minutes. One lesson: 3.'
For the ride home.
Poster: 'There's no ChatGPT in the interview room', with a short checklist of questions
For interview season.
Poster styled as a receipt of a day's screen time, with 0 minutes spent learning something
Where did today's minutes go?
Wanted poster: 'Engineers who know why it works', reward: the offer letter
A wanted poster.
Poster: 'Bet your friend can't answer all 4', with four interview questions
Made to be read out to a friend.
Poster: 'Spot the bug. You have 10 seconds.', with a withdraw function that has a race condition
A ten-second bug hunt.
Poster styled as a stationery shop rate list where 'Knowing why your code works' costs nothing
For the stationery shop: everything costs money except this.
Poster: 'Not in your syllabus. Asked in interviews anyway.', with a list of common interview questions
What college skips and interviews ask.
Poster: 'You use it every day, but can you explain it?', with everyday tech questions
Things you use every day.
Poster: 'What kind of engineer are you?', a flowchart where every path ends at the QR code
Every path ends at the QR code.

The social posts are built to get replies, because replies are what spread a post: a tier list of computer science ideas to argue about, SQL against NoSQL with "pick one, defend it", and a code review where the AI's code works but nobody can say why.

Social post: a tier list of computer science concepts, asking people to rank the rest
A tier list to argue about.
Social post: SQL versus NoSQL, pick one and defend it
Pick one, defend it.
LinkedIn post: the AI's code works, but why? A code review where Kapi asks why a retry is safe
For LinkedIn: a code review.
LinkedIn post: 3 minutes a day is 18 hours a year, or 365 things you can finally explain
For LinkedIn: the maths of three minutes a day.

And short videos for Instagram that I made, with a voiceover. Swipe or scroll for the next one.

@divyansh.larpsFollow

Learning the hard stuff is recursive. So I built the base case.

Original audio • divyansh.larps
@divyansh.larpsFollow

This is Kapi. A week ago our mascot was a yellow snake, then things got out of hand.

Original audio • divyansh.larps
Swipe for more
Reel 1 of 2

Share pictures

Invite, race and profile links show a picture with Kapi, who sent it, and their streak and XP, so a shared link looks worth tapping.

Links that open the app

Invites and races go to Google Play, and the screen the link was for rides along. After installing, the app opens straight to that race or invite.

Search and AI tools

Each course has its own page built from the course content. The site is marked up as a free educational app with its common questions, and a plain file tells AI tools what Recurse is.

Short videos

Reels for Instagram: the launch, new features, and Kapi's story. Each reel's link carries its own tag, like ?ref=ig-reel1, so I can see which video brought people in.

Measuring it

Setup asks "How did you find us?", so I can see which of these actually works.

Checking every Rust question with the real compiler

Most Rust questions are claims about code, like "this doesn't compile" or "this prints 7". If the answer key is wrong, the app teaches people something false, and with confidence. With thousands of questions, checking by hand would miss some, and so would asking an AI.

So the real Rust compiler is the answer key. Before anything ships, a checker compiles every Rust question. If a question says the code fails, it has to fail with the exact error code the question names. If it says the code prints something, it has to print exactly that. That's 1,111 Rust checks right now, and the build fails if any of them stops matching.

How I got there

Explore

First idea: write carefully and read it over

Write it carefully
Ask a model
Read it over

Realise

But a person, or an AI, can be wrong and still sound sure

Write it carefully
Ask a model
Read it over

Insight

So compile every question and check the exact result

Compile every item
The exact error
Grade it again

Let the compiler decide the answer, not the person writing the question.

From a question to a graded answer

  1. Written as plain files in git

    Each unit is a folder of YAML files: its skills, questions and teaching cards. AI drafts them, then they're checked and reviewed.

    content/rust/units/

  2. Compiled before it ships

    A checker builds every Rust question with a fixed version of the compiler and compares the result with what the question claims.

    tools/check-content/src/rustc.ts

  3. Graded on the phone

    Answers are checked the moment you tap, so feedback is instant, even offline.

  4. Graded again on the server

    When a lesson ends, the server replays your answers with the same grading code. Only then do your XP and streak change, so nobody can fake them from the browser.

    packages/api/src/replay.ts

Saving finished lessons on a bad network

A lesson finished on a train with no signal could fail to save, and the learner would lose it. Now every finished lesson is kept on the phone and sent until the server confirms it has it: a few quick tries on the end screen, then again whenever the app opens.

Fixing a React Native app that froze when the network changed

Android sends all of an app's requests down one shared connection. When the phone moves from Wi-Fi to mobile data, that connection can go silent without the phone noticing. React Native's network code has no time limit, so every retry waited on the same dead connection for about a minute. A tester saw "This lesson didn't load" twice while the server was answering in 0.2 seconds.

I gave the connection a 5-second read limit, which marks a dead connection as bad so the retry opens a fresh one, and a ping every 10 seconds to catch one that died while idle. I tested it through a relay that freezes connections on purpose. Before the fix every try failed; after it, the retry loaded in 0.3 seconds.

Cutting latency for learners in India: moving from Neon to Supabase in Mumbai

The database was on Neon's free plan, which sleeps after 5 idle minutes and adds about a second to the next request. It was also close to its monthly limit, and almost every learner is in India.

First the server moved next to the database in Singapore, which cut each call from India to about a third of the time. Then both moved to Mumbai. A round trip from India to Mumbai is about 58ms, against 100ms to Singapore, so every request got about 40ms faster. The server and database stay in the same region, because one request makes several database queries.

Making the app open instantly

The app saves its data on the phone, so the map, streak and friends show at once, even offline, while fresh data loads in the background. The next lesson is fetched while you're still looking at the map, so Start opens it without waiting. Parts of the profile that don't depend on each other load side by side instead of one after another.

Fast leaderboards in Postgres

A leaderboard used to add up every learner's XP for the week each time someone opened it. Now each learner's score is kept in its own table and updated in the same database transaction as their XP, so a board is one quick read from an index. A nightly job checks every kept score against the real data, and fixes and logs any that drifted.

Personalised learning, measured with an A/B test

Recurse adapts to each learner using only their own history. For now it's plain statistics, and nothing is sent to an outside AI service.

Every night, each active learner's day is saved as numbers: days since their last lesson, lessons and XP this week, accuracy, speed, the hour they usually learn, and friends. Later models will learn from this data.

From that history, the app finds the hour you usually learn and moves your reminder close to it. It makes practice harder if you're getting 90% right, keeps reviews easier if you're at 60% or less, and shows your weak spots on the Practice tab.

To know whether any of this helps, it runs as a fair test. 8 in 10 learners get the smart version and 2 in 10 are kept back to compare. The group comes from the learner's id, so it never changes, and each day's settings are logged. When it started, it filled in 90 days of history, using for each day only what was known on that day, so later answers couldn't leak into earlier days.

Bugs the tests didn't catch

These all came from real use, and each one now has a test or a check so it can't come back.

The league week switched at 5:30 AM India time, but last week wasn't settled until about 7:30 PM. For 14 hours the board showed a new week with old winners.

One clock: Monday to Sunday in India time, settled ten minutes after midnight.

Rust and System design both had a section called "data", so a System design skip-ahead test asked Rust questions.

Renamed the sections, and the content build now fails if two courses share a name.

Chests in every course after Rust said they were locked, because the server checked units against one long list of all courses.

Each unit is now checked within its own course.

Older versions of the app would crash when a friend wore a new outfit they didn't know how to draw.

The app now sends its version number, and draws any outfit it doesn't know as plain Kapi.

Recurse in numbers

3,281

questions

126 units across 5 courses

1,111

Rust questions compiled

every one matches what it claims

497

tests

441 unit and 56 end-to-end

Source · Counted from the repo on 10 November 2026.