For the cupcakes
Preheat oven to 350°F. Line a standard muffin tins with 12 paper liners.
Into a large mixing bowl or the bowl of a stand mixer fitted with the paddle, place the sugar, flour, cocoa, baking powder, baking soda, and salt. Mix on low speed until well-combined.
Add egg, milk, oil, and vanilla extract. Mix on medium speed until batter is smooth.
Pour in boiling water and carefully mix on low until just incorporated.
Divide batter among muffin cups.
Bake cupcakes for about 18 minutes, until a tester comes out clean.
Cool completely on a wire rack before frosting.
For the frosting
Sift the powdered sugar into a very large mixing bowl or the bowl of a stand mixer fitted with the paddle.
Add the butter and mix, on low at first and increasing speed as you go, until smooth and creamy. This will take several minutes at least. (It will stay crumbly for quite a while before smoothing out.)
Add the cream cheese and vanilla and beat until smooth and fluffy. If not using gelatin, the frosting is ready.
If using the gelatin, sprinkle it over the water in a 1-cup glass measuring cup or similar-size microwave-safe bowl. Stir once and then leave it alone for about a minute.
Place in microwave and heat until boiling, which happens very quickly. In my strong microwave, it takes only about ten seconds.
Stir well and cool slightly.
With the mixer running, slowly stream gelatin into frosting and beat until fully incorporated. I like to use a rubber spatula for a final mix after beating just to be sure everything is well-combined.
Chill for at least two hours before using.