For the most part, you can take C# source code and change the references and includes from GTA to CitizenFX and use it in a FiveM server. There’s a little bit more to it, but that’s the gist.
If you would like to know how to compile a .dll for FiveM, have a look at: