Preheat your oven to 350°F (180°C). Line a 6-cup muffin pan with cupcake liners and set aside to prepare for the deliciousness to come.
In a small bowl, whisk together the flour, cocoa powder, baking soda, and salt. This step is crucial for evenly distributing the dry ingredients.
In a large heat-safe bowl, place the chocolate and butter together. Melt them in the microwave, heating in 30-second intervals and stirring thoroughly each time, until fully melted. You'll know it's ready when the mixture is smooth and shiny.
Remove the bowl from heat and stir in the granulated sugar. Mix until well combined.
Add the egg, vanilla, and sour cream into the bowl. Use a whisk to fully incorporate these ingredients, scraping down the sides of the bowl as needed to ensure everything is mixed evenly.
Now, add in your dry ingredients from the small bowl. Whisk until just incorporated; over-mixing can lead to tough cupcakes!
In a small cup, combine the hot water and espresso powder (if using). Once mixed, pour it into the batter. Whisk carefully until the batter is smooth and combined; be cautious, as the hot water may splash.
Spoon the batter into the prepared muffin pan, filling each liner almost to the top. You’ll want to use about 4 tablespoons (62 g) of batter per cup.
Bake for 18 to 20 minutes, or until a toothpick inserted into the center of a cupcake comes out relatively clean with a few moist crumbs. Once baked, let them cool completely before frosting.
To make the frosting, start by melting the chocolate in a heat-safe bowl, using the same microwave method as before. Let it cool slightly.
In the bowl of a stand mixer or a large bowl with a handheld mixer, beat the unsalted butter on medium speed until creamy, about 1 minute. Next, add the powdered sugar, vanilla, milk, and a pinch of salt. Beat on low for 30 seconds, then increase the speed to medium-high and beat for 2 full minutes until fluffy.
Add in the cooled melted chocolate and beat the mixture on high speed for another 1 to 2 minutes until everything is fully combined and fluffy. If the frosting is too thin, you can add more powdered sugar; if too thick, just a splash of milk will do.
Frost your cooled cupcakes however you like, using your favorite frosting technique. Drizzle with chocolate syrup if desired. I love using a large open star piping tip (Wilton 1M) to create beautiful swirls.
Store any leftovers in an airtight container in the refrigerator for up to 4 days. Allow them to sit at room temperature for about an hour before serving to enjoy their full flavor and texture.