| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 4 个月前 | ||
| 4 个月前 | ||
| 6 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 16 天前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 4 个月前 | ||
| 8 个月前 |
Hello World
A minimal example demonstrating RivetKit with a real-time counter shared across multiple clients.
Getting Started
git clone https://github.com/rivet-dev/rivet.git
cd rivet/examples/hello-world
npm install
npm run dev
Features
- Actor state management: Persistent counter state managed by Rivet Actors
- Real-time updates: Counter values synchronized across all connected clients via events
- Multiple actor instances: Each counter ID creates a separate actor instance
- React integration: Uses
@rivetkit/reactfor seamless React hooks integration
Implementation
This example demonstrates the core RivetKit concepts with a simple counter:
- Actor Definition (
src/actors.ts): Counter actor with persistent state and broadcast events - Server Setup (
src/server.ts): Minimal Hono server with RivetKit handler - React Frontend (
frontend/App.tsx): Counter component usinguseActorhook and event subscriptions
Resources
Read more about actions, state, and events.
License
MIT