SSR refactoring (client + server)