◆ optalocal · ecosystem

Opta Local Architecture

The complete optalocal.com platform — 3 core apps, 8 management sites, one Supabase project, one Mac Studio inference host.

3 Core Apps 8 Management Sites 1 Inference Host
Full Stack Diagram
  ┌──────────────────── User Devices ──────────────────────────────┐
  │  MacBook / Windows PC / Linux                                  │
  │                                                                │
  │  opta chat │ opta tui │ opta do      Opta Code Desktop         │
  │  opta daemon (127.0.0.1:9999)         (Tauri + React, :5173)   │
  │         │  HTTP v3 + WebSocket  │                              │
  └─────────┼───────────────────────┼──────────────────────────────┘
           │ LAN: 192.168.188.x    │
  ┌─────────▼───────────────────────▼──────────────────────────────┐
  │  Mono512 Mac Studio M3 Ultra · 192.168.188.11 · 512GB RAM      │
  │                                                                │
  │  Opta LMX (port 1234)                                         │
  │  MLX primary │ GGUF fallback │ mDNS _opta-lmx._tcp.local      │
  └─────────────────────────────────────────────────────────────────┘

           │ HTTPS
  ┌─────────▼───────────────────────────────────────────────────────┐
  │  Vercel Edge Network — *.optalocal.com                         │
  │                                                                │
  │  optalocal.com (1T)    lmx.optalocal.com (1L)                 │
  │  init.optalocal.com (1O)    status.optalocal.com (1S)          │
  │  accounts.optalocal.com (1R)    help.optalocal.com (1U)        │
  │  learn.optalocal.com (1V)    admin.optalocal.com (1X)          │
  └─────────────────────────────────────────────────────────────────┘

           │ Supabase client
  ┌─────────▼───────────────────────────────────────────────────────┐
  │  Supabase (shared project) — SSO for all *.optalocal.com       │
  │  Auth │ Postgres DB │ Vault blob store │ Edge Functions         │
  └─────────────────────────────────────────────────────────────────┘
1D
Opta CLI
npm install -g opta-cli
TypeScript · Commander · Ink · Vitest · ESM
Terminal-first control surface. Hosts the daemon (HTTP v3 + WebSocket), runs the 4-layer agent loop, dispatches 30+ tools, and manages sessions. Primary user-facing binary. 2,300+ tests.
1M
Opta LMX
192.168.188.11:1234
Python 3.12 · FastAPI · MLX · Uvicorn
Apple Silicon inference server. OpenAI-compatible API, MLX primary backend, GGUF fallback via llama.cpp. 90% memory ceiling, hot-swap load/unload, built-in quantization pipeline, Skills/MCP bridge, Agent Graph. Runs exclusively on Mono512.
1P
Opta Code Desktop
localhost:5173 / native app
Tauri v2 · React 18 · Vite 7 · Rust
Native desktop client for macOS and Windows. Connects to the CLI daemon via HTTP/WebSocket. Renders the full agent UI, session history, settings studio, model picker, and browser peekaboo. Web mode: Vite dev server. Native mode: Tauri shell.

Layered pipeline: CLI daemon is the hub — it owns all session state, permission gating, and event persistence. LMX is the inference leaf (stateless per-request). Code Desktop is a display client that adds native OS integration (system tray, Tauri IPC, native dialogs). The three apps can run independently or together.

# Start the full local stack opta daemon start # daemon on 127.0.0.1:9999 # LMX already running on Mono512 cd 1P-Opta-Code-Universal npm run dev # desktop UI on localhost:5173
1T
Opta Home
optalocal.com
Next.js 16 · SSR (Vercel native)
Marketing landing page. Architecture diagram, benchmark strip, feature overview, download CTAs. Non-negotiable design: precision over decoration, terminal DNA.
1O
Opta Init
init.optalocal.com
Next.js 16 · Static export
Download and setup landing. Hosts channel manifests (stable/beta), download artifact links, and the Tauri desktop manager for auto-update flow. mDNS discovery docs.
1R
Opta Accounts
accounts.optalocal.com
Next.js 16 · SSR · Supabase SSR
Centralized SSO portal. Handles Google/Apple OAuth, email/password, and CLI browser auth flow. Sets cookies on .optalocal.com for cross-subdomain SSO. Control plane for device pairing.
1L
LMX Dashboard
lmx.optalocal.com
Next.js 16 · SWR polling
Real-time LMX monitoring. Sessions, models, agents, diagnostics, quantize pipeline UI, arena (model comparison), console, presets manager, paired device view.
1S
Opta Status
status.optalocal.com
Next.js 16 · API proxy
Live health monitoring for LMX, daemon, init, and all Vercel deployments. Polls health endpoints every 30s. Feature parity tracker via markdown files.
1U
Opta Help
help.optalocal.com
Next.js 16 · Static export
Documentation site. CLI reference, daemon lifecycle, daemon controls, LAN setup guide, security/privacy, developer SDK docs. Static export for fast global CDN delivery.
1V
Opta Learn
learn.optalocal.com
Next.js 16 · SSR · /gu HTML guides
Interactive masterclass guides. Two-track system: TS guide objects (L1–L3) and /gu HTML interactive guides (L4). Searchable, filterable, with live validation pipeline.
1X
Opta Admin
admin.optalocal.com
Next.js 16 · SSR · Supabase admin
Internal ops dashboard. Fleet health, release promotion across channels, guide promotion, website registry, CSP management.

Chat Request Flow

1
User types in opta tui or Code Desktop
2
CLI sends POST /v3/sessions/:id/turns to daemon
3
Daemon agent loop calls POST /v1/chat/completions on LMX
4
LMX streams tokens via SSE back to daemon
5
Daemon re-streams events to CLI via GET /v3/sessions/:id/stream
6
CLI renders tokens in TUI; Desktop receives via WebSocket

Tool Execution Flow

1
LMX returns a tool_call in the completion response
2
Daemon agent loop dispatches to tool executor
3
Permission gate evaluates — auto-allow, ask, or deny
4
Up to 8 tools execute in parallel via worker pool
5
Results appended as tool_result messages
6
Agent loop continues until no tool calls remain

Auth / Vault Sync Flow

1
opta account login opens accounts.optalocal.com in browser
2
User authenticates with Google/Apple/email via Supabase
3
CLI receives callback token on local listener :9998
4
Token stored; daemon vault.pull operation triggered
5
Encrypted secrets fetched from Supabase, decrypted locally
6
API keys written to OS keychain; providers auto-configured

Desktop Installer Flow

1
User visits init.optalocal.com, clicks Download
2
Channel manifest (stable/beta) fetched from CDN
3
Desktop manager (Tauri) checks manifest for new version
4
DMG/MSI artifact downloaded from GitHub Releases
5
App installed; setup wizard runs on first launch
6
mDNS discovers Mono512 LMX on LAN automatically
Browser / CLI                 accounts.optalocal.com           Supabase
     │                               │                                │
     │  GET /auth/callback?code=…    │                                │
     │──────────────────────────────►│                                │
     │                               │  exchangeCodeForSession(code)  │
     │                               │───────────────────────────────►│
     │                               │◄─── { session, user } ─────────│
     │                               │                                │
     │                               │  Set-Cookie: sb-* on           │
     │                               │  domain=.optalocal.com         │
     │◄──────────────────────────────│                                │
     │  Redirect to destination      │                                │
     │                               │                                │
Other sites (1L, 1S, 1T…)                                        │
     │  GET /api/route               │                                │
     │  Cookie: sb-* auto-sent ──────┼──────────────────────────────►│
     │                               │                                │  SSO!
Auth Methods
◆ Google OAuth (PKCE)
◆ Apple OAuth (PKCE)
◆ Email + Password
◆ CLI browser callback flow
◆ Magic link (email)
Security Rules
◆ redirect_to validated vs allowlist
◆ Cookies: secure + sameSite=lax
◆ domain: .optalocal.com prod only
◆ Vault: AES-256-GCM client-side
◆ Timing-safe daemon token compare
🖥
Mono512
Mac Studio M3 Ultra · LAN only
IP: 192.168.188.11
RAM: 512 GB unified
LMX port: 1234
mDNS: _opta-lmx._tcp.local
Never use Tailscale
Vercel
All 8 Next.js management sites
Domains: *.optalocal.com
DNS: Cloudflare CNAME
Edge network: global
Static: 1O, 1U (output export)
SSR: 1R, 1T, 1V, 1X, 1L, 1S
🐙
GitHub Releases
Desktop app distribution
macOS: .dmg + .app.tar.gz
Windows: .msi + .exe
Channels: stable / beta
Manifests: hosted on init.optalocal.com
CI: GitHub Actions (33 workflows)
🗄
Supabase
Shared project — all apps
Auth: 5 methods
DB: Postgres
Vault: encrypted blob store
SSO domain: .optalocal.com
Edge functions: key relay
📦
npm Registry
CLI distribution
Package: opta-cli
Build: tsup → ESM dist/
Entry: bin/opta
CI: opta-cli-release.yml
Shared pkgs: @opta/*
🔄
Syncthing
Dev file sync
MacBook → Mono512
Path: ~/Synced/Opta/
Excludes: node_modules, .next, dist
MacBook is MASTER (conflicts)
Never use /Volumes/312/ for writes