Skip to main content
The arena at arena.dualmindlab.tech is plain HTML, CSS and ES modules with no framework and no bundler. build.js copies a fixed list of files and folders into dist/, and the dualmind-arena Worker serves them.

Layout

DualMind_UI
index.html
config.js
js
auth
feature-flags.js
leaderboard
share
waitlist-worker
build.js
worker.js
wrangler.jsonc

Talking to the API

config.js sets one base URL: http://localhost:5079 on localhost, https://api.dualmindlab.tech everywhere else. All calls go through HttpClient:
  • adds Authorization: Bearer <access token> from the Supabase session,
  • 30 s default timeout (battles pass longer ones), 2 retries with exponential backoff and jitter for network errors,
  • JSON in and out, with extractChatResponse / extractDualChatResponse normalising response shapes.

The Worker

This is worker.js on the repository’s main branch. Static assets are served first, so /, /leaderboard/ and every file in dist/ load normally, and only paths that don’t match a file reach the Worker. The Worker also has a Flagship feature-flag binding that was used for the waitlist routing. The deployed version can lag the repository, so check it with npx wrangler deployments list before relying on this behaviour.
worker.js also contains a /share/* → share/index.html rewrite (and handlers for robots.txt, sitemap.xml and the 404 page), but they come after the catch-all waitlist redirect, so they never run. A /share/{threadId} link therefore doesn’t reach the rewrite. Move the rewrite above the redirect (or serve /share/* with the asset settings) and open a real share link to confirm. share/index.html reads the ID from the path, so the full path must survive any redirect.

Build, lint and test

CI (.github/workflows/ci.yml) runs pnpm install --frozen-lockfile, lint and node build.js on pushes and pull requests to main and master, and uploads dist/ as an artifact. Deploys are manual (pnpm run deploy, which builds and runs wrangler deploy); see Deploy and operate.

Supabase pieces the arena uses

  • Auth with Google OAuth and email/password, plus the auth-callback, auth-verify and password reset pages.
  • The email-wel-safe Edge Function for welcome emails.
  • The avatars storage bucket for profile pictures.
Last modified on October 18, 2026