01 - Preheat oven to 350°F (175°C). Line a 12-cup muffin pan with paper liners.
02 - In a medium bowl, whisk together flour, baking powder, baking soda, salt, cinnamon, nutmeg, and ginger until evenly blended.
03 - In a large bowl, beat eggs, granulated sugar, vegetable oil, applesauce, and vanilla extract until well combined and slightly thickened.
04 - Gradually fold the dry mixture into the wet ingredients until just combined. Take care not to overmix.
05 - Fold in the grated carrots and, if using, chopped walnuts or pecans.
06 - Divide the batter evenly among the cupcake liners, filling each about three-quarters full.
07 - Bake for 20 to 22 minutes, or until a toothpick inserted into the center of a cupcake comes out clean.
08 - Let the cupcakes cool in the pan for 5 minutes, then transfer to a wire rack to cool completely.
09 - In a mixing bowl, beat softened butter and cream cheese until smooth and creamy. Gradually incorporate the powdered sugar, then add vanilla extract and a pinch of salt, beating until frosting is light and fluffy.
10 - Once the cupcakes are fully cooled, generously frost each with the cream cheese frosting.