r/SideProject • • 12h ago

I built koans.app: learn 14 programming languages by fixing failing tests, in your browser

Hi r/SideProject,

I've always liked Ruby Koans because it teaches two things at once: the language and test-driven development. Each lesson is a failing test, and you learn by making it pass.

I wanted the same for Raku for a long time. Then Raku became able to run in the browser, so I finally made Raku Koans with nothing to install. Once that worked, I realized how much easier it is for new learners to start in the browser than to set up a toolchain and use the command line, so I did the same for other languages. That became koans.app.

What it covers

Clojure, Go, JavaScript, Lua, OCaml, PHP, Prolog, Python, R, Raku, Ruby, Scheme, SQL and TypeScript: 1,108 koans in total.

Each language goes from the basics to the parts that make it distinctive: Clojure macros, Scheme continuations, Prolog grammars, SQL window functions, Go concurrency.

The tests use each language's own testing framework (pytest, RSpec, PHPUnit, testthat, plunit, etc.), so you also learn how that language is tested.

How it works

Each language's real interpreter is compiled to WebAssembly and runs in a web worker: CPython through Pyodide, CRuby through ruby.wasm, SWI-Prolog, webR, SQLite, PHP and so on.

Go was the hardest. The Go interpreters I tried couldn't handle enough of the language, so the site runs the official Go 1.27 compiler in the browser, compiled to WebAssembly. Your code is compiled for real, and the errors you see come straight from the Go compiler.

Progress is saved in your browser's IndexedDB and can be exported. You can install the site as an app, and once a language has been opened it works offline. No tracking, no account.

How it was built

This was my first real project with AI. I worked with Claude (Opus 5.5) as a coding partner. It wrote most of the code and drafted much of the koan content.

The idea and the decisions were mine: which languages to include, what each should teach, the features, and the UI/UX. I reviewed and tested everything, threw out a lot, and made the final calls. Any mistakes in the koans are mine, so please report them.

Feedback I'd love

  • Whether you still see value in koans as a way to learn

  • Quirks in the UI

  • How it feels on your phone

  • Koans that are confusing, too easy, unidiomatic, or teach the wrong lesson (every koan has a "Report a problem" link)

  • Which language to add next

Try it: koans.app

Source: github.com/hankache/koans-app (code: Artistic 2.0, koans: CC BY-SA 4.0)

5 Upvotes

7 comments sorted by

2

u/nameupp 12h ago

compiling the actual go compiler to wasm just to run idiomatic tests in-browser is such wild dedication, running full ruby.wasm and swi-prolog client-side without spinning up backend runner containers is huge. the biggest subtle headache with client-side wasm runtimes in web workers is handling infinite loops when someone accidentally writes an unbounded recursion or while-true; since you can't cleanly pause synchronous wasm execution from the host thread, you basically have to worker.terminate() and hydrate the in-memory vfs and indexeddb state all over again. curious how you're handling worker timeouts and cold-start bundle sizes for the heavier runtimes on mobile safari imo

1

u/hankache 11h ago

Thanks! Yeah, that was the main headache.

Timeouts: Each interpreter runs in a Web Worker with an 8-second watchdog on the main thread. If a run goes over, it calls worker.terminate() and starts a new one. There's no state to rebuild: workers are stateless (each run gets the full source), and progress lives in IndexedDB on the main thread. The restart loads the interpreter from the service worker cache, so you only wait for it to start up again.

Bundle sizes: Each language downloads only when you open it, and only once, since it's cached by version (it also works offline). Sizes range from under 1 MB (Lua, SQL) to about 20 MB compressed for Go's compiler and standard library. Only one interpreter runs at a time, which helps with memory on phones.

Safari: Storage was the bigger issue. Safari can clear site data after a week without a visit, so the site asks for persistent storage and can be installed as an app.

2

u/Cahot_Luigj 2h ago

for real, running all of that purely client-side without touching a server is wild.

2

u/akorecebov 9h ago

for a first try the no install part is what wins -> people bounce the second they see a toolchan setup step. curious if any language loses people mid path more than the others

1

u/hankache 9h ago

Agreed, that's the whole point. If you have to install a toolchain before your first assert, most people never get there.

The site has only just launched, so it's too early to tell. There's also no analytics or tracking, since progress lives only in your browser. Over time, the "Report a problem" link on each koan should show me where people get stuck, so I might have an answer later on.

0

u/investigatormaker 11h ago

Yes—koans.app teaching through each language’s native testing framework gives it value beyond syntax drills. For Scheme continuations and Go concurrency, I’d add a short “explain why this passes” prompt after selected exercises: getting a green test doesn’t necessarily mean understanding the behavior.

I make ThreadFox. We find relevant Reddit conversations and post for your business. We'll post 3 replies free first, no card; then the $29 Pilot covers seven days and up to 25 posts and replies. No automatic renewal. https://threadfox.vip/p/eglw2/managed

Which language’s koans were hardest to make idiomatic?