Preheat your oven to 350°F (175°C) and line two 12-cup muffin tins with cupcake liners (you'll fill 18 cups total). Lightly spray the inside of the liners with non-stick cooking spray if desired.
Peel 3–4 medium carrots and grate them using the fine side of a box grater to get 2 cups (240g). Do not squeeze out the moisture — set the grated carrots aside.
In a medium bowl, whisk together the flour, baking powder, baking soda, salt, cinnamon, nutmeg, and ginger until fully combined with no streaks. Set aside.
In a large bowl, whisk together the vegetable oil, granulated sugar, and brown sugar for 1 minute, then whisk in the eggs one at a time followed by the vanilla extract.
Pour the dry ingredients into the wet ingredients and fold together with a rubber spatula until just combined — stop as soon as no dry flour streaks remain. Do not overmix.
Gently fold in the grated carrots and chopped walnuts or pecans (if using) until evenly distributed throughout the batter.
Using an ice cream scoop or large spoon, fill each cupcake liner approximately ⅔ full, keeping portions roughly equal for even baking.
Bake on the center rack for 20–23 minutes, or until a toothpick inserted in the center comes out clean or with just a few moist crumbs. Cool in the pan for 5 minutes, then transfer to a wire rack to cool completely.
Beat the softened cream cheese and butter together on medium speed for 2–3 minutes until fluffy and smooth, then gradually mix in the sifted powdered sugar, vanilla, and a pinch of salt. Add heavy cream 1 tablespoon at a time to reach your desired piping consistency.
Once cupcakes are completely cool, pipe or spread the cream cheese frosting on top. Garnish with a sprinkle of cinnamon, chopped nuts, or a decorative candy carrot if desired.