APTalkmoji Introduction
Docs›Getting Started

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 fetch API
  • Supabase account — free tier works; you need a project with the vector extension 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

  1. 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
  2. Configure environment

    Copy .env.example to .env and fill in the required values.

    cp .env.example .env

    Minimum 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
  3. 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 vector extension must be enabled. Supabase enables it by default; for self-hosted Postgres run CREATE EXTENSION IF NOT EXISTS vector; first.

  4. Start the server
    npm start
    # → Talkmoji running at http://localhost:8080

    Open 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

VariableRequiredDescription
DATABASE_URLYesPostgres connection string (Supabase or self-hosted)
GEMINI_API_KEYYesServer-side Gemini key for embeddings and async /ask
JWT_SECRETYesRandom string for signing JWT tokens. Change before deploying.
PUBLIC_GEMINI_API_KEYRecommendedBrowser-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.
PORTNoServer port. Defaults to 8080.
EMBEDDING_MODELNoGemini embedding model. Default: gemini-embedding-exp-03-07
EMBEDDING_DIMENSIONSNoOutput dimension. Default: 768. Match to schema.
STRIPE_SECRET_KEYNoStripe secret key. Billing is disabled if unset.
STRIPE_WEBHOOK_SECRETNoStripe webhook signing secret for POST /api/billing/webhook
✅

Next step: Integrate the widget into a React app. See the React SDK docs.