First prepare your green beans. You can use frozen green beans but I really prefer to use fresh green beans. Once you've prepared them, heat up a pot of boiling water with 2 Tbsp. of Salt. Now add your green beans, cook them until they turn bright green and have a little bit of crunch. I've made the mistake in the past where they are too crunchy, so taste a couple before you settle.
Once they've cooked, immediately dump them in a ice bath, and then allow them to dry. Set aside.
Now onto the mushroom filling. First heat up your butter, then add your minced onions, garlic , and thyme. Allow them to soften up, once that's happened, add your mushrooms. Allow the liquid to reduce down and then add your flour (spreading it over the entire dish). Stir to make sure the flour is mixed well into the dish, and then add your chicken broth. Stir this so you have no clumps, and allow the broth to reduce slightly.
Now add your cream and stir slightly.
Pour the green beans into a Pyrex that can hold all the green beans. Then add your filling over the green beans.
Now it's time to make your onion topping, you can opt and use canned Fried Onions, they do taste great I can't deny that. If you opt in to making them from scratch here you go. Coat the diced onions in the flour and salt and then fry in the peanut oil. The onions will probably not get as crispy as you'd like which is OK. Spread them out on a baking sheet and bake them at 300F (if you have a convection oven use that function). Bake for about 15-20 minutes so they get crispy and then set aside.
Bake your green bean casserole in the oven for 20-30 minutes, in the last 5 minutes add your onion topping and enjoy!