In a large pot or Dutch oven, heat the olive oil over medium heat. Add the diced onion and sauté for about 5 minutes until softened.
Add the minced garlic and cook for another minute, stirring constantly to avoid burning.
Season the chicken breasts with salt and pepper, then add them to the pot. Cook for about 5 minutes on each side until they are lightly browned.
Pour in the chicken broth and add the can of diced tomatoes, dried basil, dried oregano, and red pepper flakes (if using). Bring the mixture to a boil, then reduce heat to a simmer.
Cover and let it simmer for about 10 minutes. After this time, remove the chicken breasts and shred them using two forks. Return the shredded chicken to the pot.
Add the gnocchi to the soup and let it cook for another 5 minutes, or until the gnocchi are floating and tender.
Stir in the fresh spinach and halved cherry tomatoes, cooking for an additional 2-3 minutes until the spinach has wilted.
Finally, add the fresh mozzarella balls and stir gently until they're slightly melted. Adjust seasoning with salt and pepper as needed.
Serve hot, garnished with fresh basil leaves. Use a ladle to portion the soup into bowls.