app factory
separate serve script