Skip to main content

State architecture

DualMind Lab frontend uses no state management library. State is managed through:
  1. window.DUALMIND_CONFIG — global runtime configuration
  2. Supabase session — authentication state in localStorage
  3. DOM state — UI state lives in the DOM
  4. In-memory caches — API responses cached with TTL

Global configuration state

All configuration is set once in config.js and accessed via window.DUALMIND_CONFIG:

Configuration categories

Authentication state

Managed entirely by the Supabase JS client. The session is stored in localStorage and includes:
  • access_token — JWT for API calls
  • refresh_token — for token renewal
  • user — user profile (id, email, name)

Caching strategy

The frontend caches certain API responses in memory with configurable TTLs:

Data flow pattern

There is no centralized store. Each page manages its own state through direct DOM manipulation and API calls.