Preheat the oven to 350°F. Line a muffin tin with paper liners.
In a medium bowl, whisk together the flour, baking powder, baking soda, salt, and cinnamon. Set aside.
In a large mixing bowl, combine the vegetable oil, granulated sugar, brown sugar, eggs, and vanilla extract. Mix until well combined.
Gradually add the dry ingredients to the wet mixture, stirring until just combined. Avoid overmixing.
Fold in the grated carrots and chopped nuts if using.
Fill each cupcake liner about ¾ full with batter.
Bake for 20-24 minutes or until a toothpick inserted into the center comes out clean.
Let cupcakes cool in the pan for a few minutes before transferring them to a wire rack to cool completely.
To make the frosting, beat the softened cream cheese and butter together until smooth. Gradually add the powdered sugar, one cup at a time, mixing well after each addition. Stir in the vanilla extract.
Once the cupcakes are completely cool, frost them using a piping bag or an offset spatula. Optionally, sprinkle chopped nuts on top for decoration.