This recipe is adapted from thekitchn.com
2 1/2 pounds yellow onions
3 tablespoons unsalted butter
2 tablespoons olive oil
1 teaspoon salt, plus more to taste
Freshly ground black pepper
1/2 teaspoon sugar
8 cups beef, chicken, or vegetable broth
3 tablespoons flour
1/2 cup white wine, optional
1/4 cup brandy, optional
6 to 8 baguette slices, toasted
1 1/2 to 3 cups shredded Gruyere or Parmesan cheese (1/4 to 1/2 cup per serving)
Minced raw shallot or onion, to garnish
Peel and slice the onions into half moons. Cut the half moon slices in half. You want about 6 cups of chopped onions.
Melt the butter with the oil over medium-low heat in a large saucepan. Add the onions after the butter foams up and then settles down; stir to coat with the butter. Cover the pan and cook for 15 minutes on low heat.
Remove the lid. The onions should have wilted down somewhat. Stir in 1 teaspoon salt, a generous quantity of black pepper, and 1/2 teaspoon sugar (this helps the onions caramelize).
Turn the heat up to medium and cook, uncovered and stirring every few minutes, until the onions are deeply browned. Turn down the heat if the onions scorch or stick to the pan; the browning doesn't come through burning, but through slow, even caramelization. This will take about 20 minutes.
As the onions approach a deep walnut color, heat the broth in a separate pot. Add 3 tablespoons flour to the caramelized onions and cook and stir for about 1 minute.
Add the hot broth to the caramelized onions and bring to a boil. If using wine, add this now too. Lower the heat and partially cover the pan. (If you want to add other aromatics such as herbs or spices, do so now.) Cook gently over low heat for at least 1 hour or until the broth is slightly reduced.
Taste and season with additional salt and pepper if needed. Add a finishing splash of brandy, if desired!
Heat the oven to 350°F. Divide the soup between small but deep oven-safe bowls. Top each with a slice (or two) of toasted baguette and sprinkle grated cheese in a thick layer over the bread and up to the edge of the bowl. Place the bowls on a baking sheet or in a casserole dish. Bake until the cheese is thoroughly melted.
Turn the oven from bake to broil and broil the soup for 1 to 3 minutes or until the cheese is browned and bubbling. Remove carefully from the oven and let cool for a few minutes before serving on heatproof dishes or trivets. Serve with freshly ground pepper and minced fresh onion or shallot, which provides a welcome bite in contrast to the very sweet and mellow soup.