Preheat the oven to 350°F (175°C).
Combine almond flour, erythritol, melted butter, egg, vanilla, and salt in a bowl until a soft dough forms.
Press the dough evenly into a 9-inch pie dish, covering the bottom and sides. Prick the bottom with a fork.
Bake the crust for 12–15 minutes or until lightly golden, then let it cool completely.
In a saucepan, whisk together egg yolks, erythritol, lemon juice, lemon zest, and butter.
Cook over medium heat, stirring constantly, until the mixture thickens (5–7 minutes).
If using gelatin, sprinkle it over the hot filling and whisk until dissolved, then remove from heat.
Pour the warm lemon filling into the cooled crust and smooth the top.
In a clean bowl, beat egg whites and cream of tartar until soft peaks form.
Slowly add erythritol while beating until stiff, glossy peaks form.
Spread the meringue over the lemon filling, sealing the edges to the crust to prevent shrinking.
Bake for 10–15 minutes or until the meringue is lightly golden.
Cool for 1 hour at room temperature, then refrigerate for at least 2 hours before slicing.