Set your oven to 350°F (175°C). Grease and flour an 8-inch round or square pan, or line it with parchment paper so the cake doesn’t stick.
In a medium bowl, sift together the whole wheat flour, baking soda, baking powder, cinnamon, nutmeg, and salt. This will make sure the dry ingredients are evenly mixed and lump-free.
In a larger bowl, whisk the eggs with the xylitol until they look light and slightly frothy. Add in the oil, applesauce, and vanilla extract, then whisk again until everything blends into a smooth mixture.
Slowly add the dry mixture into the wet mixture, stirring gently until fully combined. Don’t overmix just stir until no dry streaks remain.
Fold in the grated carrots, crushed pineapple, and, if you’re using them, the walnuts and raisins. This will add texture and moisture to the cake.
Pour the batter into your prepared pan and smooth the top. Place it in the oven and bake for about 30–35 minutes, or until a toothpick inserted in the middle comes out clean.
Let the cake cool in the pan for 10 minutes before transferring it to a wire rack. Allow it to cool completely before you frost it.
For the frosting, beat together ricotta cheese, vanilla, and a sugar substitute until creamy and smooth. If you like a lighter or slightly tangy frosting, stir in a little Greek yogurt.
Spread the frosting evenly over the cooled cake, then top with a sprinkle of chopped nuts if you want a finishing touch. Slice and enjoy!