Hi,
From your short description I am not clear whether you want to have just custom code to be executed or if you want to have fully custom membership provider.
Anyway, you can find the membership API examples in our
documentation or in the
Site Manager.
There are also available things out of the box - like custom registration form web part you can customize.
Best regards,
Juraj Ondrus