Introduction
Talkmoji lets you deploy AI talking agents — animated Rive characters powered by Gemini Live, backed by your own knowledge base — on any website with a single script tag.
What is Talkmoji?
Talkmoji is a SaaS platform for building and hosting embeddable AI chatbots with animated talking characters. It combines three technologies:
- Rive — real-time animated characters with frame-perfect lip sync driven by a state machine
- Gemini Live — Google's real-time voice AI, streamed directly from the browser via WebSocket
- RAG (Retrieval-Augmented Generation) — your PDFs, URLs, and documents are chunked, embedded with
gemini-embedding-exp-03-07, and stored in pgvector for semantic search
Visitors can talk to your agent by voice or text in 30+ languages. The agent searches your knowledge base for every question, cites its sources, and speaks with full lip sync.
Prerequisites
- Node.js 18+ — the server uses ES2022 syntax and the native
fetchAPI - Supabase account — free tier works; you need a project with the
vectorextension enabled - Google Gemini API key — used for embeddings and Gemini Live voice chat (get one here)
- Stripe account (optional) — for billing. The platform runs in demo mode without it
Quick start
-
Clone and install
Clone the repository and install Node.js dependencies.
git clone https://github.com/your-org/avatar-platform.git cd avatar-platform npm install -
Configure environment
Copy
.env.exampleto.envand fill in the required values.cp .env.example .envMinimum required variables:
DATABASE_URL=postgresql://postgres:[password]@db.[ref].supabase.co:5432/postgres GEMINI_API_KEY=your-gemini-api-key JWT_SECRET=a-long-random-string -
Run the database schema
Open your Supabase project → SQL Editor and paste the entire contents of
supabase/schema.sql. This creates all 10 tables and the pgvector HNSW index.The
vectorextension must be enabled. Supabase enables it by default; for self-hosted Postgres runCREATE EXTENSION IF NOT EXISTS vector;first. -
Start the server
npm start # → Talkmoji running at http://localhost:8080Open http://localhost:8080, create an account, and build your first agent.
First embed
Once you've created a project in the dashboard, copy your Bot ID from the Install code step and drop this script tag anywhere on your site:
<!-- Paste before </body> -->
<script
src="https://your-deployment.com/js/embed-loader.js"
data-bot="YOUR_BOT_ID"
defer
></script>
That's all. No bundler, no build step, no authentication required. The widget loads, fetches its configuration, and the agent is live. Position, theme, size, and start-open behavior are configured per-project in the dashboard's Widget tab, not as script-tag attributes.
Architecture overview
Browser (visitor)
│
├─ lipsync-sdk.js (embed widget)
│ ├─ GET /embed/:publicId/config ← widget settings, character, capture fields
│ ├─ POST /embed/:publicId/retrieve ← semantic RAG search (REST)
│ ├─ POST /embed/:publicId/ask ← async Q&A (no voice)
│ ├─ POST /embed/:publicId/log ← session + message logging
│ └─ WebSocket → Gemini Live API ← real-time voice (direct from browser)
│
Node.js / Express server
│
├─ /api/auth/* ← JWT auth (register, login, reset)
├─ /api/projects/* ← project CRUD, sessions, leads
├─ /api/projects/:id/files ← file upload + URL ingestion
├─ /api/billing/* ← Stripe checkout, portal, webhook
└─ /api/analytics/* ← usage charts
│
Supabase / Postgres
├─ users, projects, sessions, messages
├─ files, chunks (vector(768) + HNSW index)
├─ leads, capture_fields
├─ subscriptions, usage
└─ pgvector <=> cosine distance search
External services
├─ Gemini Embedding API ← document + query embeddings
├─ Gemini Live API ← real-time voice streaming (WebSocket)
├─ Gemini REST API ← async /ask endpoint
└─ Stripe ← subscription billing
Environment variables
| Variable | Required | Description |
|---|---|---|
| DATABASE_URL | Yes | Postgres connection string (Supabase or self-hosted) |
| GEMINI_API_KEY | Yes | Server-side Gemini key for embeddings and async /ask |
| JWT_SECRET | Yes | Random string for signing JWT tokens. Change before deploying. |
| PUBLIC_GEMINI_API_KEY | Recommended | Browser-safe Gemini key for the Gemini Live WebSocket. Must be a SEPARATE key from GEMINI_API_KEY (never exposed server key). If unset, widgets degrade to text-only mode via the server-side /ask path. |
| PORT | No | Server port. Defaults to 8080. |
| EMBEDDING_MODEL | No | Gemini embedding model. Default: gemini-embedding-exp-03-07 |
| EMBEDDING_DIMENSIONS | No | Output dimension. Default: 768. Match to schema. |
| STRIPE_SECRET_KEY | No | Stripe secret key. Billing is disabled if unset. |
| STRIPE_WEBHOOK_SECRET | No | Stripe webhook signing secret for POST /api/billing/webhook |
Next step: Integrate the widget into a React app. See the React SDK docs.