Slice the onion in 2mm thick slices. You can use a mandolin or a knife.
Add the butter to a large pot over medium heat. Once melted, add the onions, bayleaf and thyme leaves plus a pinch of salt. The salt helps the onion sweat a bit faster.
Mix every 3-5 minute to make sure it's not sticking. You will notice that the volume of onions will rapidly reduce.
Pay more attention to the onion once there's no liquid left because it could stick to the bottom of the pan and burn. Be patient, the caramelization of the onions takes time but is really worth it! If you see golden bits stuck to the bottom of the pan you can use the onions to scrape them off. If at any time there are too many stuck bits or they look like they could burn, add a drizzle of water and scrap everything down. Do this only when necessary because you're stopping the caramelization process every time you add water.
Once they look deeply golden (like the colour of the final soup), stop.
Add the stock and mix. Still over medium heat, wait for the mix to come to a boil.
From the moment it breaks into a boil, decrease the heat to a minimum and let it simmer without a lid on for 30 minutes.
Add pepper before serving and adjust the salt level, too.