Share functions between back and front

Hi there.
I wonder if there is anyway to use the same functions in both back and front.
We’re designing libs of functions to manipulate specific objects in an orderly fashion and it would be great to use the same functions in back and front instead of replicating them with the maintenance problems it may originate.
Many thanks in advance,
Paulo