Set your oven to 375°F (190°C) and prepare a baking sheet by lining it with parchment paper.
Carefully remove the insides of the zucchini halves, forming hollow boats, and put them aside.
Warm the olive oil in a frying pan over medium heat, then add the minced garlic and chopped onion and cook for roughly 2 minutes until fragrant.
Add the chopped mushrooms and sauté for 3 to 4 minutes until they soften.
Toss in the chopped spinach and cook until it wilts, about 2 minutes, then take the pan off the heat.
Combine the ricotta, grated Parmesan, red pepper flakes if using, and season with salt and pepper to your liking.
Fill each zucchini boat evenly with the ricotta mixture.
Arrange the stuffed zucchinis on the prepared baking sheet and bake for 20 to 25 minutes, or until the zucchini is tender.
Sprinkle fresh basil on top if you want and enjoy warm.