Unclassified

IntegrateWise — Frontend Layer Map

Version: 2.0 | Date: June 9, 2026 | Status: FINAL
Repo: integratewise-live/apps/web/
Design: Forest + Paper tokens (--iw-forest, --iw-paper, --iw-gold)
Data Layer: CF Gateway (gateway.dev.integratewise.ai) — zero Supabase frontend dependency
Auth: OAuth 2.0 via auth.integratewise.ai (RS256 JWT, 1hr access, 30d refresh)
Provider: VITE_SPINE_PROVIDER=gateway-proxy (live), local-mock (dev), spine-db (legacy)


Frontend Infrastructure (CF Gateway Wiring — Complete June 9, 2026)

All data flows through CF Workers. Zero direct Supabase from the browser.

Core Modules

ModulePathPurpose
AuthManagersrc/lib/auth-manager.tsOAuth 2.0 token lifecycle (PKCE, refresh, coalescing)
GatewayHttpClientsrc/lib/gateway-client.tsHTTP client (retry, 401/429/5xx, offline queue)
SpineGatewayAdaptersrc/utils/spine/gateway-adapter.tsDrop-in spineClient replacement via Gateway
SSE Clientsrc/lib/sse-client.tsReal-time signals (exponential backoff + polling fallback)
Query Clientsrc/lib/query-client.tsTanStack Query singleton (30s stale, 5m GC)
Onboarding Machinesrc/lib/onboarding.ts4-step state machine (localStorage persistence)
Onboarding APIsrc/lib/onboarding-api.tsStep 1–4 API calls + retry + resume

React Hooks

HookPathPurpose
useAuth()src/hooks/use-auth.tsuser, isAuthenticated, signIn, signOut
useHydration()src/hooks/use-hydration.tsMorning-context + delta invalidation
useSyncProgress(provider)src/hooks/use-sync-progress.tsCreamy Layer polling (2s)
usePublicFlags/Pricing/Status()src/hooks/use-public-data.tsNo-auth landing page data
useSSE()src/hooks/use-sse.tsReal-time signal subscription
useGatewayQuery()src/hooks/use-gateway-query.tsTanStack + Gateway convenience

Contexts

ContextPathPurpose
AuthProvidersrc/contexts/auth-context.tsxAuth state for all components
NetworkProvidersrc/contexts/network-context.tsxOffline detection + write failure surface

Build Enforcement

MechanismPathPurpose
Vite Pluginvite-plugins/no-supabase-gateway-proxy.tsFails build if Supabase in gateway-proxy bundle
CI Scriptscripts/check-no-supabase.tsPost-build scan of dist/assets/*.js

Auth Flow

User → auth.integratewise.ai/oauth/authorize (PKCE + state)
     → OAuth consent
     → /auth/callback?code=...&state=...
     → AuthManager.handleCallback() → token pair
     → Access token in memory, refresh in localStorage (iw_rt_{userId})
     → Proactive refresh at exp - 5min
     → On 401: single coalesced refresh → replay queued requests

Data Flow (Authenticated)

Component → spineClient.from("table").select().eq() → SpineGatewayAdapter
         → QueryBuilder collects filters → .then() resolves
         → GatewayHttpClient.get(path, params)
         → Authorization: Bearer {token}, x-tenant-id: {tenant}
         → CF Gateway validates → D1/KV → response
         → { data, error } (Supabase-compatible shape)

L0 — ONBOARDING

Purpose: Entry → Setup → First value in <2 minutes
Route prefix: /onboarding
Code: apps/web/src/components/activation/onboarding/

ScreenComponentRouteData SourceTime
LoginCF Access/ (intercepted)CF Zero Trust (Google/GitHub)0s
WelcomeWelcomeStep.tsx/onboarding step 1None (static)~15s
ProfileProfileStep.tsx/onboarding step 2None (user input)~30s
GoalsGoalsStep.tsx/onboarding step 3None → Spine Selector runs~25s
ConnectorsConnectorsStep.tsx/onboarding step 4GET /api/v1/connector/list~45s
LoadingAILoader.tsx(transition)Creamy sync running~10s

After L0: User lands in L1. Never returns unless adding a new tool.

Backend calls:

  • POST /api/v1/onboarding/initialize → creates tenant_spine_config
  • POST /api/v1/onboarding/connect → creates Nango session
  • GET /api/v1/connector/list → catalog (domain-ranked)

L1 — USER WORKBENCH

Purpose: Where you WORK. Personal + one domain. Daily use.
Route prefix: /personal/* and /work/*
Code: apps/web/src/components/l1/
Shell: workspace-shell-new.tsx (Personal/Work toggle)
Config: workspace-config.ts (drives sidebar per domain)

Personal View (/personal/*)

ViewComponentRouteData Source
Dashboarddashboard.tsx/personal/dashboardGET /api/v1/projections/morning-context
Todayhub-today-view.tsx/personal/hub-todayGET /api/v1/workspace/space/today
Tasks(shared)/personal/tasksGET /api/v1/workspace/view/tasks
Calendar(shared)/personal/calendarGET /api/v1/workspace/view/calendar
Notes(shared)/personal/notesGET /api/v1/workspace/view/notes
Projectsfounder-projects-view.tsx/personal/projectsGET /api/v1/workspace/view/projects
Knowledge Hubknowledge-hub-view.tsx/personal/knowledge-hubGET /api/v1/knowledge/memories
Bookmarksbookmarks-view.tsx/personal/bookmarksGET /api/v1/workspace/view/bookmarks
What's Newwhats-new-view.tsx/personal/whats-newGET /api/v1/workspace/view/whats-new
AI Chat(link to L3)/personal/ai-chatOpens Twin handoff

Work View (/work/*) — ONE domain per user

Resolved by: tenant_users.department → workspace-config.ts

Customer Success (43 views)

ViewRouteData Source
Dashboard/work/dashboardGET /api/v1/workspace/dashboard?domain=CUSTOMER_SUCCESS
Accounts/work/accountsGET /api/v1/pipeline/entities?type=account
Today/work/cs-todayGET /api/v1/projections/morning-context
Tasks/work/tasksGET /api/v1/workspace/view/tasks
Meetings/work/meetingsGET /api/v1/workspace/view/meetings
Renewals/work/renewalsGET /api/v1/pipeline/entities?type=renewal
Risk Matrix/work/risk-matrixGET /api/v1/intelligence/signals?type=risk
At-Risk/work/at-riskGET /api/v1/intelligence/signals?severity=critical
Health Scores/work/account-healthGET /api/v1/pipeline/entities?type=account
API Portfolio/work/api-portfolioGET /api/v1/pipeline/entities?type=api_portfolio
Platform Health/work/platform-healthGET /api/v1/pipeline/entities?type=platform_health_metric
Success Plans/work/success-plansGET /api/v1/pipeline/entities?type=success_plan
Engagement Log/work/engagement-logGET /api/v1/pipeline/entities?type=engagement
Initiatives/work/initiativesGET /api/v1/pipeline/entities?type=initiative
Strategic Objectives/work/strategic-objectivesGET /api/v1/pipeline/entities?type=strategic_objective
Risk Register/work/risk-registerGET /api/v1/pipeline/entities?type=risk_register
Value Streams/work/value-streamsGET /api/v1/pipeline/entities?type=value_stream
Capabilities/work/capabilitiesGET /api/v1/pipeline/entities?type=capability
People & Team/work/people-teamGET /api/v1/pipeline/entities?type=people_team
Stakeholder Outcomes/work/stakeholder-outcomesGET /api/v1/pipeline/entities?type=stakeholder_outcome
Insights/work/insightsGET /api/v1/intelligence/signals
Documents/work/documentsGET /api/v1/knowledge/documents
Contacts/work/contactsGET /api/v1/pipeline/entities?type=contact
Kanban/work/kanbanGET /api/v1/workspace/view/kanban

BizOps / Founder (29 views)

ViewRouteData Source
Dashboard/work/dashboardGET /api/v1/workspace/dashboard?domain=BIZOPS
Founder Ops/work/founder-opsGET /api/v1/workspace/bi/founder
CEO View/work/ceoGET /api/v1/workspace/bi/executive
COO View/work/cooGET /api/v1/workspace/bi/department/operations
CIO/CTO View/work/cio-ctoGET /api/v1/workspace/bi/department/engineering
Strategic Hub/work/strategic-hubGET /api/v1/workspace/bi/department/strategy
Operations Center/work/operationsGET /api/v1/workspace/bi/department/ops
BI View/work/biGET /api/v1/workspace/bi/executive
Knowledge Mgmt/work/knowledgeGET /api/v1/knowledge/documents
HR View/work/hrGET /api/v1/workspace/bi/department/hr
Legal View/work/legalGET /api/v1/workspace/bi/department/legal
Partnerships/work/partnershipsGET /api/v1/workspace/bi/department/partnerships
Sales Hub/work/salesGET /api/v1/workspace/bi/department/sales
Marketing/work/marketingGET /api/v1/workspace/bi/department/marketing
Clients/work/clientsGET /api/v1/pipeline/entities?type=account
Tasks/work/tasksGET /api/v1/workspace/view/tasks
Workflows/work/workflowsGET /api/v1/pipeline/entities?type=workflow
Analytics/work/analyticsGET /api/v1/workspace/bi/signals
Today/work/bizops-todayGET /api/v1/projections/morning-context

Sales (routes)

ViewRouteData Source
Dashboard/work/dashboardGET /api/v1/workspace/dashboard?domain=SALES
Pipeline/work/pipelineGET /api/v1/pipeline/entities?type=opportunity
Pipeline Kanban/work/pipeline-kanbanGET /api/v1/workspace/view/pipeline-kanban
Deals/work/dealsGET /api/v1/pipeline/entities?type=opportunity
Contacts/work/contactsGET /api/v1/pipeline/entities?type=contact
Activities/work/activitiesGET /api/v1/pipeline/entities?type=activity
Forecasting/work/forecastingGET /api/v1/pipeline/entities?type=forecast
Quotes/work/quotesGET /api/v1/pipeline/entities?type=quote
Sequences/work/sequencesGET /api/v1/pipeline/entities?type=email_sequence
Analytics/work/sales-analyticsGET /api/v1/workspace/bi/department/sales

Other Domains (same pattern)

All domains follow: GET /api/v1/pipeline/entities?type={entity_type} for entity views, GET /api/v1/workspace/dashboard?domain={DOMAIN} for dashboards.

Shared Routes (all users)

ViewRouteData Source
Entity 360/entity360/:idGET /api/v1/projections/entity360/:id
Connectors/connectorsGET /api/v1/connector/list
Bridge/bridgeGET /api/v1/projections/morning-context
Settings/settingsGET /api/v1/auth/me

L2 — OVERLAY (Awareness Drawer)

Purpose: Twin's passive presence. Interrupts only when warranted.
Code: apps/web/src/components/l2/cognitive/
Trigger: cognitive-triggers.tsx (evaluates awareness profile)

ComponentPurposeData Source
l2-drawer-animated.tsxDrawer shell (bottom-to-top)N/A (layout)
cognitive-triggers.tsxEvaluates signals vs profileGET /api/v1/intelligence/signals
SpinePanelEntity operational contextGET /api/v1/projections/entity360/:id
ContextPanelEntity relationship contextSame as above
live-signals-strip.tsxSignal indicator barGET /api/v1/intelligence/signals
ai-insight-popup.tsxCritical popupPOST from Twin via continuity-tool-server
[Open Twin ↗] buttonHandoff to L3twin-owui-handoff.ts

Awareness Profile (drives what appears):

{
  "signal_entitlements": ["health_drop", "renewal_approaching"],
  "panel_entitlements": ["spine", "context"],
  "threshold": 0.75,
  "department": "customer_success",
  "role": "manager"
}

L3 — OWUI (Twin Full Surface)

Purpose: Where you THINK. Full reasoning. Voice. Agent execution.re
URL: twin.integratewise.ai (Hostinger)
Code: integratewise-ops/vps-operations-stack/openwebui/
Embed: apps/web/src/components/l1/twin/twin-workbench.tsx (iframe)

ComponentPurposeTechnology
Open WebUIChat surface, model switchingghcr.io/open-webui/open-webui:ollama
Agent ZeroReasoning, tool use, delegationfrdel/agent-zero:latest
x.ai Audio ProxyVoice (TTS + STT)Custom proxy → x.ai API
Continuity Tool ServerSpine reads/writesCustom → pipeline.dev.integratewise.ai
Agent Zero Tool ServerA0 integrationCustom bridge
iw-l1-handoff-inlet.pyReads L1→L3 contextOWUI filter

MCP Connection:

  • URL: https://mcp.integratewise.ai/invoke
  • Auth: Bearer iw-mcp-spine-key-2026
  • Tools: 18 (memory., spine., book., kb.)

Voice:

  • TTS: x.ai via xai-audio-proxy (voice: "eve")
  • STT: x.ai via xai-audio-proxy (Whisper)
  • Model: Grok-4.3 (default, swappable)

L4 — MEMORY (Knowledge Projection)

Purpose: Where you KNOW. The library. Governed knowledge.
Surface: Coda (external tool, projection)
Sync: packages/coda-pack/sync-org-memory.ts
Data: D1 org_memory → MCP → Coda tables

StructureContentSource
Departments (14)Strategy, Product, Marketing, Sales, CS, Ops, Finance, HR, Data, Legal, Security, Partnerships, Innovation, AIorg_memory.related_departments
Functional QuadrantsThink / Decide / Work / Learnorg_memory.category → mapped
Node FieldsID, Title, Category, Function, Department, Content, Confidence, State, Date, Entity Refsorg_memory columns
Graph Relationsdepends_on, influences, leads_toorg_memory.entity_refs (resolved from Spine)

No archive. Everything active or superseded (with lineage).


API Contract Summary

All frontend calls go through gateway.dev.integratewise.ai:

Auth Endpoints (auth.integratewise.ai)

PatternPurposeUsed By
GET /oauth/authorizeInitiate OAuth (PKCE + state)AuthManager.signIn()
POST /oauth/tokenExchange code / refreshAuthManager.handleCallback(), refreshToken()
POST /oauth/revokeRevoke refresh tokenAuthManager.signOut()

Public Endpoints (no auth required)

PatternPurposeUsed By
GET /api/v1/public/flagsFeature flagsusePublicFlags()
GET /api/v1/public/pricingPricing datausePublicPricing()
GET /api/v1/public/statusSystem statususePublicStatus()

Authenticated Endpoints

PatternPurposeUsed By
GET /api/v1/projections/morning-contextMorning briefinguseHydration(), L1 /desk
GET /api/v1/projections/entity360/:idFull entity viewL1 Entity 360, L2 panels
GET /api/v1/projections/governance/boardTasks + proposalsL1 governance views
GET /api/v1/projections/inboxUnified queueL1 /inbox
GET /api/v1/pipeline/entities?type=XEntity queriesL1 all domain views
GET /api/v1/pipeline/status?connector=XCreamy Layer syncuseSyncProgress()
GET /api/v1/pipeline/delta-statusDelta checkuseHydration() background
GET /api/v1/intelligence/signalsActive signalsL2 triggers, L1 today views
GET /api/v1/connector/listConnector catalogL0 + L1 /connectors
GET /api/v1/connectors/:provider/authorizeOAuth redirect URLOnboarding Step 3
GET /api/v1/connectors/:provider/callbackOAuth callbackOnboarding Step 3
GET /api/v1/knowledge/memoriesOrg memory browseL1 knowledge views
POST /api/v1/workspace/initializeCreate workspaceOnboarding Step 1
POST /api/v1/workspace/configure-domainDomain configOnboarding Step 2
POST /api/v1/workspace/configure-rbacRBAC configOnboarding Step 2
POST /api/v1/workspace/activateFinalize setupOnboarding Step 4
GET /api/v1/workspace/dashboard?domain=XDomain dashboardL1 work dashboards
GET /api/v1/workspace/bi/department/:deptDepartment dataL1 BizOps views
GET /api/v1/auth/meSession validationAll layers

Real-Time Endpoints

PatternPurposeUsed By
GET /stream/signalsSSE signal deliverysseClient / useSSE()
GET /stream/pipeline-progressSSE sync progressuseSyncProgress() (optional upgrade)

One app. Five layers. Personal + Work. Same Spine. Same gateway. Same memory.
Auth: OAuth 2.0 (RS256). Data: CF Gateway → D1/KV. Real-time: SSE. Zero Supabase frontend.