1. init server code