๐ Live Demo Link (GitHub Pages)
A zero-backend, 100% client-side, and offline-first starter template for building and deploying your own browser-based AI assistant. Powered by WebGPU and Google LiteRT-LM, it runs open models directly on the client. Fork, customize, and deploy to GitHub Pages in 5 minutes!
- Zero-Backend (GitHub Pages Friendly): Fully serverless. Host it free on GitHub Pages, Cloudflare Pages, or Netlify with zero setup.
- Config-Only Customization (
config.json): Customize the app name, default model, color themes, logo SVG, language options, and quick-action prompt buttons in a single configuration file. No JavaScript coding required! - Modular Persona Library: Easily add or modify personas by editing JSON files in the
personas/directory (comes preloaded with Coding Helper, Travel Guide, Language Tutor, Interviewer, and Math Tutor). - Multi-Language Support: Preconfigured for English, Chinese (ไธญๆ), Japanese (ๆฅๆฌ่ช), Korean (ํ๊ตญ์ด), Tamil (เฎคเฎฎเฎฟเฎดเฏ), and Malay (Bahasa Melayu). Persona instructions automatically switch prompts to target strict output matching.
- Text-to-Speech (TTS) & Voice Engines:
- Dual TTS Engine support: Browser SpeechSynthesis & Fish Audio Cloud API (featuring developer promo model
s2.1-pro-free). - Multilingual speech synthesis with a sentence-splitting queue to avoid timeout bugs.
- Self-healing local voice fallback if online voices or cloud APIs fail.
- Real-time microphone input matching the active dialect.
- Dual TTS Engine support: Browser SpeechSynthesis & Fish Audio Cloud API (featuring developer promo model
- Prompt Templates (Quick Actions): Clean buttons (Explain, Summarize, Correct, Quiz) to quickly run actions on text.
- Chat Export Utility: Easily export conversations to Markdown (
.md), Text (.txt), or JSON (.json) with one click. - Progressive Web App (PWA): Desktop/mobile installable and operates fully offline after the first model caching load.
Click the "Fork" button at the top right of this repository to create a copy in your own GitHub account.
Clone your fork locally, or edit the files directly on GitHub:
- Change App Name, Theme, and Models: Edit
config.jsonto set your app title, brand color codes, default model, and prompt templates. - Customize Personas: Edit or add files in the
personas/folder to teach your assistant new roles or custom instructions. - Customize Logo: Overwrite
logo.svgwith your own vector design.
- Go to your forked repository's Settings on GitHub.
- Select Pages on the left menu.
- Under Build and deployment, set the source to "Deploy from a branch".
- Select the
mainbranch and/ (root)folder, then click Save. - Wait 1โ2 minutes, and your custom AI will be live at
https://<your-username>.github.io/<your-repo-name>/!
This template is kept intentionally clean, lightweight, and build-tool free:
โโโ index.html # Dynamic application layout shell
โโโ style.css # Glassmorphic UI styles powered by CSS theme variables
โโโ app.js # Core LiteRT-LM, voice synthesis, export, and PWA registration logic
โโโ voice-agent.js # Hands-free Voice Activity Detection (VAD) & barge-in engine
โโโ db.js # Client-side IndexedDB storage (sessions, messages, memories)
โโโ server.js # Zero-dependency local Node server with built-in Fish Audio CORS proxy
โโโ package.json # Node.js start script configuration + dev dependencies
โโโ eslint.config.js # ESLint flat config (lint + complexity checks)
โโโ config.json # Central configuration for names, themes, and prompt templates
โโโ manifest.json # Web App Manifest for PWA installability
โโโ sw.js # Service Worker for offline static asset caching
โโโ logo.svg # Central brand vector graphic
โโโ .github/workflows/ # CI: lint check on push/PR
โโโ docs/ # Developer guides (e.g. mobile device testing)
โโโ personas/ # External persona definitions
โโโ assistant.json
โโโ coding-helper.json
โโโ interviewer.json
โโโ language-tutor.json
โโโ math-tutor.json
โโโ travel-guide.json
Because browsers enforce security restrictions on Web Workers and cross-origin fetch requests, you can run the project using the built-in local server:
Open a terminal in the project directory and run:
npm start(or node server.js)
This starts a lightweight Node server at http://localhost:3000 with a built-in server-to-server proxy for Fish Audio TTS, completely bypassing browser CORS preflight blocks.
npx serve .Open http://localhost:3000 in your browser. (If using Fish Audio TTS under static servers, enable a browser CORS extension like "Allow CORS" or configure a CORS proxy in settings).
Note on Virtual Networks & Local IP: If
npx serve .shows a virtual adapter IP (like192.168.56.1), runnpx serve . -l tcp://0.0.0.0:3000to bind to all local network interfaces.
Testing on your phone? The easiest way is to deploy to GitHub Pages (free HTTPS). To test a local dev server from a phone or local network, see docs/MOBILE-TESTING.md for HTTPS tunneling instructions (required for WebGPU and Microphone access).
The project uses ESLint (flat config, eslint.config.js) to catch bugs and flag overly complex functions. Run it locally with:
npm install
npm run lintEvery push and pull request to main also runs this via GitHub Actions.
- On phones, the app auto-selects the smallest model and hides larger ones (memory limits).
- Devices/browsers without WebGPU show a clear "not supported" notice instead of a failing download.
- iOS Safari limits browser storage and evicts it after 7 days of inactivity, so the model may re-download on iPhone โ install the PWA (Share โ Add to Home Screen) for reliable caching.
The starter kit runs WebGPU-optimized LiteRT-LM models hosted in the Web LLM Models collection. The default configuration includes:
- Gemma 4 E2B IT (Web-Optimized): Google's lightweight open model (~1.2 GB weights) designed for fast, browser-based GPU execution.
- Gemma 4 E4B IT (Web-Optimized): A slightly larger version (~2.4 GB weights) offering higher quality generation on devices with capable GPUs.
To add other models from the Web LLM Models collection, append their Hugging Face URL endpoints to the models array in config.json.
The application supports two speech synthesis engines selectable under Speech Voice:
- Browser SpeechSynthesis: Built-in browser voices (Google Neural, Microsoft Azure Online, Apple Siri, and offline OS system voices).
- Fish Audio Cloud API: High-quality cloud neural TTS with default support for the developer promo model
s2.1-pro-free.- API Key input: Paste your Fish API key with an optional ๐๏ธ show/hide toggle.
- Automatic storage: Settings are saved locally in
localStorage. - Self-healing fallback: If a cloud TTS request encounters network or API issues, the app gracefully falls back to browser voice playback.
โ ๏ธ Fish Audio only works vianpm start:api.fish.audiodoes not send CORS headers for browser origins, so a direct browser request to it is always blocked โ except throughserver.js, which proxies the request same-origin when you runnpm startlocally. On GitHub Pages (or any static hosting) there is no server to proxy the request, so Fish Audio TTS is not available โ the app automatically and silently falls back to your browser's built-inSpeechSynthesisvoice instead. There is intentionally no public-CORS-proxy workaround for this, since routing your API key and message text through a third-party relay would break the app's zero-leakage privacy guarantee. If you want Fish Audio on a public deployment, self-host your own proxy (e.g. a Cloudflare Worker mirroringserver.js's/api/fish-ttslogic) and adaptapp.jsto call it.
This project is open-source and available under the MIT License.