Many microbes (phototrophs) are capable of using light as a source of energy to produce ATP and organic compounds such as carbohydrates, lipids, and proteins.  Of these, algae are particularly significant because they are oxygenic, using water as an electron donor for electron transfer during photosynthesis.  Phototrophic bacteria are found in the phyla "Cyanobacteria", Chlorobiota, Pseudomonadota, Chloroflexota, and Bacillota. Along with plants these microbes are responsible for all biological generation of oxygen gas on Earth. Because chloroplasts were derived from a lineage of the Cyanobacteria, the general principles of metabolism in these endosymbionts can also be applied to chloroplasts. In addition to oxygenic photosynthesis, many bacteria can also photosynthesize anaerobically, typically using sulfide () as an electron donor to produce sulfate.  Inorganic sulfur (), thiosulfate () and ferrous iron () can also be used by some organisms.  Phylogenetically, all oxygenic photosynthetic bacteria are Cyanobacteria, while anoxygenic photosynthetic bacteria belong to the purple bacteria (Pseudomonadota), Green sulfur bacteria (e.g., Chlorobium), Green non-sulfur bacteria (e.g., Chloroflexus), or the heliobacteria (Low %G+C Gram positives).  In addition to these organisms, some microbes (e.g. the Archaeon Halobacterium or the bacterium Roseobacter, among others) can utilize light to produce energy using the enzyme bacteriorhodopsin, a light-driven proton pump. However, there are no known Archaea that carry out photosynthesis.
As befits the large diversity of photosynthetic bacteria, there are many different mechanisms by which light is converted into energy for metabolism.  All photosynthetic organisms locate their photosynthetic reaction centers within a membrane, which may be invaginations of the cytoplasmic membrane (Pseudomonadota), thylakoid membranes ("Cyanobacteria"), specialized antenna structures called chlorosomes (Green sulfur and non-sulfur bacteria), or the cytoplasmic membrane itself (heliobacteria).  Different photosynthetic bacteria also contain different photosynthetic pigments, such as chlorophylls and carotenoids, allowing them to take advantage of different portions of the electromagnetic spectrum and thereby inhabit different niches. Some groups of organisms contain more specialized light-harvesting structures (e.g. phycobilisomes in Cyanobacteria and chlorosomes in Green sulfur and non-sulfur bacteria), allowing for increased efficiency in light utilization.
Biochemically, anoxygenic photosynthesis is very different from oxygenic photosynthesis.  Cyanobacteria (and by extension, chloroplasts) use the Z scheme of electron flow in which electrons eventually are used to form NADH.  Two different reaction centers (photosystems) are used and proton motive force is generated both by using cyclic electron flow and the quinone pool. In anoxygenic photosynthetic bacteria, electron flow is cyclic, with all electrons used in photosynthesis eventually being transferred back to the single reaction center.  A proton motive force is generated using only the quinone pool.  In heliobacteria, Green sulfur, and Green non-sulfur bacteria, NADH is formed using the protein ferredoxin, an energetically favorable reaction.  In purple bacteria, NADH is formed by reverse electron flow due to the lower chemical potential of this reaction center.  In all cases, however, a proton motive force is generated and used to drive ATP production via an ATPase.
Most photosynthetic microbes are autotrophic, fixing carbon dioxide via the Calvin cycle.  Some photosynthetic bacteria (e.g. Chloroflexus) are photoheterotrophs, meaning that they use organic carbon compounds as a carbon source for growth.  Some photosynthetic organisms also fix nitrogen (see below).