Preheat the oven to 350°F
Cook spaghetti until al dente
Drain the spaghetti
Brown ground beef or Italian sausage in a skillet
Add chopped onion and garlic
Stir in marinara sauce
Season with salt, pepper, and Italian seasoning
Mix the cooked spaghetti with the sauce
Stir in ricotta or cream cheese if desired
Transfer the mixture to a greased baking dish
Top with shredded mozzarella and Parmesan cheese
Bake for 20 to 25 minutes
Broil briefly until the top is golden, if desired
Let it rest for a few minutes before serving
