Preheat the oven to 325°F convection (fan) or 350°F conventional (no fan). Line a 12-cup muffin pan with cupcake liners.
In a medium bowl, whisk together the flour, baking powder, cinnamon, and salt until evenly combined. Set aside.
In a large mixing bowl, whisk the eggs until smooth. Slowly whisk in the vegetable oil until fully emulsified and slightly thickened.
Whisk in the granulated sugar and light brown sugar until the mixture is smooth and homogeneous.
Fold the dry ingredients into the wet ingredients just until mostly incorporated. Add the grated carrots and walnuts (if using) and fold gently until evenly distributed and no dry pockets remain.
Divide the batter evenly between the prepared cupcake liners, filling each about ¾ full. Bake for 10–18 minutes, until the tops spring back lightly and a toothpick inserted in the center comes out with a few moist crumbs.
Let the cupcakes cool in the pan for 2 minutes, then transfer to a wire rack to cool completely before frosting.
In a large bowl, beat the cream cheese, butter, and powdered sugar together with an electric mixer until smooth and creamy.
Add the lemon juice and vanilla extract and mix until fully incorporated and silky.
Transfer the buttercream to a piping bag fitted with a large round tip and pipe a generous swirl onto each cooled cupcake. Serve immediately or store as directed.
Video
Notes
Yield: 12 cupcakes
Technique: Squeeze carrots thoroughly for best texture.
Storage: Store frosted cupcakes up to 3 days at room temperature or refrigerate.