Preheat the oven to 375°F (190°C) and cook the ziti until just shy of al dente. Drain.
Heat the olive oil in a pan and cook the onion for 4 minutes, then add the garlic for 30 seconds. Stir in the marinara and simmer 5 minutes.
In a bowl, mix the ricotta, egg, parmesan, and half the basil.
Toss the drained pasta with the marinara sauce.
Layer half the pasta in a baking dish, dollop with the ricotta mixture, then top with the rest of the pasta and all the mozzarella.
Bake for 25-30 minutes until bubbly and golden. Top with basil and serve.