Boil the pasta: Cook thin spaghetti in salted water until al dente. Drain and toss with a little olive oil to prevent sticking.
Make the sauce: In a skillet, heat olive oil and sauté onions until soft. Add garlic and cook briefly. Stir in ground beef and brown. Add marinara sauce, tomato paste, seasonings, and simmer for 10 minutes.
Preheat the oven: Set to 375°F (190°C).
Layer the dish: In a greased 9x13 baking dish, spread a little sauce on the bottom. Layer half the pasta, half the sauce, dollops of ricotta, and half the mozzarella/Parmesan. Repeat layers.
Add toppings (optional): Drizzle with garlic butter or sprinkle breadcrumbs on top.
Bake: Cover with foil and bake for 20 minutes. Uncover and bake another 10–15 minutes until bubbly and golden.
Rest and serve: Let it sit for 10 minutes before serving.