Cook pasta until al dente in salted water according to the package instructions. Usually this takes 10-12 minutes. Drain and rinse under cold water to stop the cooking process.
As the pasta is being cooked, make the dressing: In a large salad bowl, combine olive oil with balsamic vinegar, garlic, red pepper flakes if using, black pepper, and salt.
Then add cherry tomatoes, red onion, mozzarella pearls, and basil. Give everything a good stir. Taste the pasta salad and adjust seasonings to your preference.