Cook pasta according to package directions until al dente. Drain and rinse with cold water to cool.
In a large bowl, combine the cooked and cooled pasta with pesto, cherry tomatoes, cucumber, red bell pepper, and red onion.
If using, add mozzarella balls and toasted pine nuts. Toss gently to combine.
Season with salt and pepper to taste. For best flavor, let it chill in the refrigerator for at least 30 minutes before serving.
Notes
This pasta salad can be made ahead of time and stored in the refrigerator for up to 3 days. Add a little extra pesto or a drizzle of olive oil before serving if it seems dry.