Chocolate and coffee have a rich history together and marry wonderfully. Like coffee, chocolate comes from a roasted tropical bean (also like coffee at first it was the fruit that was used and the bean was thrown away). The cacao tree (Theobroma cacao) produces fruits about the size of a small pineapple and inside these fruits are the cocoa beans. The two main varieties are Criollo and Forastero. Criollo account for 10% of the world crop, and have a finer, mild aroma and thus used for high-quality chocolates. The beans are collected, fermented for about a week, dried in the sun, exported (making sure they are kept dry), then roasted (130-150°F) and blended. The beans are blended because cocoa beans coming from different origins, have different flavor characteristics (like coffee beans). The meat of the bean (called the nib) is then removed from the shell in a process called winnowing which is normally done after roasting, but can be done before roasting for a different flavor.
The roasted nibs are ground into a fatty (Cacao is 54% fat), bitter, viscous liquid dubbed chocolate liquor. The finer the nibs are ground, the finer and fuller the chocolate will be (the particles should not exceed 75 microns). Cocoa oil is a solid up to about 90 degrees Fahrenheit, so if chocolate liquor is poured into a mold and allowed to cool you get bakers chocolate. If instead the fat is hydraulically pressed out of the chocolate liquor, you are left with cocoa butter and a cake of bean solids that can be ground up to make cocoa powder. Then, depending on the type of chocolate to be made, different ingredients are mixed. High quality semisweet and milk chocolate contain pure cocoa liquor with extra cocoa butter and some sugar, for milk chocolate milk solids are added (more milk than chocolate liquor).
White chocolate is just the cocoa butter with sugar and milk. Lecithin, to optimize molding, and vanilla flavoring, for aroma, are also often added. Lower quality chocolates will use a fat substitute for the cocoa butter which can be sold for a higher price in the industrial market. Incorporating the ingredients into chocolate is performed in a process called conching by a special machine that massages the chocolate at high temperatures for one to six days. Then, to prevent the cocoa butter from separating out when the chocolate solidifies, the chocolate is very carefully tempered. The added ingredients and proportions, the way conching is accomplished, and the way the chocolate is tempered comprises the art and science of making chocolate and are often closely guarded secrets.