Learn Ghost

How Ghost works inside, for the people who build it.

Ghost is a self-hosted git hosting platform: push and pull over HTTP or SSH, browse code, open issues and pull requests, review, merge. This course explains how it works inside, why it is built the way it is, and where each piece lives in the repository.

It is written for two readers: whoever maintains Ghost, and anyone about to send their first change.

How to use this course

Read the chapters in order the first time. Later chapters lean on earlier ones, especially Storage, which everything that touches git depends on.

Every lesson has three kinds of material:

  • Explanation, with diagrams, and links into the code. A link like apps/api/src/git/git.service.ts › receivePack opens the file on GitHub; the name after › is what to search for in it.
  • Try it boxes. Something to run, read or change in your own checkout. Do them. Reading about a compare-and-swap teaches less than watching one fail.
  • Check yourself questions at the end. Answer before you click. If you get one wrong, reread the section it came from.

The design decisions in docs/ (the ADRs) are the primary source. Lessons summarize them and link to each one; when a lesson and an ADR disagree, the ADR and the code win.

The map

Running this course

bun run --filter @ghost/learn dev     # http://localhost:3005

Lessons are MDX files under apps/learn/content/learn. When the code changes in a way a lesson describes, change the lesson in the same pull request.

On this page