Preheat your oven to 350°F (175°C).
Prepare the green beans by trimming their ends and blanching them in boiling salted water for 3-4 minutes.
Drain the beans and plunge them into an ice bath to stop the cooking process. Drain well.
In a large skillet, melt the butter over medium heat. Add the sliced shallots and sauté until golden brown, about 8-10 minutes.
Sprinkle the flour over the shallots and stir to coat, cooking for 2 minutes to remove the raw taste of the flour.
Gradually whisk in the chicken broth and heavy cream, stirring constantly until the mixture thickens, about 5 minutes.
Season the sauce with salt and pepper, adjusting to taste, and remove from heat.
In a large bowl, combine the blanched green beans with the sauce, mixing until evenly coated.
Transfer the mixture into a greased baking dish and bake in the preheated oven for 25 minutes.
Remove the casserole, sprinkle the crispy fried onions on top, and return to the oven for an additional 10-15 minutes.
Once done, allow the casserole to sit for 5-10 minutes before serving.