In a heatproof bowl, melt the butter and chocolate together in the microwave in 15-second bursts, stirring between each interval, or use a double boiler.
Let the melted chocolate mixture cool for 5 minutes.
In a large bowl, beat the eggs, granulated sugar, and brown sugar together for 1-2 minutes until light and fluffy.
Slowly mix in the melted chocolate and butter mixture, followed by the vanilla extract and espresso powder (if using).
In a separate bowl, whisk together the flour, cocoa powder, baking powder, and salt.
Gradually fold the dry ingredients into the wet mixture until combined. Be careful not to overmix.
Gently fold in the chocolate chips or chunks.
Chill the dough for 15-20 minutes if it appears too loose to scoop.
Preheat the oven to 350°F (175°C) and line a baking sheet with parchment paper.
Scoop about 1 1/2 to 2 tablespoons of dough onto the prepared baking sheet, spacing them at least 2 inches apart.
Bake for 10-12 minutes, until the tops look set and slightly crackly, but the centers remain soft.
Let cookies cool on the baking sheet for 2 minutes before transferring them to a cooling rack.