add gen_server and server supervisor

- implement logic as a gen_server
- add server supervisor
- still needs review and fixes