Building an LLM from Scratch in TypeScript: Inside the Node.js LLM Book

"Building an LLM in NodeJS" is a from-scratch, chapter-by-chapter guide to implementing a large language model in Node.js and TypeScript, published as an online book at book.humanexperiences.io and announced on Hacker News as a Show HN by author baraa_. The project's stated goal is to leave no black boxes: readers build the dataset, dataloader, attention mechanism, transformer block, GPT model, and training loop themselves, with runnable code for every chapter.

The Show HN submission reached 30 points and drew 3 comments, only one of which was a substantive question. The discussion thread is therefore thin, and several basic facts about the book — including its chapter 1 contents and its publication status — are not stated in the source material.

What the book actually teaches

The book's landing page describes it as "the from-scratch guide to building large language models in NodeJS and TypeScript." Its central claim is that readers will implement every layer of a GPT-style model rather than calling into an existing framework.

The components the book says it builds, in the order the landing page lists them, are:

  • Dataset
  • Dataloader
  • Attention
  • Transformer block
  • GPT
  • Training loop

These are presented as being "built up chapter by chapter," which means the book is structured as a progressive implementation rather than a conceptual survey. The landing page frames this as the difference between understanding how large language models work and treating them as opaque systems.

The code is runnable, not pseudocode

Every chapter of the book has a runnable entry point in a package called @node-llm/chapters, and the source is hosted on GitHub at BaraaSoft/node-llm. This matters for readers evaluating the book: the code is not illustrative snippets that must be adapted, but executable TypeScript that can be run directly.

The landing page also references a second package, @node-llm/playground, which is intended to host live WebGPU demos embedded throughout the book. That feature is explicitly marked "Soon" on the landing page, meaning the interactive demos were not available at the time of the Show HN post.

The book starts at Chapter 2, and the thread does not explain why

The primary call to action on the landing page is a link labeled "Start with Chapter 2," which points to /chapters/02-tokenizer/. That means chapter 2 is the tokenizer chapter, and it is the recommended entry point for new readers.

The only substantive comment on the Hacker News thread came from user pluc, who asked about this directly:

Why does it start at Chapter 2? Is it one of those JavaScript integer quirks?

No reply from the author appears in the scraped thread, so the reason for starting at chapter 2 rather than chapter 1 is not documented in the discussion. The landing page does not state what chapter 1 covers.

What the source material does not establish

The available material is a landing page and a three-comment thread, so several things a reader might want to know are simply not present:

  • The contents of chapter 1 are not described.
  • The total number of chapters is not stated.
  • No release date, version number, or pricing information appears in the source.
  • The other two comments on the thread are marked [dead] and contain no visible content, so they contribute nothing to the discussion.
  • There is no benchmark, comparison, or claim about the performance of the resulting model.

Readers evaluating the book should treat the landing page as the authoritative description and check the GitHub repository at BaraaSoft/node-llm for the current state of the code.

Why a TypeScript LLM implementation is notable

Most from-scratch LLM tutorials are written in Python, typically using NumPy or PyTorch. A Node.js and TypeScript implementation targets a different audience: JavaScript and TypeScript developers who want to understand transformer internals without switching language ecosystems, and who may want to run inference or training experiments in a Node runtime.

The book's emphasis on runnable per-chapter entry points and planned WebGPU demos suggests the intended experience is hands-on execution in the browser or in Node, rather than reading alone.

Sources