lib used by server and client