Examples Web
examples/web is the reference Next.js app for the Charivo workspace. Read it
as the current integration example, not just a demo.
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, manager attachment, event subscription, and teardown
This keeps renderer lifecycle separate from conversation and 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