Prep the beans: If using dried beans, soak them overnight or boil for 5 minutes and let them sit for 1 hour. Drain before using.
Sauté the vegetables: In a large pot, heat olive oil over medium heat. Add the diced onions, carrots, and celery, sautéing until tender, about 5-7 minutes.
Add garlic and seasonings: Stir in garlic, thyme, and bay leaf, cooking for an additional minute until fragrant.
Cook the soup: Add the soaked beans and vegetable broth to the pot. Bring to a boil, then reduce to a simmer. Cover and cook for about 1 hour or until beans are tender.
Add the ham (optional): For a meaty variation, stir in the diced ham and cook for another 10 minutes.
Season to taste: Adjust the salt and pepper, then remove the bay leaf.
Serve: Ladle the soup into bowls and enjoy!