Back to Rivet

Hello World

examples/hello-world-vercel/README.md

2.2.11.7 KB
Original Source

Note: This is the Vercel-optimized version of the hello-world example. It uses the hono/vercel adapter and is configured for Vercel deployment.

Hello World

A minimal example demonstrating RivetKit with a real-time counter shared across multiple clients.

Getting Started

sh
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/react for 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 using useActor hook and event subscriptions

Resources

Read more about actions, state, and events.

License

MIT