If using raw potatoes, peel them and grate them using a box grater or food processor. If using boiled potatoes, boil them in their skins until just tender, let them cool, peel, and then grate them.
Place the grated potatoes in a clean kitchen towel and squeeze out any excess moisture.
Heat a large, heavy skillet (preferably non-stick or cast iron) over medium heat. Add 1 tablespoon of butter or oil to the pan.
If using, sauté the finely chopped onion in the butter or oil until it becomes translucent.
Add the grated potatoes to the skillet, spreading them out evenly. Press them down gently with a spatula to form a flat cake.
Season with salt and black pepper to taste.
Cook for about 10-15 minutes, or until the bottom is golden brown and crispy.
Carefully flip the rösti using a large spatula or by inverting it onto a plate and sliding it back into the pan. Add another tablespoon of butter or oil to the pan before returning the rösti to cook the other side.
Cook for an additional 10-15 minutes, or until the second side is golden brown and crispy.
Once both sides are crispy and the potatoes are cooked through, remove the rösti from the pan and transfer it to a serving plate.
Cut into wedges and serve hot.
Enjoy your meal!