Thinly slice your onion, and add it to a pan with the melted butter. Cook the onions low and slow (20 - 30 minutes) until they are golden and soft and caramelized.
While the onions are caramelizing, peel and thinly slice your potatoes either using a knife or a mandolin.
Preheat your oven to 200C | 395F.
Add the seasonings and the flour, stirring into the onion mixture to cook off the flour.
Pour in your milk, stirring constantly until the sauce begins to thicken (3-5 minutes). Don’t let the milk boil.
Place a tablespoon or two of the onion roux sauce in the bottom of your baking dish, then add your potatoes. I like to stack the potatoes facing up as I think this gives the dish a really striking look, but you could also stack them vertically!
Pour over the rest of the creamy sauce, using a spoon to nestle the sauce in between all the slices of potatoes. Make sure the potatoes are fully covered by the sauce.
Top with the grated cheese, if using.
Cover the dish with foil and bake for 40 minutes, then remove the foil and bake for a further 25 - 30 minutes until the top is golden and bubbly.
