Build your own Promise
A Promises/A+ compliant promise: states, then-chaining and error propagation, then Promise.all and friends on top.
- Intro
- About 3–6 h
- 4 checkpoints
- 2 tutorials · JavaScript
Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.
Choose a tutorialWhy build it
Many async bugs in JavaScript come from misunderstanding promise resolution and the microtask queue. Implementing the specification clears them up.
You will be able to
- Model the pending, fulfilled and rejected states and their transitions.
- Chain then calls and propagate values and errors.
- Explain microtasks versus macrotasks.
- Implement Promise.all, Promise.race and Promise.allSettled.
Skills it exercises
Recommended on Frontend Engineer.
How you know you are there
Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.
- Checkpoint 1Self-check
States
Done when: A promise settles once; later resolve or reject calls are ignored.
- Checkpoint 2Self-check
Chaining
Done when: Values and thrown errors propagate through chained then calls, and returning a promise from then waits for it.
- Checkpoint 3Self-check
Specification
Done when: Your implementation passes the official Promises/A+ test suite.
- Checkpoint 4Self-check
Combinators
Done when: Promise.all, race and allSettled behave like the built-ins in your tests, and await works with your promise.
Stretch goals
- Cancellation with AbortSignal.
- A retry helper with exponential backoff.
Step-by-step guides
Pick one in a language you know (tutorial languages: JavaScript). They open on the author’s site.
- JavaScript
Implementing promises from scratch (TDD way)(external site)
JavaScript, test-driven against the Promises/A+ suite.
- JavaScript
Learn JavaScript Promises by Building a Promise from Scratch(external site)
JavaScript: a step-by-step explanation of the same idea.
Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.
Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.