Preheat oven to 375°F. Line baking sheets with parchment paper.
In a stand mixer fitted with the paddle attachment, cream together the butter, granulated sugar, and brown sugar for 2–3 minutes until light and fluffy.
Add eggs and vanilla extract. Mix until fully combined, scraping down the sides of the bowl as needed.
Add flour, cocoa powder, baking soda, baking powder, espresso powder (if using), and sea salt. Mix on low speed until just combined.
Fold in the dark chocolate chips, mini chocolate chips, and M&M's.
Using a 3-tablespoon cookie scoop, portion dough onto prepared baking sheets, leaving about 2 inches between cookies.
Bake for 10–12 minutes, until the edges are set and the centers still appear slightly soft.
Remove from the oven and immediately sprinkle with flaky sea salt. Then tap a few times on the counter.
Allow cookies to cool on the baking sheet for 5–10 minutes before transferring to a wire rack.