Heat the oil in a large pot over medium heat. Once hot, add the diced onion and cook until translucent and beginning to brown, about 5-7 minutes.
Add the garlic and ginger to the pot and sauté for another 1-2 minutes until fragrant, being careful not to burn the garlic.
Stir in all the dry spices (curry powder, turmeric, cumin, and red pepper flakes if using) and cook for 30 seconds to toast the spices and release their flavors.
Add the rinsed lentils, diced tomatoes, and vegetable broth to the pot. Stir well to combine, making sure no lentils are sticking to the bottom.
Bring the mixture to a boil, then reduce heat to low, cover, and simmer for about 15 minutes, or until the lentils are tender but not mushy.
Pour in the coconut milk and stir to incorporate. Continue simmering uncovered for 10 minutes, allowing the curry to thicken slightly.
Season with salt to taste and stir in the fresh lime juice just before removing from heat. The lime juice brightens all the flavors.
Let the curry rest for 5 minutes before serving. This allows the flavors to meld and the curry to reach the perfect consistency.
Serve hot over basmati rice or with naan bread, garnished with plenty of fresh cilantro.