Examples Web
examples/web is one of two reference Next.js apps in the Charivo workspace, and
the one to read when comparing client styles. Read it as a current integration
example, not just a demo. The other is
Examples Companion, a realtime-only app.
What It Covers
The app exercises the current package stack:
- Live2D rendering through
@charivo/render-live2dand@charivo/render - LLM chat through remote, direct, OpenClaw proxy, and stub clients
- TTS through remote, browser-native, and direct OpenAI players
- STT through remote, browser-native, and direct OpenAI transcribers
- realtime voice sessions through
@charivo/realtime/remoteand/api/realtime
Lifecycle Split
The current hook split is deliberate:
useLive2Downs canvas mount and unmountuseCharivoChatowns Charivo setup, render/LLM/TTS/STT manager attachment, event subscription, and teardownuseRealtimeModeowns the realtime manager: it attaches and detaches it on the shared Charivo instance, and starts and stops the session
This keeps renderer lifecycle separate from conversation lifecycle, and both separate from realtime session lifecycle.
API Routes
The current reference app ships:
POST /api/chatUses@charivo/server/openaiwith modelgpt-4.1-nanoPOST /api/chat-openclawUses@charivo/server/openclawPOST /api/ttsUses@charivo/server/openaiwith default voicemarinand modelgpt-4o-mini-ttsPOST /api/sttUses@charivo/server/openaiwith modelwhisper-1POST /api/realtimeUses@charivo/server/openaito create a realtime session bootstrap
Runtime Modes
The settings UI intentionally exposes several implementation styles in one place:
- remote API paths for production-oriented flows
- browser-direct OpenAI and OpenClaw paths for development and testing
- browser-native TTS and STT paths for zero-server speech experiments
- stub LLM mode for deterministic UI work
Files To Read
examples/web/README.mdexamples/web/src/app/page.tsxexamples/web/src/app/hooks/useCharivoChat.tsexamples/web/src/app/hooks/useLive2D.tsexamples/web/src/app/hooks/useRealtimeMode.tsexamples/web/src/app/hooks/realtime-ui.ts
When To Use It
Use examples/web when you want:
- a concrete browser integration example
- working API route examples
- a reference for lifecycle boundaries between renderer setup and chat/session setup
- a place to compare runtime choices before designing your own app shell