Stack
DualMind Lab’s frontend is a vanilla JavaScript application with no build step. It uses ES modules, custom CSS, and is served via Cloudflare Workers in production.| Aspect | Details |
|---|---|
| Language | Vanilla JavaScript (ES modules) |
| Build | None — served as-is |
| Auth | Supabase JS client via CDN |
| Styling | Custom CSS (no framework) |
| Dev server | npx serve . -p 8000 |
| Production | Cloudflare Workers |
Key files
| File | Purpose |
|---|---|
config.js | Runtime configuration: API URL, Supabase keys, feature flags, streaming settings |
js/api/DualMindApi.js | API client facade — singleton api export |
js/app-final.js | Application entry point |
js/arena-core.js | Arena battle mode logic |
js/chat-handler.js | Chat message send/receive |
components/chat/ChatView.js | Chat message rendering |
components/ChatInput.js | User input with auto-resize |
worker.js | Cloudflare Worker for production |
API client
TheDualMindApi class provides a clean interface to the backend:
Configuration
All runtime configuration is inconfig.js via window.DUALMIND_CONFIG:
apiBaseUrl— Auto-detected:localhost:5079for dev,api.dualmindlab.techfor productionsupabase.url/supabase.anonKey— Supabase project credentialsstreaming.enabled— SSE streaming toggle (default:true)features.*— Feature flags for streaming, voting, threads, leaderboardspeedPreset—'fast','balanced', or'quality'presets
Auth flow
- User visits
/loginpage - Clicks “Login with Google” → Supabase OAuth redirect
- After consent, redirected back with JWT in URL hash
- Supabase JS client stores session (localStorage)
- All subsequent API calls include
Authorization: Bearer <jwt>header automatically viaHttpClient
Pages
| URL path | HTML file | Description |
|---|---|---|
/ | index.html | Main chat/arena interface |
/login | login/index.html | Authentication |
/leaderboard | leaderboard/index.html | Model rankings |
/models | models/index.html | Browse AI models |
/share | share/index.html | View shared threads |
/about | about/index.html | About page |