Preheat the oven to 350°F (175°C). Grease and line an 8×8-inch or 9×9-inch baking pan with parchment paper, leaving some overhang for easy removal.
Mix Dry Ingredients: In a bowl, whisk together flour, baking powder, baking soda, cinnamon, nutmeg, and salt.
In a separate large bowl, whisk granulated sugar, brown sugar, eggs, vegetable oil, and vanilla until smooth.
Make the Batter: Gradually add the dry ingredients to the wet mixture, stirring gently. Fold in grated carrots and nuts (if using) without overmixing.
Bake: Pour batter into the pan, spread evenly, and bake for 25–30 minutes. A toothpick should come out clean. Let bars cool completely.
Make Frosting: Beat softened cream cheese and butter until smooth. Gradually mix in powdered sugar, then stir in vanilla extract.
Frost & Serve: Spread frosting over cooled bars, slice into squares, and enjoy! Sprinkle with chopped nuts or cinnamon for extra flavor.