Scaffold a New Reflect Project
Follow these instructions to create a simple Reflect starter app based on Vite and React. It takes about 15 seconds (depending on how peppy npm is feeling today).
Not a React fan? See Add to Existing Project for other frameworks.
Install
npx @rocicorp/reflect@latest create my-appJoin Discord
Join the Reflect Discord (opens in a new tab) so you'll be able to ask questions and get help.
Develop
Reflect has a fully local development server (npx reflect dev) for fast iteration.
The watch script inside this starter app runs both the Reflect dev server and the Vite UI server (npx vite) in parallel for convenience:
cd my-app
npm run watchOpen http://localhost:5173/ (opens in a new tab) in two tabs to see it in action.
Publish
When you are happy with your app, publish the Reflect server to reflect.net (opens in a new tab):
npx reflect publish --app my-appThis will output the URL for the published app. Set the environment variable for REFLECT_URL, and you can run against prodution with:
VITE_REFLECT_URL=https://your-app-name.reflect-server.net npx viteWatch the logs from production with:
npx reflect tail --room='my-room' --app my-appYou can host the app UI just about anywhere since it's just static JS. For example, to use Vercel:
npx vercelYou'll have to set the environment variable on Vercel:
VITE_REFLECT_URL=https://your-app-name.reflect-server.net (opens in a new tab)