Preheat the oven to 350°F. Grease 2 (9-inch) round cake pans with butter or baking spray and line the bottom of each pan with parchment paper.
Sift the flour, sugar, cocoa, baking soda, baking powder, and salt into a large mixing bowl and whisk to combine.
In a medium mixing bowl, whisk together the milk, egg, oil, and vanilla. Add to the flour mixture and whisk together until well combined. Pour in the boiling water or coffee and whisk until well combined.
Divide the batter between the prepared cake pans.
Bake for 35 minutes or until a toothpick inserted in the center comes out clean. Let the cakes cool in the pans on a wire cooling rack for 15 minutes. Carefully invert the cake layers onto the wire rack, remove the parchment paper, and let cool completely.
In the bowl of a stand mixer fitted with the paddle attachment, beat the butter on medium speed until soft and creamy, about 2 minutes. Add the cocoa powder and salt and mix on low speed until combined. Scrape the bowl down.
While mixing on low speed, gradually add in the powdered sugar alternating with a little bit of milk on occasion up to 4 tablespoons. Once the sugar is added, beat in the vanilla. Scrape down the bowl and beat on medium-low speed until light and fluffy, about 1 minute.
Place a cooled cake layer on a cake stand. Top with 1 cup of frosting and spread it out the edges in an even layer. Place the remaining cake layer on top and spread the rest of the frosting all over the outside of the cake.
