Refactor and modularize routejs and appjs builder