Example project demonstrating persistent data storage and real-time updates with RivetKit.
Discord — Documentation — Issues
- Node.js 18+
git clone https://github.com/rivet-dev/rivetkit
cd rivetkit/examples/database
npm installnpm run devOpen your browser to http://localhost:3000
- Persistent Storage: Notes are automatically saved and persist across sessions
- Real-time Updates: Changes are instantly synchronized across all connected clients
- User Authentication: Demonstrates basic authentication with token validation
- Multi-user Support: Switch between different users to see isolated data
- CRUD Operations: Create, read, update, and delete notes
- Edit in Place: Click edit to modify notes inline
- Auto-sorting: Notes are automatically sorted by last modified date
This example demonstrates:
- Actor State Management: Using RivetKit actors to manage persistent application state
- Authentication: Basic token-based authentication for user identification
- Real-time Events: Broadcasting changes to all connected clients using actor events
- State Persistence: Actor state is automatically persisted between sessions
- Connection State: Handle connection status and graceful degradation
- Backend: RivetKit actor that manages note storage and user authentication
- Frontend: React application with real-time updates via RivetKit hooks
- State Management: Each user gets their own actor instance for data isolation
- Authentication: Mock token-based auth (replace with real auth in production)
- Start the development server
- Select a user from the dropdown to see their notes
- Add new notes using the input field
- Edit notes by clicking the "Edit" button
- Delete notes with the "Delete" button
- Open multiple tabs or users to see real-time synchronization
This example can be extended with:
- Real database integration (PostgreSQL, MongoDB, etc.)
- Proper JWT authentication
- User registration and management
- Note sharing and collaboration
- Rich text editing
- File attachments
- Search and filtering
Apache 2.0