Preheat oven to 350°F (175°C). Grease and flour two 9-inch round cake pans.
In a large bowl, whisk together the flour, baking soda, salt, cinnamon, nutmeg, and cloves.
In a separate bowl, whisk together the granulated sugar, vegetable oil, eggs, applesauce, and vanilla extract until well combined.
Add the wet ingredients to the dry ingredients and mix until just combined. Do not overmix.
Fold in the grated carrots and chopped nuts (if using).
Divide the batter evenly between the prepared cake pans. Bake for 30-35 minutes, or until a wooden skewer inserted into the center comes out clean.
Let the cakes cool in the pans for 10 minutes before inverting them onto a wire rack to cool completely.
While the cakes are cooling, prepare the cream cheese frosting. In a large bowl, beat the softened cream cheese and butter until smooth and creamy.
Gradually beat in the powdered sugar, alternating with the vanilla extract and milk/cream, until the frosting is smooth and fluffy.
Once the cakes are completely cool, frost the top of one cake layer and then place the second cake layer on top. Frost the top and sides of the entire cake.
Refrigerate the cake for at least 30 minutes before slicing and serving to allow the frosting to set.
Notes
For best results, ensure all ingredients for the frosting are at room temperature.