Cut the onion into small cubes and grate the Gouda.
Cook the spaetzle for 3 minutes according to package instructions.
Meanwhile, fry the onion and bacon cubes in oil on medium-high heat for roughly 5-8 minutes until the bacon is crispy and the onions are soft. Season with salt and pepper.
Preheat the oven to 180 °C / 356 °F with top and bottom heat.
Drain the cooked spaetzle and spread roughly half in a baking dish. Layer roughly half the onion and bacon mixture on top. Add the remaining spaetzle and onion-bacon mixture, then sprinkle the grated Gouda over everything.
Place the baking dish on the middle oven rack and bake for roughly 10-15 minutes until the cheese is golden brown.
While the dish bakes, halve or quarter the tomatoes and roughly chop the basil.
Top the spaetzle with the tomatoes and basil, and serve.