Back to directory

PI from Scratch

An article and companion website that walks through writing a minimal TypeScript coding agent, called nano-pi, from scratch, with source code that fills in as you read and a step-by-step execution trace.

Visit website (opens in a new tab)pi-from-scratch.vercel.app
PI from Scratch

PI from Scratch is a written walkthrough, published as a website, that builds a small coding agent called nano-pi from zero, following the structure of the existing "pi" agent. The article and an accompanying code editor are shown side by side: as the article progresses, the source code shown alongside it fills in a piece at a time, and by the end the complete nano-pi implementation is visible in the editor.

The project also includes a trace viewer that lets a reader step through the agent's execution line by line to see how a coding agent's control flow works. Running nano-pi locally requires Node.js 22 or later and an OpenAI-compatible API; the online version replays a pre-recorded trace and does not call any model.

It is written in TypeScript and released under the MIT license.

More in Tutorials

See all 478
  • BootLife

    github.com

    Conway's Game of Life implemented to run directly from a 512-byte x86 boot sector in assembly, using VGA memory itself as the simulation grid.

  • A technical blog post deriving the Y combinator as a composition of combinator birds in an array language, and examining how eager evaluation changes fixed-point recursion compared with the usual lazy telling.

  • System Design Atlas

    atlas-sysdes.vercel.app

    A free reference of worked system design problems with interactive architecture diagrams, covering ranked designs such as a feed, a chat app, a URL shortener, and a rate limiter, plus pages on the technologies behind them.