The Rivan Codex is a collection of background material to the Belgariad and Malloreon fantasy saga by David and Leigh Eddings. It consists of two bodies of material used in writing the novels, one for each series, with three informal essays by David Eddings. Belgarath the Sorcerer and Polgara the Sorceress do not have dedicated sections, but are referred to in Eddings' discussions, and drew on the material of the first ten books. In particular, one text presented in the background to the Belgariad forms the basis for the first chapter of Belgarath the Sorcerer.
The Rivan Codex also contains the holy writings of the various religions in the world and the economic diversities of the different countries.
One of the essays also lists the following formula for epic fantasy: