Sauté the aromatics: Warm olive oil in a large pot over medium heat. Add onion and leek (if using) with a pinch of salt.
Cook 5–7 minutes until soft and glossy. Stir in garlic and cook 30 seconds until fragrant.
Build the base: Add carrots, celery, and potatoes. Stir to coat with oil.
Cook 3–4 minutes to start softening the edges.
Add broth and herbs: Pour in broth and add bay leaf and thyme. If using diced tomatoes, add them now. Bring to a gentle boil, then reduce to a lively simmer.
Cook 10 minutes.
Layer the tender veg: Add zucchini and green beans. Simmer another 8–10 minutes, until all vegetables are just tender.
Stir in beans and pasta: Add the white beans and pasta. Simmer until the pasta is al dente, usually 7–10 minutes depending on shape.
Taste and season with salt and pepper.
Make the pistou: While the pasta cooks, blend basil, garlic, cheese (if using), and a pinch of salt in a food processor. Stream in olive oil until it forms a loose, spoonable sauce. Adjust salt to taste.
For a mortar-and-pestle version, pound garlic and salt first, then basil, then stir in cheese and oil.
Finish and serve: Remove the bay leaf. Ladle the hot soup into bowls. Swirl in a spoonful or two of pistou on top of each serving. Do not boil pistou in the pot—keep it bright by adding at the end.