Preheat the oven to 200C/400F/Gas 6.
Cut the puff pastry into six 20cm/8in squares.
For the filling, mix the red onion, chilli, lemon balm, potato, lime zest and crabmeat together in a bowl. Season well, then spoon the mixture onto one half of each of the pastry squares.
Brush the edges with beaten egg and fold over to make a triangle, seal the edges with the tines of a fork and brush all over with more beaten egg.
Bake in the oven for 25 minutes, or until the pastry is golden-brown.
For the relish, heat the baby onions, sugar, mustard powder, cider vinegar, garlic and lime leaves in a saucepan until boiling. Reduce the heat to a simmer and cook for 30-40 minutes, stirring occasionally, or until thickened.
Serve the relish with the crab pasties.