adding server logic and changing app dir structure