Preheat your oven to 350°F (175°C). Line a baking sheet with parchment paper to prevent sticking.
In a large bowl, sift together the all-purpose flour, unsweetened cocoa powder, baking powder, baking soda, salt, and instant espresso powder if using. This ensures the leavening agents and flavorings are well distributed.
In a separate bowl, beat the eggs with granulated sugar and vanilla extract until the mixture is thick and pale, about 2-3 minutes. This helps create a tender crumb inside the biscotti.
Gradually add the dry ingredients to the wet ingredients and mix until just combined. Fold in the chocolate chips and chopped nuts if using. The dough will be dense but manageable.
Divide the dough in half. On the prepared baking sheet, shape each half into a log about 12 inches long and 2 inches wide. Flatten slightly to form an even shape for even baking.
Bake the logs for 25-30 minutes, or until firm to the touch. Remove from the oven and let cool for about 10 minutes; this step is crucial before slicing.
Using a sharp serrated knife, slice the logs diagonally into 1/2-inch thick pieces. Lay them cut side down on the baking sheet for the second bake.
Bake the slices for an additional 10-15 minutes on each side, flipping halfway through, until the biscotti are crisp and dry. Cool completely on a wire rack.