01 - Preheat oven to 350°F. Generously grease a 9-inch pie dish or springform pan with butter or cooking spray.
02 - Boil spaghetti in salted water until al dente according to package directions. Drain thoroughly and transfer to a large bowl.
03 - Melt butter in a skillet over medium heat. Cook onion and bell pepper for 4–5 minutes until softened. Add garlic and cook 1 additional minute. Remove from heat.
04 - Whisk together eggs, milk, Italian herbs, salt, pepper, and red pepper flakes in a separate bowl until well combined.
05 - Add cooked spaghetti, sautéed vegetables, mozzarella, and half the Parmesan to the egg mixture. Fold gently until pasta is evenly coated.
06 - Pour mixture into prepared pie dish and spread evenly. Sprinkle remaining Parmesan cheese over the surface.
07 - Bake for 35–40 minutes until center is firm and top is golden brown. A knife inserted in the center should come out clean.
08 - Let cool for 10 minutes before slicing. This allows the pie to set for cleaner portions. Garnish with chopped fresh basil or parsley.