Or, How Plants Build up Terpenoids in the Cells
Any time a living organism synthesizes a chemical compound on its own, we term that activity ‘biosynthesis.’ These chemical reactions are different than ones we do intest tubes because biological systems have a host of systems in place to drive energetically unfavorable reactions to completion, including enzyme catalyzers and energy currency in the form of adenosine triphosphate (ATP). Chemists mimic these processes by imbuing the system with heat, mechanical agitation, metal catalyzers and more, but these are mere shadows on the wall compared to the vast beauty and efficiency of a biological synthetic pathway.
Biosynthesis of cannabinoids generally takes place in the plant cells of leaves, which makes sense. Building up these complex molecules involves a large amount of energy expenditure, and leaves are the main powerhouse of the plant. Cannabinoids are also big and bulky; THC alone requires 21 carbon atoms. All this carbon matter has to come from somewhere, and in the case of plants, this matter comes right from the air—from carbon dioxide (CO2). Plants take up CO2 in their leaves, some of it becoming photosynthesized into molecular oxygen (O2) and some being catabolized into simple organic compounds for use throughout the plant.
Figure 1. Isopentyl diphosphate (1) and dimethylallyl diphosphate (2) are the precursor molecules of all terpenoids. They are shunted into the cannabinoid pathway by enzymatically catalyzing their addition into geranyl diphosphate (3).
Interestingly, cannabinoid biosynthesis is a branch of terpenoid biosynthesis, sharing the same precursor molecules and pathways (Figure 1). There is more than one pathway to create these precursors. Once these precursors are made, they are shunted into the cannabinoid pathway by a series of enzymatic reactions which produce the penultimate cannabinoid precursor cannabigerolic acid, or CBGa (Figure 2). 
Figure 2. Geranyl diphosphate (3) and olivetolic acid (4) are combined to form CBGa (5).
From there, the cannabinoids that we have discovered seem to differentiate mostly via non-catalyzed modifications to the skeletal structure. This explains the similar structure shared by all cannabinoids. These modifications include decarboxylation (loss of CO2 moiety), isomerization (structural rearrangement without change in chemical composition), and oxidation (loss of electrons).  There are also three enzymes that specifically modify CBGa into more specific cannabinoid moieties, including the all-important THCa and CBDa (Figure 3). 
Figure 3. CBGa is also modified by three particular enzymes, thereby producing cannabichromenic acid (CBCa) (6), THCa(7), or CBDa(8). The numbers surrounding the structures of 6 and 7 help identify the carbon atoms, facilitating understanding and communication.
Scientists have begun to explore ways to exploit the level of knowledge about cannabinoid biosynthesis we have obtained. Designing microorganisms to act as factories for expressing certain molecules has become standard practice in the pharmaceutical and biomedical industries. It should be no surprise to discover that research is being done regarding how to use microorganisms to act as biosynthesizers of cannabinoids.  This technology is still in its early stages, but the results indicate there may be a future for bacterial expression of cannabinoids ahead.
- Fellermeier, Monika, et al. “Biosynthesis of cannabinoids: Incorporation experiments with 13C-labeled glucose”. J. Biochem. 2001;268(6):1596-1604 [Times cited: 122, Journal impact factor: 4.530].
- Degenhardt, F. Handbook of Cannabis and Related Pathologies: Biology, Pharmacology, Diagnosis, and Treatment. Chapter 2 – The Biosynthesis of Cannabinoids. 2017, Pages 13-23.
- Carvalho, Angela, et al. “Designing microorganisms for heterologous biosynthesis of cannabinoids”. FEMS Yeast Res. 2017;17(4):fox037 [Times cited = 6, Journal impact factor = 1.630].