Cook macaroni according to package instructions, drain and set aside.
In a pot, melt butter over medium heat.
Add onion (if using) and cook until soft.
Stir in flour and cook for 1–2 minutes to form a roux.
Slowly add milk, whisking continuously until smooth and thickened.
Add cheese, mustard, salt, and pepper, and stir until melted into a creamy sauce.
Mix in the cooked macaroni.
Optional: transfer to a baking dish, top with extra cheese, and bake at 180°C for 10–15 minutes until golden.