Melt the chocolate. Set a medium, heatproof bowl over a pan of barely simmering water. Melt the chocolate, stirring occasionally. Remove the bowl from the heat and let it cool on the counter. If you're baking the cake far ahead of frosting it, skip this step until you're ready to frost but give the chocolate about 30 minutes to cool.
Prep. Grease and flour (2) 6-inch baking rounds. Preheat the oven to 350°F.
Mix the dry ingredients. In the bowl of a standing mixer with the paddle attachment or in a mixing bowl, add flour, sugar, cocoa powder, espresso powder, baking powder, and baking soda. Whisk until combined.
Mix the wet ingredients. At low speed, add the egg, oil, milk, and vanilla. Mix on medium speed for 1 to 2 minutes until the wet ingredients are fully incorporated. Carefully add the boiling water and mix on low speed for about 30 seconds, scraping down the sides and bottom of the bowl.
Bake. Divide the batter evenly between the two pans. Bake for 18 to 22 minutes. Let cool for 5 minutes in the pan, then run a butter knife around the edges and flip onto a wire cooling rack. Let the cakes cool completely before frosting. They can be transferred to the fridge for a few minutes if needed.
Make the frosting. In the bowl of a standing mixer with the paddle attachment or in a mixing bowl with a hand mixer, beat the butter until pale and fluffy. Add the confectioner's sugar and vanilla, slowly increase speed to medium-high as sugar incorporates. Reduce the mixer speed and pour in the cooled chocolate, beat for about 1 minute, scrape down the sides and bottom of the bowl. Add the heavy cream and beat for about 30 seconds.
Frost. Frost the bottom layer of cake. Top with the second cake layer and cover with the remaining frosting spreading the frosting over the top of the cake and down the sides. Use a spoon to swirl the frosting. Optional: top with shaved chocolate, sea salt, or caramel drizzle.