refactor of server, separate api into modules. api and schema