Heat the oven to 400F/200C.
Cook chopped onion in olive oil over low heat for 5-7 minutes until soft but not coloured.
Add ground beef and cook, stirring it the whole until no longer pink.
Add, salt, chopped basil and canned tomatoes, bring to a boil and then turn the heat down and simmer for 20 minutes, stir one in a while and break up any large tomato chunks with a wooden spoon.
While the sauce is simmering, cook the shells in a large pot according to package instructions. It's important not to overcook pasta but cook it al dente as it will be further cooked in the oven.
At the end of cooking time stir pesto into the sauce and take it off the heat.
Drain pasta and gently toss it with the sauce in the same pot the pasta was cooked in.
Put half of the pasta in the baking dish and sprinkle with half of mozzarella and Parmesan.
Top it up with the remaining pasta and sprinkle with more mozzarella and Parmesan.
Bake in the oven for 15 minutes until cheese is golden and pasta is hot and bubbly.