Liveblocks is a real-time collaboration infrastructure for building performant
collaborative experiences. Follow the following steps to start making your
Zustand store multiplayer by using the middleware from the
@liveblocks/zustand
package.
Create the Liveblocks client and use the middleware
in your Zustand store setup. This will add a new state called liveblocks
to your store, enabling you to interact with our Presence and Storage APIs.
Liveblocks uses the concept of rooms, separate virtual spaces where people collaborate. To create a real-time experience, multiple users must be connected to the same room.
Now that we’re connected to a room, we can start using the Liveblocks data from the Zustand store.
By default, Liveblocks is configured to work without an authentication endpoint. This approach is great for prototyping and marketing pages where defining your own security isn’t always required. If you want to implement your own security logic to define if certain users should have access to a given room, you’ll need to implement an authentication endpoint.
Set up authenticationCongratulations! You now have set up the foundation to start building collaborative experiences for your Zustand store.