Heat the olive oil in a large pot over medium heat until shimmering.
Add the onion, carrots, and celery. Cook for 5–7 minutes until softened.
Stir in the garlic and cook for 1 minute until fragrant.
Pour in the white wine (if using) and simmer for 2 minutes to reduce.
Add the vegetable broth, diced tomatoes, Italian seasoning, thyme, oregano, and red pepper flakes. Stir and bring to a light boil.
Add the cannellini beans and reduce heat to a simmer. Cook for 15 minutes.
Mash about one-third of the beans with a masher or blend with an immersion blender for creaminess.
Add chopped kale or spinach and cook until wilted, about 3 minutes. Stir in lemon juice and zest.
Season with salt and pepper. Stir in parsley and basil before serving.