https://github.com/rocicorp/reflect-starter-vanilla
https://github.com/rocicorp/reflect-starter-vanilla
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/rocicorp/reflect-starter-vanilla
- Owner: rocicorp
- Created: 2023-09-19T09:17:29.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T09:47:18.000Z (almost 3 years ago)
- Last Synced: 2025-03-24T08:55:26.271Z (over 1 year ago)
- Language: JavaScript
- Size: 130 KB
- Stars: 5
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Reflect/Vite/Vanilla Starter
This is the Vite starter app (`npm create vite@latest`) adjusted to use Reflect instead of in-memory state.
## Install
```bash
npm install
```
## Dev
In one shell, start the Reflect dev serfver:
```bash
npx @rocicorp/reflect dev
```
In another shell, start the UI dev server:
```bash
npm run dev
```
Open http://localhost:5173/ in two tabs and click the increment button.
## Deploy Reflect
Deploy the Reflect server to relect.net:
```bash
npx @rocicorp/reflect publish
```
Change the `serverOrigin` Reflect parameter to point to the production server with a `wss` protocol:
```js
const r = new Reflect({
userID: "someUser",
roomID: "myRoom",
// Whatever publish printed out -- note `wss` protocol
socketOrigin: "wss://reflect-starter-vanilla.rocicorp-bot.reflect-server.net",
mutators,
});
```
Run the UI against the deployed server:
```bash
npm run dev
```
You can also publish the UI anywhere, for example Vercel:
```
npx vercel
```