In a large pot, heat a generous drizzle of oil over medium-high heat. Add the onion and cook for 5-7 minutes, until soft. Add the garlic and cook for another minute, then add the tomatoes, tomato paste, brown sugar, vinegar, salt and chili flakes and bring to a boil. Reduce the heat and simmer, stirring occasionally, for an hour or so or until very soft and fairly thick.
Using a hand-held immersion blender, purée the mixture right in the pot, or cool and transfer in batches to a blender and puree until smooth. Seal in sealable jars according to the manufacturers’ directions, store in the fridge for up to two weeks or freeze for up to six months.