Prepare the Cake:
- Preheat and prep: Preheat your oven to 350°F (175°C). Grease two 9-inch round cake pans with butter or cooking spray, line the bottoms with parchment paper circles, and grease the parchment. Lightly dust with flour and tap out excess.
- Mix dry ingredients: In a large bowl, whisk together the flour, baking powder, baking soda, salt, cinnamon, nutmeg, and ginger until well combined with no lumps. Set aside.
- Combine wet ingredients: In another large bowl, whisk together the eggs, granulated sugar, and brown sugar until well combined and slightly lightened, about 1-2 minutes. Add the oil and vanilla extract, whisking until smooth and emulsified.
- Combine wet and dry: Pour the wet ingredients into the dry ingredients. Using a wooden spoon or rubber spatula, gently fold together until just combined. Don’t overmix—a few small lumps are fine. Overmixing will result in a tough cake.
- Add the mix-ins: Gently fold in the grated carrots, crushed pineapple with its juice, toasted walnuts, and coconut (if using). Fold until everything is evenly distributed throughout the batter. The batter will be thick and chunky—this is perfect!
- Divide and bake: Divide the batter evenly between the prepared pans, smoothing the tops with a spatula. Tap the pans gently on the counter a few times to release any air bubbles. Bake for 30-35 minutes, or until a toothpick inserted into the center comes out clean or with just a few moist crumbs. The cakes should spring back when gently pressed.
- Cool completely: Let the cakes cool in the pans on wire racks for 15 minutes. Then carefully run a knife around the edges and invert the cakes onto the racks. Remove the parchment paper and let them cool completely before frosting—at least 1 hour. This is crucial! Frosting warm cake will result in a melty mess.
Make the Cream Cheese Frosting:
- Beat cream cheese and butter: In a large bowl using an electric mixer, beat the softened cream cheese and butter together on medium-high speed until completely smooth and creamy, about 2-3 minutes. Scrape down the sides of the bowl as needed.
- Add sugar and vanilla: With the mixer on low speed, gradually add the sifted powdered sugar, about 1 cup at a time, mixing well after each addition. Add the vanilla extract and a pinch of salt. Once all the sugar is incorporated, increase speed to medium-high and beat for 2-3 minutes until the frosting is light, fluffy, and perfectly smooth.
Assemble the Cake:
- Level the cakes (optional): If your cakes have domed tops, use a serrated knife to carefully level them for easier stacking.
- Frost the first layer: Place one cake layer on a serving plate or cake stand. Spread about 1½ cups of frosting evenly over the top, going all the way to the edges.
- Add second layer: Carefully place the second cake layer on top, flat side up. Gently press down to secure.
- Frost the outside: Use the remaining frosting to cover the top and sides of the cake. Start with a thin crumb coat (a very thin layer to seal in crumbs), then chill for 15 minutes. Apply the final layer of frosting, swirling it decoratively with an offset spatula or the back of a spoon.
- Decorate and chill: Garnish with additional chopped walnuts, a sprinkle of cinnamon, or carrot decorations if desired. Refrigerate the cake for at least 30 minutes before slicing for clean, beautiful cuts.