Start by heating olive oil in a large skillet over medium heat. Add the sliced onions and cook slowly, stirring often until they turn golden and soft. This step takes patience but builds deep flavor.
Once the onions are caramelized, stir in the garlic and thyme. Cook for another minute until fragrant. Make sure not to burn the garlic, as it can turn bitter.
Season with salt and pepper, adjusting to taste. The onions should be sweet, rich, and slightly jammy at this stage.
Add the drained white beans into the skillet with the onions. Gently stir to combine so the beans don’t break apart. Let them soak up the onion flavor for a few minutes.
Pour in the broth and mix well. This adds moisture and helps create a soft, stew-like base for the bake. Simmer briefly so everything blends nicely.
Taste and adjust seasoning if needed. The mixture should be well-balanced before baking.
Transfer the bean mixture into a baking dish, spreading it evenly. Arrange slices of bread on top, slightly overlapping. This creates a rustic and hearty topping.
Sprinkle the grated Gruyère and Parmesan cheese generously over the bread. Make sure everything is well covered for a golden crust.
Bake in a preheated oven at 180°C (350°F) until the top is bubbly and golden. The cheese should melt beautifully and form a crisp layer.