In a large bowl, whisk the eggs until smooth.
Stir in the finely grated Parmesan cheese to create a thick, luscious paste.
Set this aside.
Peel and thinly slice the onions.
In a very large skillet (one that's big enough to hold all the pasta later), heat the olive oil over medium-high heat.
Add the onions and sauté, stirring occasionally, until they are soft, sweet, and beautifully golden brown around the edges.
While the onions cook, bring a large pot of generously salted water to a rolling boil.
Add the spaghetti and cook according to package directions until al dente—tender with a firm bite. Aim to have your onions ready just as the pasta finishes cooking.
Just before draining the pasta, scoop out and reserve about 1 cup / 240 ml of the starchy pasta water.
Drain the spaghetti thoroughly. Immediately take the skillet with the hot onions OFF THE HEAT.
Add the drained spaghetti directly into the skillet with the onions.
Working quickly, pour the egg and cheese mixture over the hot pasta. Use tongs to toss everything together vigorously and continuously for 1 to 2 minutes. The residual heat from the pasta and pan will cook the eggs into a creamy, glossy sauce that coats every strand.
Do not return the pan to the direct heat.
If the sauce seems too thick, stir in a splash of the reserved pasta water until it reaches your desired consistency.
Season with a little salt if needed and a generous amount of freshly ground black pepper.
Serve immediately on heated plates for the best experience.
Grate your own cheese. A block of high-quality Parmigiano-Reggiano grated just before use will melt far better and provide a much richer flavor than pre-shredded varieties.
Don't forget the pasta water. That starchy, salty water is the key to adjusting your sauce. It helps emulsify the fat and cheese, creating a perfectly silky consistency.
Work fast! The entire process of combining the pasta, onions, and egg mixture should happen quickly and off the heat. Have everything ready to go before you drain the pasta.