This is the Vite TS/Vanilla starter app (npm create vite@latest
) adjusted to use Reflect instead of in-memory state.
npm install
In one shell, start the Reflect dev server:
npx @rocicorp/reflect dev
In another shell, start the UI dev server:
npm run dev
Open http://localhost:5173/ in two tabs and click the increment button.
Deploy the Reflect server to relect.net:
npx @rocicorp/reflect publish
Change the serverOrigin
Reflect parameter to point to the production server with a wss
protocol:
const r = new Reflect({
userID: "someUser",
roomID: "myRoom",
// Whatever publish printed out -- note `wss` protocol
socketOrigin:
"wss://reflect-starter-ts-vanilla.rocicorp-bot.reflect-server.net",
mutators,
});
Run the UI against the deployed server:
npm run dev
You can also publish the UI anywhere, for example Vercel:
npx vercel