Refactor to extract the server startup and enable hot reloading.