Free course · 58 short lessons · runs in your browser
Learn Rust by building a chat app
One small project, from an empty folder to a chat client that talks to a real AI model. Each lesson teaches one idea from the basics up, then adds it to the project. No experience needed.
▶ Watch the 8-minute intro filmChapter 1 Hello
What a program is, how Rust runs one, how to read the compiler, and your first functions.
- 1.1What a program isNothing yet: you see where we are heading.Start · 6 min
- 1.2Make and run a projectThe Chatterbox project exists and runs.6 min
- 1.3Printing and commentsChatterbox prints a banner.7 min
- 1.4Chatterbox says helloA greeting that fills in your name.6 min
- 1.5Reading what the compiler saysNothing new: you learn to read and fix compiler errors.9 min
- 1.6Functionsbanner() and greeting() become functions.12 min
- 1.7Chapter review: HelloNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Chapter 2 Values
Names, numbers and their sizes, true and false, text and constants: the things a program remembers.
- 2.1Names for valuesThe bot gets a name and a version.7 min
- 2.2Values that changeA message counter.8 min
- 2.3Numbers and true/falseA length limit and a "quiet" switch.8 min
- 2.4How big a number can getThe counter gets a type that says how big it can grow.9 min
- 2.5TextThe greeting is built up as text.9 min
- 2.6Pairs and constantsFixed facts become constants; the version becomes a pair of numbers.11 min
- 2.7Chapter review: ValuesNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Chapter 3 Decisions
if, match and loops: teaching Chatterbox to react to what you type.
- 3.1Choosing with ifreply() answers a message; empty input is ignored.10 min
- 3.2Choosing with matchCommands: /help, /quit.9 min
- 3.3Doing things againThe chat loop.10 min
- 3.4Reading a lineChatterbox asks your name and reads what you type.11 min
- 3.5Chapter review: DecisionsNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Chapter 4 Memory
Where values live, and the idea Rust is famous for: one owner, borrowing, and why it saves you.
- 4.1Where values liveNothing new: a picture of the memory behind every value.11 min
- 4.2One owner, one keyThe mental model; no code change.8 min
- 4.3Handing over the key/again: your last message is handed over to be kept.10 min
- 4.4BorrowingUnknown commands get a helpful answer from a borrowing function.11 min
- 4.5Borrowing to changeA transcript that a function edits, and /history to print it.11 min
- 4.6Parts of a value/say: slices pull a command apart.11 min
- 4.7Chapter review: MemoryNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.9 min
Chapter 5 Shapes
struct, enum, Option and patterns: giving Chatterbox real types of its own.
- 5.1Bundling fields: structA Message struct.7 min
- 5.2Giving a struct behaviourMessage methods, and /shout.8 min
- 5.3One of several: enumA Command enum, matched exhaustively.8 min
- 5.4Maybe nothing: OptionOption: /again and a bare /say know about "nothing".9 min
- 5.5PatternsShort aliases like /h and /q, and /debug to see how a line was understood.13 min
- 5.6Chapter review: ShapesNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Chapter 6 Collections
Vec, HashMap, closures and iterators: keeping and searching the whole conversation.
- 6.1A list: VecThe history becomes a Vec of messages.8 min
- 6.2Walking a listNumbered /history, and /count.9 min
- 6.3Lookup by key: HashMap/remember and /recall, with a HashMap.11 min
- 6.4Small functions on the spot/find, with a closure.10 min
- 6.5Iterators/stats: your most-used words, in one chain of steps.12 min
- 6.6Chapter review: CollectionsNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Chapter 7 Errors and tests
Result and the ? operator, then writing tests and letting the tools check your code.
- 7.1Operations that can fail: Result/last N: turning text into a number can fail.8 min
- 7.2The ? operatorparse() reports what is wrong, passed up with ?.11 min
- 7.3Writing testsChatterbox gets its first tests.12 min
- 7.4Tools that check your codeclippy and rustfmt tidy the code.11 min
- 7.5Chapter review: Errors and testsNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Chapter 8 Organising code
Modules, files on disk, generics, traits and lifetimes: code that stays tidy as it grows.
- 8.1Splitting code into filesmessage.rs and command.rs split out of main.rs.8 min
- 8.2Saving and loadingThe history survives a restart.11 min
- 8.3Code for any type: genericsOne last_n() works for any kind of list.12 min
- 8.4TraitsA Replier trait, and /model to swap who answers.12 min
- 8.5How long a borrow lastsNothing new: you learn why first_word compiles.12 min
- 8.6Chapter review: Organising codeNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Chapter 9 The real model
JSON and one HTTP call: Chatterbox talks to a real model, and ships.
- 9.1JSON with serdeThe history is saved as JSON.9 min
- 9.2One HTTP call/model real: Chatterbox calls a real model.18 min
- 9.3Ship itVersion 1.0: a README and cargo install.10 min
- 9.4Chapter review: The real modelNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Chapter 10 Streaming replies
async and await, tasks, channels and select!: waiting for the network without freezing.
- 10.1Waiting without freezingNothing new yet: async, .await and tokio on small programs.14 min
- 10.2Tasks and channelsAnswers arrive through a channel; the pretend model types word by word.18 min
- 10.3Streaming the real modelThe real model’s answer appears as it is written.16 min
- 10.4Stopping a long answerCtrl-C stops an answer, or saves and quits at the prompt. Version 1.1.20 min
- 10.5Chapter review: Streaming repliesNothing new: a mixed quiz on the whole chapter, and a bigger exercise that uses all of it.8 min
Learn Rust by building a chat app: frequently asked questions
Is this course free?
Yes. Every lesson and exercise is free, with no account. Progress is stored in your own browser.
Do I need to know how to code?
No. The course starts from what a program is and builds up one idea at a time. If you can already code in another language, the early lessons are quick.
Do I need to install anything?
Not to start. Code boxes compile and run in the page through the official Rust Playground. From chapter 3 you will want Rust on your own machine to run Chatterbox in a terminal; lesson 1.2 shows how.
What will I have at the end?
A working command-line chat program written in Rust that keeps a conversation, saves it to disk, talks to a real AI model and shows its answers word by word as they are written, and the Rust fundamentals you used to write it: variables, types, control flow, ownership and borrowing, structs and enums, collections, error handling, traits, one HTTP call, and async code with tokio.
Are the compiler messages real?
Yes. Every error shown was produced by running the snippet through the Rust compiler during the site build, and the build fails if a snippet stops producing the error it claims.