Preheat the oven to 180°C (350°F) and lightly grease a muffin tin.
Heat olive oil in a pan over medium heat and sauté the onion until soft.
Add garlic and cook briefly until fragrant.
Add spinach and cook just until wilted, then remove from heat and let cool slightly.
Crack the eggs into a bowl and whisk until fully combined and slightly frothy.
Season the eggs with salt, black pepper, and red pepper flakes if using.
Fold the cooled spinach mixture into the eggs, then gently mix in the feta cheese.
Divide the mixture evenly among the muffin cups, filling each about three-quarters full.
Bake for 18–22 minutes, until the centers are set and the tops are lightly puffed.
Allow to cool slightly before removing from the muffin tin and serving.