Prep the onions by peeling them and slicing them very thin.
Melt butter in a heavy bottom pan then add the onions. Toss so that they are evenly coated in butter. Cook the onions slowly over medium-low heat for 40 minutes to an hour.
If desired, add ¼ cup of white wine or water to help the caramelization process along.
Cook Pasta
Cook pasta according to the package's instructions.
Caramelized Onion Pasta Sauce
Once the onions are caramelized, add the tomatoes. Let the tomatoes cook, stirring occasionally, until they are soft and ready to burst by being smashed gently with the back of a spoon. Roughly 15 minutes.
Add the ricotta cheese, red pepper flakes, salt, and pepper. Stir to combine. Adjust seasoning to taste .
Add cooked pasta into the caramelized onion and tomato sauce. Stir to combine.
Once the pasta is served on plates, garnish with toasted pine nuts and fresh basil.