Code shared between the client and server.