Cook the spaetzle al dente, about 15 minutes in salted water.
Add a layer of cooked spaetzle to a casserole dish. Top with a layer of sauerkraut, then a layer of cheese. Season top with salt and pepper.
Repeat for a second layer, and a third if needed.
Heat the olive oil in a pan and brown the sliced onion. Place the browned onions on top of the casserole.
Bake at 450 just till the cheese is melted and the sauerkraut is warmed, about 20 minutes.
For a juicier casserole, add some or all of the reserved sauerkraut juice to the casserole before baking.