In a large heavy-bottomed pot, melt the butter and olive oil over medium heat.
Add the sliced onions and sugar, stirring frequently to coat the onions. Cook for about 30–35 minutes until the onions are deeply caramelized and golden brown.
Stir in the minced garlic and thyme, cooking for an additional 1–2 minutes until fragrant.
Pour in the beef or vegetable broth and add the soy sauce. Bring the mixture to a simmer and let it cook for about 20 minutes. Season with salt and pepper to taste.
While the soup is simmering, preheat your oven to 400°F (200°C).
Arrange the baguette slices on a baking sheet and toast in the oven for about 8–10 minutes until golden brown.
To serve, ladle the soup into oven-safe bowls. Place a slice or two of toasted baguette on top of each bowl, then generously sprinkle with grated Gruyère cheese.
Place the bowls on a baking tray and bake in the oven for an additional 5–10 minutes until the cheese is bubbling and golden.
Remove from the oven, garnish with fresh parsley, and serve hot.