Whisk the 8 eggs in a mixing bowl until smooth. Slowly add the flour (starting with 400 g, adding more as needed) until smooth. Add a pinch of salt and roughly 100 ml of water (adding more as needed). Beat vigorously with a spoon for 2-3 minutes until the dough is bubbly and glossy. Cover and let rest for 30 minutes, then beat again for 1 minute before cooking.
Bring a large saucepan of salted water to a boil over high heat. Using a spaetzle maker or knife scraping technique, portion the dough and scrape it directly into the boiling water (if using a board, position it over the pan edge so strips fall straight in). Work in batches if needed.
Once the spaetzle float to the surface, cook for 1-2 more minutes. Use a skimmer to transfer them to a bowl of clean water, rinse well, and drain in a sieve.
Slice the onions into rings. Heat the butter in a pan over medium heat and cook the onions, stirring occasionally, for 8-10 minutes until golden brown. In a baking dish, alternately layer the onions, grated cheese, and spaetzle. Bake at 200 °C (392 °F) for 12-14 minutes until the cheese melts.