Preheat the oven to 180° C - 360° F (fan oven).
Peel and slice the onions and garlic.
Melt half of the butter in a pan and gently saute the onions along with the garlic and thyme on medium to low heat. This should take around 15 minutes until they are softened and slightly golden.
While sautéing the onions, peel and slice the potatoes. Use a mandolin or the slicer attachment on your food processor to slice the potatoes. You can cut by hand using a sharp knife if you have enough time and patience.
Brush an oven-safe baking dish (approximately 21 cm / 8.25" diameter) with soft butter and start building the boulangere potatoes.
Nicely arrange about ⅓ of the potatoes on the bottom of the dish and sprinkle on half of the onions.
Season with salt and pepper then arrange another ⅓ of the potatoes. Sprinkle the rest of the onions, season them, and nicely arrange the rest of the potatoes.
Add seasoning, stock, and scatter small cubes of remaining butter on top of the potatoes.
Cover the dish with a lid or tin foil and cook in preheated oven for 45 minutes.
Remove the lid or tin foil and cook for another 30 minutes until the stock is absorbed by the potatoes and the top layer is crisp.