Preheat the oven to 350°F (175°C) and line a 12-cup muffin pan with paper liners.
In the bowl of a stand mixer, or in a large mixing bowl using a hand mixer, combine the dry ingredients: flour, granulated sugar, light brown sugar, baking soda, baking powder, salt, cinnamon, and nutmeg.
(1 1/4 cups / 157 g all-purpose flour, 1/2 cup / 100 g granulated sugar, 1/2 cup / 100 g packed light brown sugar, 3/4 teaspoon baking soda, 1/2 teaspoon baking powder, 1/2 teaspoon salt, 1 teaspoon cinnamon, 1/4 teaspoon nutmeg)
Add the oil and mix until incorporated. Add the eggs one at a time, beating well after each addition and scraping down the sides of the bowl to ensure even mixing.
(3/4 cup / 180 ml avocado oil, vegetable oil, or canola oil; 2 large eggs)
Stir in the vanilla extract and milk until fully combined.
(1 1/2 teaspoons vanilla extract, 2 tablespoons milk)
Fold in the grated carrots and, if using, chopped walnuts or pecans, mixing just until evenly distributed.
(1 1/2 cups / 170 g grated carrots; 1/2 cup / 60 g chopped walnuts or pecans, optional)
Divide the batter evenly among the cupcake liners, filling each about 2/3 to 3/4 full. Bake at 350°F (175°C) for approximately 20 minutes, or until a toothpick inserted into the center comes out clean or with just a few moist crumbs.
Let the cupcakes cool in the pan for 5 minutes, then transfer them to a wire rack to cool completely before decorating with the cream cheese frosting.
(1 batch Cream Cheese Frosting)