Opiates such as morphine and codeine are mainly obtained by extraction from opium poppies. Fermentative opiate production in microbes has also been investigated, and complete biosynthesis of opiates from a simple carbon source has recently been accomplished in yeast. Here we demonstrate that Escherichia coli serves as an efficient, robust and flexible platform for total opiate synthesis. Thebaine, the most important raw material in opioid preparations, is produced by stepwise culture of four engineered strains at yields of 2.1mgl−1 from glycerol, corresponding to a 300-fold increase from recently developed yeast systems. This improvement is presumably due to strong activity of enzymes related to thebaine synthesis from (R)-reticuline in E. coli. Furthermore, by adding two genes to the thebaine production system, we demonstrate the biosynthesis of hydrocodone, a clinically important opioid. Improvements in opiate production in this E. coli system represent a major step towards the development of alternative opiate production systems.