examples/yjs/README.md
This example showcases a multiplayer Codemirror editor with YJS and ElectricSQL. All data is synchronized through Postgres, eliminating the need for additional real-time infrastructure.
Y-Electric is a YJS connection provider that comes with offline support, integrates with database providers and handles Awareness. It works with the entire YJS ecosystem and with your existing apps too!
Check the Y-Electric package to learn more.
This example is part of the ElectricSQL monorepo and is designed to be built and run as part of the pnpm workspace defined in ../../pnpm-workspace.yaml.
Navigate to the root directory of the monorepo, e.g.:
cd ../../
Install and build all of the workspace packages and examples:
pnpm install
pnpm run -r build
Navigate back to this directory:
cd examples/yjs
Start the example backend services using Docker Compose:
pnpm backend:up
Note that this always stops and deletes the volumes mounted by any other example backend containers that are running or have been run before. This ensures that the example always starts with a clean database and clean disk.
Now start the dev server:
pnpm dev:server
And the client app
pnpm dev:client
When you're done, stop the backend services using:
pnpm backend:down