Peel and finely chop or grate the garlic cloves. Peel the onions and finely slice them with a sharp knife. Trim the courgettes and cut into small dice. Halve the red chilli, flicking out the seeds and white pith for less heat, and finely chop the chilli. Roughly chop the tomatoes into small pieces.
Slide the onions, garlic, courgettes, tomatoes and chilli into a large pan. Add the spaghetti and sprinkle with a generous pinch of salt and pepper. Pour in 1 ltr boiling water and 2 tbsp oil. Cover, bring to the boil, then reduce to a simmer.
Cook the spaghetti for 20 mins, or till al dente. Use a pair of forks every so often during the cooking time to stir and separate the spaghetti strands and make sure they are covered by liquid.
While the spaghetti is cooking, trim and halve the French beans. Roughly shred the spinach. With 5 mins of cooking time remaining, stir both into the pan.
When the pasta has absorbed the liquid and is just tender, stir through the basil leaves and squeeze in the lemon juice. Have a taste and add more salt and pepper, if needed, before piling onto plates.