Overview
The admin panel is a separate Cloudflare Workers application providing a management dashboard for all DualMind Lab entities: users, AI models, threads, comparisons, votes, and providers.Technology stack
Directory structure
Worker proxy pattern
Theworker.js is the entry point. It handles three responsibilities:
1. API proxy (/api/*)
All requests starting with /api/ are forwarded to the backend:
worker.js
2. Static file serving
Non-API requests are served from theASSETS binding (Cloudflare Workers Sites KV):
3. Clean URL routing
- Extensionless paths try
.htmlsuffix (e.g.,/usersservesusers.html) - Unmatched routes fall back to
index.html
Admin API endpoints
All admin endpoints are at/api/admin/* on the backend. The admin panel calls these through its Worker proxy.
Authentication
The admin panel uses the same Supabase JWT as the main frontend. Theauth-gate.js script checks for a valid session on page load and redirects to login if missing.
Admin endpoints on the backend currently do not enforce role-based access control. Any authenticated user can access admin APIs. This is a known limitation for the college project scope.
Deployment
wrangler.toml:
BACKEND_URL— Backend API base URL