Preheat the oven to 350°F (175°C). Line two baking sheets with parchment paper.
In a large mixing bowl, beat the softened butter, granulated sugar, and brown sugar for 3–4 minutes until light and fluffy.
Beat in the eggs one at a time, then mix in the vanilla extract.
In a separate bowl, whisk together the flour, cocoa powder, cornstarch, baking powder, baking soda, salt, and espresso powder if using.
Gradually mix the dry ingredients into the wet ingredients just until combined. Do not overmix.
Cover the bowl and refrigerate the dough for 45 minutes.
Scoop the dough into 1½ tablespoon (35–38g) portions and roll into smooth balls. Arrange them 2 inches apart on the prepared baking sheets.
Use the back of a rounded teaspoon or ½ teaspoon measuring spoon to press a deep indentation into the center of each cookie. If the edges crack slightly, gently smooth them with your fingertips.
Bake for 10–11 minutes, or until the edges are set and the centers still look slightly soft.
Immediately after removing the cookies from the oven, gently re-press the centers if they have puffed.
Let the cookies cool on the baking sheet for 5 minutes, then transfer them to a wire rack to cool completely.
To make the buttercream, beat the butter until creamy. Add the powdered sugar, peppermint extract, salt, and 1 tablespoon of heavy cream. Beat until light and fluffy, adding the remaining cream only if needed to reach a pipeable consistency. Mix in a drop of green food coloring if desired.
Pipe or spoon the buttercream into each cooled cookie.
Place the chopped chocolate and coconut oil in a microwave-safe bowl. Microwave in 20-second intervals, stirring after each, until completely smooth.
Drizzle the melted chocolate over the buttercream. Allow the chocolate to set for about 20–30 minutes before serving.