In the bowl of a food processor, add the basil, grated parmesan, walnuts, crushed garlic, salt, pepper, and red pepper flakes (if using).
Set the food processor to low speed and slowly drizzle in the olive oil until the pesto is creamy and well-blended.Be careful not to over-blend, as this makes pesto bitter.Remove to a glass jar with a tight-fitting lid.
Store covered in the fridge for up to a week or in the freezer for up to 3 months.