Coat the bottom of a large pot with oil and place it over medium heat. When the oil is hot, add the onion. Cook the onion for about 5 minutes, stirring occasionally, until it becomes soft and translucent.
Add the garlic and sauté it for about 1 minute, until very fragrant, stirring constantly.
Stir in the tomatoes, broth, and red pepper flakes. Raise the heat and bring the mixture to a boil. Lower the heat and simmer for about 20 minutes, stirring occasionally, until the liquid reduces slightly.
Blend the soup, either using an immersion blender or by transferring it to a standard blender or food processor in batches, then returning it to the pot. Always use caution when blending hot liquids.
Stir in the coconut milk, then raise the heat to bring the soup back up to a simmer. Stir in the gnocchi and simmer for about 3 to 5 minutes more, until the gnocchi are tender (gnocchi cooking times vary — refer to the package instructions).
Remove the soup from the heat. If you'd like, you can thin it with a bit of additional broth or coconut milk at this point. Stir in the basil and season the soup with salt and pepper to taste.
Ladle into bowls and optionally top with a drizzle of coconut milk. Serve.