Skip to content

Visual UI for Explainroo. Explainer videos and product demos made by your AI agent. Free and open source: a local voice (Kokoro), word timing (Whisper) and a canvas renderer turn a script into a narrated MP4.

Add files via upload

jastfane8f32ccd2bf5
diff --git a/server.ts b/server.ts
new file mode 100644
index 0000000..5de439e
--- /dev/null
+++ b/server.ts
@@ -0,0 +1,249 @@
+import express from 'express';
+import dotenv from 'dotenv';
+import path from 'path';
+import { fileURLToPath } from 'url';
+import { GoogleGenAI, Type } from '@google/genai';
+import { createServer as createViteServer } from 'vite';
+
+dotenv.config();
+
+const __filename = fileURLToPath(import.meta.url);
+const __dirname = path.dirname(__filename);
+const PORT = Number(process.env.PORT) || 3000;
+const isProd = process.env.NODE_ENV === 'production';
+
+const app = express();
+app.use(express.json({ limit: '10mb' }));
+
+const getApiKey = () => (process.env.GEMINI_API_KEY || process.env.API_KEY || '').trim();
+
+const getAiClient = () => {
+ const apiKey = getApiKey();
+ return new GoogleGenAI({
+ apiKey,
+ httpOptions: {
+ headers: {
+ 'User-Agent': 'explainroo-studio',
+ },
+ },
+ });
+};
+
+// Health Check
+app.get('/api/health', (_req, res) => {
+ res.json({
+ status: 'ok',
+ hasKey: Boolean(getApiKey()),
+ model: 'gemini-3.8-flash',
+ });
+});
+
+// Explainroo AI Explainer Video Generator
+app.post('/api/explainroo/ai-generate', async (req, res) => {
+ try {
+ const {
+ prompt,
+ look = 'whiteboard',
+ numScenes = 3,
+ repoUrl = '',
+ } = req.body;
+
+ if (!prompt || typeof prompt !== 'string') {
+ res.status(400).json({ error: 'Prompt is required' });
+ return;
+ }
+
+ const apiKey = getApiKey();
+ if (!apiKey) {
+ res.status(503).json({
+ error: 'GEMINI_API_KEY is not configured on the server. Please check Settings > Secrets.',
+ });
+ return;
+ }
+
+ const ai = getAiClient();
+
+ const systemInstruction = `You are Explainroo Studio, the world-class explainer video and animated software diagram director.
+Your mission is to take any software repository, architecture concept, or technical topic and turn it into a short, compelling, 3 to 4 scene animated video script and visual diagram layout.
+
+Rules for great Explainroo videos:
+1. Narration should be friendly, conversational, and direct (suitable for spoken voiceover). Keep each scene to 25-45 words (~6 to 8 seconds).
+2. For each scene, design 2 to 4 visual elements that tell the story visually on a 1280x720 canvas:
+ - Use layout components: 'client' (laptop/user), 'server', 'database', 'cloud', 'api_gateway', 'browser_window', 'terminal_window', 'arrow', 'curved_arrow', 'code_block', 'checkmark', 'icon'.
+ - Coordinates (X, Y) must be within width 1280 and height 720 (keep X between 120 and 1050, Y between 150 and 520).
+ - Give each element a 'triggerWord' (the exact spoken word in that scene's narration when the element should appear on screen).
+ - Set 'triggerTimeSec' matching approximately when that word is spoken (e.g. 0.5s, 1.8s, 3.2s).
+ - Colors should be pleasant hex codes like #3b82f6 (blue), #10b981 (emerald), #f59e0b (amber), #a855f7 (purple), #ef4444 (rose), #0f172a (dark slate).
+3. Return clean, strictly formatted JSON matching the schema.`;
+
+ const userPrompt = `Create an animated explainer video project about:
+Topic / Repo: "${prompt}"
+${repoUrl ? `Repository URL: ${repoUrl}` : ''}
+Visual Look: ${look}
+Number of Scenes: ${numScenes}
+
+Produce an engaging title, description, and ${numScenes} scenes with narration and synchronized visual elements.`;
+
+ const response = await ai.models.generateContent({
+ model: 'gemini-3.8-flash',
+ contents: userPrompt,
+ config: {
+ systemInstruction,
+ responseMimeType: 'application/json',
+ responseSchema: {
+ type: Type.OBJECT,
+ properties: {
+ title: { type: Type.STRING },
+ description: { type: Type.STRING },
+ look: { type: Type.STRING },
+ musicTrack: { type: Type.STRING },
+ scenes: {
+ type: Type.ARRAY,
+ items: {
+ type: Type.OBJECT,
+ properties: {
+ id: { type: Type.STRING },
+ title: { type: Type.STRING },
+ narration: { type: Type.STRING },
+ durationSeconds: { type: Type.NUMBER },
+ transition: { type: Type.STRING },
+ elements: {
+ type: Type.ARRAY,
+ items: {
+ type: Type.OBJECT,
+ properties: {
+ id: { type: Type.STRING },
+ type: { type: Type.STRING },
+ x: { type: Type.NUMBER },
+ y: { type: Type.NUMBER },
+ width: { type: Type.NUMBER },
+ height: { type: Type.NUMBER },
+ label: { type: Type.STRING },
+ color: { type: Type.STRING },
+ animation: { type: Type.STRING },
+ triggerWord: { type: Type.STRING },
+ triggerTimeSec: { type: Type.NUMBER },
+ url: { type: Type.STRING },
+ codeSnippet: { type: Type.STRING },
+ iconName: { type: Type.STRING },
+ },
+ required: ['id', 'type', 'x', 'y', 'width', 'height', 'label', 'color', 'animation'],
+ },
+ },
+ },
+ required: ['id', 'title', 'narration', 'durationSeconds', 'elements'],
+ },
+ },
+ },
+ required: ['title', 'description', 'look', 'musicTrack', 'scenes'],
+ },
+ },
+ });
+
+ const parsed = JSON.parse(response.text || '{}');
+ // Ensure default settings
+ const project = {
+ id: `ai-${Date.now()}`,
+ title: parsed.title || 'Explainer Video',
+ description: parsed.description || prompt,
+ repoUrl,
+ look: parsed.look || look,
+ musicTrack: parsed.musicTrack || 'lofi',
+ musicVolume: 0.3,
+ voicePitch: 1.0,
+ voiceRate: 1.0,
+ autoDuck: true,
+ scenes: (parsed.scenes || []).map((s: any, idx: number) => ({
+ id: s.id || `scene-${idx + 1}`,
+ title: s.title || `Scene ${idx + 1}`,
+ narration: s.narration || '',
+ durationSeconds: s.durationSeconds || Math.max(5, Math.ceil((s.narration?.split(' ')?.length || 20) / 2.5)),
+ transition: s.transition || 'fade',
+ elements: (s.elements || []).map((el: any, eIdx: number) => ({
+ ...el,
+ id: el.id || `el-${idx}-${eIdx}`,
+ strokeWidth: 2.5,
+ roughness: 1.4,
+ })),
+ })),
+ };
+
+ res.json(project);
+ } catch (error: any) {
+ console.error('Explainroo AI Generator Error:', error);
+ res.status(500).json({
+ error: error.message || 'Failed to generate explainer video with AI',
+ details: String(error),
+ });
+ }
+});
+
+// Explainroo Script Polish Endpoint
+app.post('/api/explainroo/improve-script', async (req, res) => {
+ try {
+ const { text, goal = 'punchy' } = req.body;
+ if (!text) {
+ res.status(400).json({ error: 'Text is required' });
+ return;
+ }
+
+ const apiKey = getApiKey();
+ if (!apiKey) {
+ res.status(503).json({ error: 'GEMINI_API_KEY is not configured.' });
+ return;
+ }
+
+ const ai = getAiClient();
+ const response = await ai.models.generateContent({
+ model: 'gemini-3.8-flash',
+ contents: `Rewrite this video voiceover narration to make it more ${goal}, engaging, and easy to speak naturally:\n\n"${text}"`,
+ config: {
+ systemInstruction: 'You are an elite video script doctor. Return the rewritten script and suggested visual anchor keywords.',
+ responseMimeType: 'application/json',
+ responseSchema: {
+ type: Type.OBJECT,
+ properties: {
+ improvedText: { type: Type.STRING },
+ estimatedSeconds: { type: Type.NUMBER },
+ visualKeyMoments: {
+ type: Type.ARRAY,
+ items: { type: Type.STRING },
+ },
+ },
+ required: ['improvedText', 'estimatedSeconds', 'visualKeyMoments'],
+ },
+ },
+ });
+
+ res.json(JSON.parse(response.text || '{}'));
+ } catch (error: any) {
+ res.status(500).json({ error: error.message || 'Failed to improve script' });
+ }
+});
+
+async function startServer() {
+ if (!isProd) {
+ const vite = await createViteServer({
+ server: {
+ middlewareMode: true,
+ hmr: false,
+ },
+ appType: 'spa',
+ });
+ app.use(vite.middlewares);
+ } else {
+ app.use(express.static(path.join(__dirname, 'dist')));
+ app.get('*', (_req, res) => {
+ res.sendFile(path.join(__dirname, 'dist', 'index.html'));
+ });
+ }
+
+ app.listen(PORT, '0.0.0.0', () => {
+ console.log(`Explainroo UI server running at http://localhost:${PORT} in ${isProd ? 'production' : 'development'} mode`);
+ });
+}
+
+startServer().catch((err) => {
+ console.error('Failed to start server:', err);
+ process.exit(1);
+});
diff --git a/start.bat b/start.bat
new file mode 100644
index 0000000..960a1ff
--- /dev/null
+++ b/start.bat
@@ -0,0 +1,43 @@
+@echo off
+setlocal enabledelayedexpansion
+title Explainroo UI - Local Studio
+
+echo ======================================================================
+echo Explainroo UI - Visual Explainer Studio
+echo ======================================================================
+echo.
+
+:: 1. Check if Node.js is installed
+where node >nul 2>&1
+if %ERRORLEVEL% neq 0 (
+ echo [ERROR] Node.js is not installed or not found in system PATH.
+ echo Please download and install Node.js 18+ from https://nodejs.org
+ echo.
+ pause
+ exit /b 1
+)
+
+:: 2. Display Node version
+for /f "tokens=*" %%v in ('node -v') do set NODE_VERSION=%%v
+echo [INFO] Detected Node.js !NODE_VERSION!
+
+:: 3. Check and install dependencies if node_modules does not exist
+if not exist "node_modules" (
+ echo [INFO] First time setup: Installing dependencies...
+ call npm install
+ if %ERRORLEVEL% neq 0 (
+ echo [ERROR] Dependency installation failed!
+ pause
+ exit /b 1
+ )
+ echo [INFO] Dependencies installed successfully!
+)
+
+:: 4. Launch in default browser
+echo [INFO] Launching Explainroo UI at http://localhost:3000...
+start "" "http://localhost:3000"
+
+:: 5. Start dev server
+call npm run dev
+
+pause
diff --git a/start.sh b/start.sh
new file mode 100644
index 0000000..e039887
--- /dev/null
+++ b/start.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -e
+
+echo "======================================================================"
+echo " Explainroo UI - Visual Explainer Studio"
+echo "======================================================================"
+echo ""
+
+# 1. Check Node.js
+if ! command -v node &> /dev/null; then
+ echo "[ERROR] Node.js is not installed or not in PATH."
+ echo "Please install Node.js 18+ from https://nodejs.org"
+ exit 1
+fi
+
+echo "[INFO] Detected Node.js $(node -v)"
+
+# 2. Install dependencies if node_modules is missing
+if [ ! -d "node_modules" ]; then
+ echo "[INFO] First time setup: Installing dependencies..."
+ npm install
+fi
+
+# 3. Open browser after short delay
+echo "[INFO] Launching Explainroo UI at http://localhost:3000..."
+(sleep 2 && (command -v xdg-open &> /dev/null && xdg-open http://localhost:3000 || open http://localhost:3000) 2>/dev/null) &
+
+# 4. Start dev server
+npm run dev
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..eb882cd
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ "skipLibCheck": true,
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noFallthroughCasesInSwitch": true,
+ "types": ["vite/client", "vite-plugin-pwa/client"]
+ },
+ "include": ["src"]
+}
diff --git a/vite.config.ts b/vite.config.ts
new file mode 100644
index 0000000..f6d14ef
--- /dev/null
+++ b/vite.config.ts
@@ -0,0 +1,126 @@
+import { defineConfig } from 'vite';
+import react from '@vitejs/plugin-react';
+import tailwindcss from '@tailwindcss/vite';
+import { VitePWA } from 'vite-plugin-pwa';
+
+export default defineConfig({
+ plugins: [
+ tailwindcss(),
+ react(),
+ VitePWA({
+ registerType: 'autoUpdate',
+ includeAssets: [
+ 'favicon.ico',
+ 'apple-touch-icon.png',
+ 'icon.svg',
+ 'screenshot-desktop.png',
+ 'screenshot-mobile.png',
+ 'pwa-192x192.png',
+ 'pwa-512x512.png',
+ 'pwa-maskable-512x512.png'
+ ],
+ manifest: {
+ id: '/?source=pwa',
+ name: 'Explainroo UI - No-Code Explainer Video Creator',
+ short_name: 'Explainroo UI',
+ description: 'Transform GitHub repos and software concepts into narrated, animated explainer videos without code or terminal commands.',
+ theme_color: '#090d16',
+ background_color: '#020617',
+ display: 'standalone',
+ display_override: ['window-controls-overlay', 'standalone', 'minimal-ui'],
+ orientation: 'any',
+ start_url: '/?source=pwa',
+ scope: '/',
+ categories: ['design', 'productivity', 'education'],
+ prefer_related_applications: false,
+ icons: [
+ {
+ src: '/pwa-192x192.png',
+ sizes: '192x192',
+ type: 'image/png',
+ purpose: 'any',
+ },
+ {
+ src: '/pwa-512x512.png',
+ sizes: '512x512',
+ type: 'image/png',
+ purpose: 'any',
+ },
+ {
+ src: '/pwa-maskable-512x512.png',
+ sizes: '512x512',
+ type: 'image/png',
+ purpose: 'maskable',
+ },
+ ],
+ screenshots: [
+ {
+ src: '/screenshot-desktop.png',
+ sizes: '1280x720',
+ type: 'image/png',
+ form_factor: 'wide',
+ label: 'Explainroo Studio 16:9 Canvas Stage',
+ },
+ {
+ src: '/screenshot-mobile.png',
+ sizes: '720x1280',
+ type: 'image/png',
+ form_factor: 'narrow',
+ label: 'Explainroo Studio Mobile View',
+ },
+ ],
+ shortcuts: [
+ {
+ name: 'New Explainer',
+ short_name: 'Create',
+ description: 'Create a new animated explainer video',
+ url: '/',
+ icons: [{ src: '/pwa-192x192.png', sizes: '192x192' }],
+ },
+ ],
+ },
+ workbox: {
+ globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
+ runtimeCaching: [
+ {
+ urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
+ handler: 'CacheFirst',
+ options: {
+ cacheName: 'google-fonts-cache',
+ expiration: {
+ maxEntries: 10,
+ maxAgeSeconds: 60 * 60 * 24 * 365,
+ },
+ cacheableResponse: {
+ statuses: [0, 200],
+ },
+ },
+ },
+ {
+ urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
+ handler: 'CacheFirst',
+ options: {
+ cacheName: 'gstatic-fonts-cache',
+ expiration: {
+ maxEntries: 10,
+ maxAgeSeconds: 60 * 60 * 24 * 365,
+ },
+ cacheableResponse: {
+ statuses: [0, 200],
+ },
+ },
+ },
+ ],
+ },
+ devOptions: {
+ enabled: true,
+ type: 'module',
+ },
+ }),
+ ],
+ server: {
+ port: 3000,
+ host: '0.0.0.0',
+ hmr: false,
+ },
+});