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 the 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:
- The Underlying Theology (Polytheistic/Monotheistic/Buddhist/Other)
- The Quest
- The Magic Talisman (Holy Grail/One Ring/Magic Sword/Jewel)
- The Hero: Galahad the Pure, Gawain the Brave, Percival the Dumb (Naive), or Lancelot the Heavyweight Champion of the World.
- The Resident Wizard (Gandalf, Merlin, Belgarath)
- The Heroine (Ce'Nedra)
- The Villain (usually with some diabolical agenda)
- The Companions (generally a multicultural crew who can protect the hero until he defeats the villain)
- The Romantic Interests for 8.(NB: both 8&9 must be well-rounded groups, with individualised personalities and flaws)
- The kings, queens, emperors, generals, courtiers and such, who make up the governments of the world.