A cupcake is comprised to the majority of carbohydrates such as starch, which can take form as amylose or amylopectin. When chewing the cupcake in the mouth, starch begins to digest since an enzyme called amylase is present in the saliva. Amylase starts breaking down the alpha 1,4 glycosidic bonds, while the alpha 1,6 glycosidic bonds in amylopectin can't be broken down.
From the mouth, the cupcake, in the form of a bolus, enters the oesophagus and moves to the stomach via peristalsis (waves of contractions and relaxations of longitudinal and circular muscles). In the stomach, the food is churned with acid, which kills bacteria and starts the digestion of proteins, and forms into chyme.
In the duodenum of the small intestine, the acid from the stomach is being neutralised and the digestive enzymes from the acinar cells of the pancreas are secreted. Thereby, amylase breaks down starch into maltose, maltotriose and dextrins, endopeptidase breaks down proteins into smaller polypeptides, and lipase breaks down lipids into fatty acids and glycerol.
In addition to this, although the pancreatic enzymes have been breaking down the molecules, these molecules are still too big for absorption into the villi. Therefore, the walls of the small intestine contains glands in order to release enzymes (e.g., maltase, glucosidase and dextrinase) into the intestinal epithelial cells, which break down maltose into glucose, dipeptides into amino acids, etc. for absorption across the epithelial cells.