I Know What I Need, But I Don't Know How To Build It
Pick the thing you need. Then derive it: meaning, state, operations, rules, examples, representation, pseudocode — and only then the code, one rung at a time.
“I know I need a shopping cart. I have no idea how to implement a shopping cart.” The gap is not a missing tutorial; it is a missing method. Every stage below asks you to write before it shows you anything, because the code is the last step of a derivation, not the first thing to search for.
Which concept?
Grouped by exercise level; the level is how far the derivation goes, not how hard the code is.
How much help?
Every stage's content is shown right after your attempt box.
Authentication — twelve stages
I know I need login. I have no idea how to implement login.
Define the concept
In one sentence, without any code: what is it? Then answer for yourself — does it have identity, who owns it, how long does it exist, should it survive a reload or a login?
Authentication = Establishing which known user is behind a request, and remembering that answer for the requests that follow.
- Does a session have identity? Yes. Two sessions for the same user on two devices are two sessions; logging one out must not log out the other. The session token is its identity — it is also the only thing the client holds, which is what makes a stolen token dangerous.
- Who owns it? The user it was created for. A session belongs to exactly one user; a user may have many sessions. Nothing else — a page, a cart, a comment — owns a session; they ask it who the user is.
- How long does it exist? From login until logout or expiry. Expiry is a rule that does not exist in V0 and is the first thing V5 adds, because a session that lives forever is a token that is dangerous forever.
- Should it survive reload? Yes — that is the entire reason the session exists. The token is kept by the browser (a cookie or storage) and sent with every request; the session record lives on the server. The concept of "the same user, later" is what the token carries across the reload.
- Should it survive login? The question inverts: login *creates* it. A second login by the same user creates a second session, or replaces the first — a rule the product decides.
The catalog is one derivation, not the only one (impl §60). A different set of examples yields different rules; a different first requirement yields a different V1; a map instead of an array is not wrong, only an answer to a different question. Compare your derivation with the reference for the differences, then decide which ones were rules and which were style.
Take it further
The flagship exercise: the cart typed by you, with the reference hidden until you ask.
Make It Smaller Until You Know How to Build It →The principle behind the ladder, and the primitive chain it produces.
The Implementation Loop →The loop the twelve stages follow, and why the code is last.