Rust playground online: practise 190 Crabrix lessons in your browser
A Rust playground online with a real local compiler: open practice copies of 190 Crabrix lessons, then Check, Run and Debug them in your browser.
Editorial date · 14 min read · Published
A Rust playground online that compiles on your device
Most people who search for a Rust playground online want three things: a page that opens quickly, a compiler that tells the truth and code worth typing. The Crabrix Playground already had the first two. It runs real rustc inside your browser, without an account, and your source is never sent to a server for compilation. Now it has the third: 190 lessons from the free Crabrix Academy open their own code in the Playground as a practice copy, and the 46 Examples projects open as copies too.
This guide explains what the new Practise this code in Playground button opens, how the copies were checked and where the browser stops. It shows three real lesson programs exactly as the Playground serves them, with the output we saw in a production build of the site and with rustc 1.99.0 on an aarch64 Mac.
Original generated illustration: the Playground's compiler runs inside your own device, shown as an engine under the keyboard that feeds the browser editor.
The Playground does not forward your code to a build server. Its compiler is rustc itself, built from Rust sources and compiled to WebAssembly, together with a standard library for the wasm32-wasip1 target. The current browser toolchain is crabrix-rust-2026-10-02.1, which reports Rust 1.96.0-dev; the editor shows rustc 1.96.0-dev · wasm32-wasip1 above the code. Your program is compiled to WebAssembly as well and executed in a browser Worker, the same way on a laptop or a phone.
The toolchain is fetched only when you first press Check or Run: a compressed compiler of about 22.4 MiB that expands to about 123 MiB, and a standard-library archive of about 22.3 MiB, roughly 44.7 MiB to transfer in total. Each file is checked against a SHA-256 hash and cached when the browser allows it; a private window or storage eviction can mean downloading it again. The privacy policy states the rule plainly: Run and Check compile and execute on your device, and no compilation service receives your source.
A practice copy is the lesson's own code, unchanged, placed in a new Playground document. Each Academy lesson page shows its code; where a copy exists, a Practise this code in Playground button sits below that code and opens /playground/?lesson=<course>/<lesson>. The copy is a single file, main.rs, in edition 2024. It is not a solution, and it is not the graded compiler lab from the Crabrix app: grading harnesses and check files are never read or published.
Lesson code comes in three shapes, and the Playground's notice tells you which one you got. A whole program with its own fn main opens as it is. Definitions without main get an empty fn main() {} appended, and the notice asks you to call them from main. Statements without a surrounding function are indented into fn main. Of the 190 copies, 91 are whole programs, 52 have an empty main added and 47 were placed inside main. Nothing else is rewritten or added.
Every copy is tied to the exact text that was checked. The list records a SHA-256 hash of the lesson field and of the program built from it, and the site serves a copy only while both still match. If a lesson's code is edited later, its copy disappears: the button is no longer shown, the address returns not found, and the copy returns only after the new text has been checked again.
Original generated diagram: a lesson becomes a practice copy, and Check, Run and Debug all happen in your browser.
A small tool in the course repository made the selection. It looked at the 207 Rust lessons that do not already have a Playground project of their own; the 32 lessons with a starter project and the 600 Algorithm Atlas steps keep the Playground behaviour they had before. For each lesson it tried the practice code first, then the example code, and kept the first that compiled with rustc 1.99.0 using --target wasm32-wasip1 --edition 2024. Practice code that does not compile was accepted only when the lesson's exercise is to repair it. Seventeen lessons had no code that qualified and got no copy.
The second check used the Playground itself. On 23 November a script opened every copy in a production build of the site and pressed Check with the browser's own compiler. 129 copies were accepted without a message, 60 were accepted with warnings, mostly about code that is never used or an unused variable, and one produced errors on purpose. The copies are spread across eight courses: 47 in Rust Interview Prep, 31 in Ownership Mastery, 28 in Rust Basics, 20 each in Rust for C Developers and Rust for Node.js Developers, 17 in Cargo & Real Projects, 15 in Macros & Systems Rust and 12 in Concurrency & Async.
A passing Check proves that a program compiles, not that Run prints something useful. The three examples below show the outcomes you will meet: a fragment that runs, definitions waiting to be called, and a program that compiles and then panics.
Original generated illustration: lesson cards become small runnable projects, with one card kept as the single fix-me exercise.
The Pattern Matching lesson in Rust Basics teaches guards: a condition that narrows one arm while the compiler still demands that the match covers every case. Its practice code has no function around it, so the Playground indents it into fn main. The block below is the copy exactly as served; its hash matches the recorded one.
Run printed even 4 with exit code 0, in the browser and natively. Now make the lesson's point visible. Change Some(4) to Some(-3) and predict the output, then add an arm with the guard if n < 0 above the even arm and run again: it prints negative -3. Move that arm below the plain Some(n) arm instead and rustc warns about an unreachable pattern, while Run prints odd -3, because arms are tried from top to bottom. Finish with None.
fn main() {
let value = Some(4);
match value {
Some(n) if n % 2 == 0 => println!("even {n}"),
Some(n) => println!("odd {n}"),
None => println!("none"),
}
}
The Slices lesson in Ownership Mastery has a practice starter with one function and no main. The copy appends fn main() {}, and the notice says what to do next: call the definitions from main, then Run or Debug locally. Run it unchanged and the Output panel shows (No stdout) with exit code 0. Compiled natively, rustc adds a dead_code warning that first is never used, a reminder that nothing calls it yet.
Call it with "crabrix" and it returns cra. Call it with "hi" and the program panics, because &text[..3] asks for bytes that are not there; try "naïve" and it panics for a different reason, since byte 3 falls inside the two-byte ï. That is the lesson's task in miniature: borrow at most a given number of elements, clamp to the length and never panic. The slice you return borrows the caller's text and allocates nothing, which is why the compiler will not let it outlive its input.
Compiles is not the same as correct: a C loop in Rust
Bridge lessons often start with the code an experienced C or JavaScript programmer writes on a first attempt in Rust. In Pointer + Length to Slices, from Rust for C Developers, the copy is a direct port of a C loop that runs while i <= n. It compiles without a warning. Run it in the browser and Output shows (No stdout), then index out of bounds: the len is 3 but the index is 3, and exit code 1. The native build stops with the same panic message and exit code 101.
This is the outcome the lesson wants. In C the same loop reads one element past the array, a stack buffer overflow under AddressSanitizer; Rust checks the index and stops. Fix it with an exclusive range or iter().max(), then attempt the lesson's real task: return the longest run of equal neighbouring values as a subslice. The Node.js bridge has the same kind of copy in try/catch vs Result, which parses "70000" into a u16 and calls unwrap on the result.
fn main() {
let xs = [4, 9, 2];
letmut best = xs[0];
for i in1..=xs.len() {
if xs[i] > best {
best = xs[i];
}
}
println!("{best}");
}
Exactly one copy fails by design. Why Borrowing Works, in Rust Interview Prep, asks you to repair a five-line program so that it prints crab while keeping the items.push( call and the println!. Its notice says so: the code does not compile yet, fixing it is the exercise, and Run shows the compiler's message.
Pressing Run in the browser stopped after compilation and the Problems tab, now marked 1, held the real diagnostic: error[E0502]: cannot borrow items as mutable because it is also borrowed as immutable. The labels point at the immutable borrow on line 3, the push on line 4 and the later use on line 5. rustc 1.99.0 on the Mac reported the same error. The hint is in that last label: a borrow lasts until its final use, not until the closing brace. Once it compiles, say which rule you broke; the lesson calls it aliasing XOR mutation.
Borrowing, in Ownership Mastery, has a copy too, but it is the lesson's compiling example, because its practice fragment is not a whole program. Open it after solving the interview version and compare where each borrow ends.
The Academy's 46 Examples projects, from Ferris Pixel Art to an RPN calculator, now open with /playground/?example=<id>. Each is a small standard-library Cargo project of at most three files, and the copy is a new document: the original Example stays unchanged, and so do your drafts. In the same browser check, 45 Examples were accepted cleanly and one, CSV Report, with a warning about a field that is never read.
FizzBuzz by Match is a good first one. Its copy ran in our test and printed the numbers 1 to 20 with Fizz, Buzz and FizzBuzz in their places, by matching on the pair (value % 3, value % 5). Change the range, add a rule for multiples of 7 and run it again.
Check compiles the current files and reports diagnostics without running anything. When rustc is satisfied, the Problems tab says Rust accepted the current build snapshot; otherwise each error and warning appears with its file and line. Use it while you are still shaping the code.
Run compiles and then executes the program. Standard input comes from the Input tab, standard output appears in Output, and the last line reports the exit code, the total time and the words compiled locally. If compilation fails, Run stops there and the Problems tab shows the count, which is exactly what the fix-me copy does.
Debug builds a separate, instrumented snapshot of your source. You set breakpoints in the gutter, step into, over and out, and inspect real values from the running program: a String with its byte length, a Vec with its length and up to 16 elements, and concrete local structs up to 16 fields and four levels deep. It needs a page with shared-memory support; if your browser lacks it, use Run or open the project in the Crabrix app. A paused session does not spend the 30-second execution budget, and pauses are capped at 30 minutes.
Every copy opens as a new unsaved document with its own identity, and unshared source lives in browser memory. If you switch on Keep drafts in this browser in the Playground settings, your edited copy is saved as a separate draft on this device, source only, with no room links or permissions. A browser keeps up to 32 drafts, and you delete old ones in the same settings. Opening the same lesson again gives you a fresh copy rather than replacing what you wrote.
Without that switch, a draft lasts until you leave the page, and Save to device, a source ZIP, is your copy. None of this sends source to Crabrix or counts as lesson progress.
What wasm32-wasip1 cannot do in the browser
The target sets real limits, and some lessons meet them. The clearest is threads. Twelve Concurrency & Async lessons have copies and Check accepts all of them, but native threads are not enabled in this profile. When we ran the Threads copy, which calls std::thread::spawn, the browser Output showed failed to spawn thread with the error kind Unsupported and exit code 1. The Scoped Threads copy failed the same way when we ran its wasm32-wasip1 build outside the browser. Use Check on those copies to learn what the compiler demands of Send types and moving closures, and a native toolchain to watch threads run.
Programs have no network access either: sockets are not enabled, so an HTTP or TCP example can compile and still cannot connect. Each run has a 64 MiB memory maximum, a 1 MiB limit on captured output and a 30-second execution deadline, and compiling against the standard library has a 45-second deadline. The editor holds up to 16 files and 128 KiB of source, at most 64 KiB per file, which every practice copy fits easily.
Crates are possible within a bounded profile: declare a dependency in Packages, press Prepare, and the browser resolves up to 16 crates.io libraries, one version each, and verifies their archives. Host procedural macros and native linking are not supported. Practice copies need none of this; each is a single main.rs using only the standard library.
Learn Rust with your AI agent connects Claude, Claude Code, Codex, Cursor and other MCP clients to the Academy through Crabrix MCP 0.6.0, either the remote read-only server at https://crabrix.com/mcp/academy, which needs no sign-in, or a local one started with npx -y crabrix@0.6.0 academy. When the agent reaches the practice step, it calls crabrix_academy_open_playground with the course and lesson IDs. The tool returns the existing Playground link and a kind that says what it opens: a lesson project, a practice copy or an Algorithm Atlas trace. Examples come with an example-copy link from crabrix_academy_get_examples. Neither creates a room. In Claude Code the remote setup is the single command below; the Learn with AI page lists the equivalent steps for the other clients.
Links handed out by the tools carry via=ai. The page counts that arrival once, as an anonymous daily total per kind, adds one for the first Run or Debug in that tab, and then removes the parameter from the address. No cookie, identifier, IP address, lesson ID or code is stored with the count, the totals are deleted after 400 days, and nothing is sent when Global Privacy Control or Do Not Track is on.
The agent can explain, give graded hints and review code you paste, but its review is labelled AI reviewed; official progress comes only from the checks in the Crabrix app. Crabrix 1.2, the next app version, adds a Learn this lesson with AI button to lessons, which copies the same public lesson context for your agent.
claude mcp add --transporthttp crabrix-academy https://crabrix.com/mcp/academy
Pair programming in a shared room, only when you choose
A practice copy is private to your browser. It becomes shared only when you choose Share Playground and create a temporary room, with a lifetime of 1, 4, 12 or 24 hours and one hour selected by default. Up to four participants edit the same files, and each compiles and runs their own snapshot on their own device. Source is encrypted with AES-256-GCM, and the key stays in the link fragment after #, which is not sent in requests to the relay. A view-only link lets someone read, run and copy without editing.
The Academy tools cannot open a room for you. If you want an agent to edit alongside you, share the room and agree to it; the agent joins through Crabrix MCP with its own link, and letting it run code is a separate permission on your device, off by default and limited to ten minutes. Practise alone on a copy, and share a room only when a person or an agent needs to see the same lines.
Minutes 0 to 5. Open Hello, Rust in Rust Basics and press Practise this code in Playground. The first Check or Run downloads the 44.7 MiB toolchain, so start it while you read. Run prints Hello, Crabrix!. Change the greeting, predict the output and run it, then write {} with no argument, as the lesson suggests, and read the error the compiler gives before any program runs.
Minutes 5 to 12. Open Pattern Matching and make the edits described above: a negative number, a guard, the order of the arms, None. Use Check between edits and Run when you want output.
Minutes 12 to 20. Open Slices, call first from the empty main with three inputs and watch two of them panic. Then rewrite it to clamp to the length. If your browser supports Debug, set a breakpoint inside first and step through each call.
Minutes 20 to 28. Open Why Borrowing Works, read the E0502 message in Problems and make the smallest edit that prints crab with the push and the println! still in place. Then open Borrowing in Ownership Mastery and compare your fix with its example.
Minutes 28 to 30. Write down one rule from each lesson in your own words. Coming from C or Node.js, give your next session to Pointer + Length to Slices or try/catch vs Result. With an AI agent, connect it from Learn with AI and ask it to continue where you stopped; it hands you the same practice links.