Details of the recently elucidated biosynthetic pathways of caffeine and related purine alkaloids are reviewed. The main caffeine biosynthetic pathway is a sequence consisting of xanthosine-->7-methylxanthosine-->7-methylxanthine-->theobromine-->caffeine. Genes encoding N-methyltransferases involved in three of these four reactions have been isolated and the molecular structure of N-methyltransferases investigated. Pathways for the catabolism of caffeine have also been studied, although there are currently no reports of enzymatic and genetic studies having been successfully carried out. Metabolism of purine alkaloids in species including Camellia, Coffea, Theobroma and Ilex plants is summarised, and evidence for the involvement of caffeine in chemical defense and allelopathy is discussed. Finally, information is presented on metabolic engineering that has produced coffee seedlings with reduced caffeine content, and transgenic caffeine-producing tobacco plants with enhanced disease resistance.