Preheat the oven to 350°F / 175°C. Line a 12-cup muffin pan with cupcake liners.
In a medium bowl, whisk the flour, cocoa powder, sugar, baking powder, baking soda, and salt.
In a separate bowl, whisk the milk, oil, egg, and vanilla extract until combined.
Add the wet ingredients to the dry ingredients and stir until mostly combined. Slowly stir in the hot coffee or hot water until the batter is smooth. Do not overmix.
Divide the batter between the cupcake liners, filling each about two-thirds full.
Bake for 18 to 20 minutes, or until a toothpick inserted into the center comes out clean or with a few moist crumbs.
Let cupcakes cool in the pan for 5 minutes, then transfer them to a wire rack to cool completely.
For the buttercream, beat the softened butter in a large bowl until creamy. Gradually add the powdered sugar, mixing on low speed until incorporated.
Add the vanilla extract, 2 tablespoons milk or cream, and salt. Beat until light and fluffy. Add another teaspoon of milk if needed for piping consistency.
Transfer about ¾ cup of frosting to a small bowl and tint it blue. Tint the remaining frosting red.
Pipe red buttercream onto the completely cooled cupcakes using a large star tip. Add small blue accents, or create a red-and-blue swirl if preferred.
Place black decorating gel or black buttercream in a small piping bag. Pipe circles over the red frosting, then drag a toothpick from the center outward to form a spider-web pattern.
Add optional cupcake toppers or sprinkles and serve.