Book: Kotlin and Java to TypeScript
Also by me: The TypeScript Library — the 5-book collection
My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools
Me: xgabriel.com | GitHub
An account holds 100. Two requests arrive at the same moment, each asking to withdraw 80. Your TypeScript service approves both, pays out 160, and records a final balance of 20.
If you came from a JVM codebase, you would have wrapped that method in synchronized without thinking. Then someone told you Node runs your JavaScript on a single thread, and the lock instinct went quiet. The single thread is real. The safety you inferred from it is not, and the gap sits at every await in your code.
Where "single-threaded" stops protecting you
The Node.js docs say it plainly: the event loop gives Node non-blocking I/O "despite the fact that a single JavaScript thread is used by default" .…