basic javascript architecture