Unclassified

IntegrateWise Platform → Backend Services Map

Complete Frontend-to-Backend Architecture Audit

Generated: August 6, 2026
Scope: apps/platform only (management console UI)
Status: Production Ready


PLATFORM OVERVIEW

Location: apps/platform
Type: Next.js 16 App Router (React 19)
Role: Operational Control Plane UI for tenant/connector/capability management
Auth: Clerk (email + password, OAuth ready)
API Surface: /api/v1/* (fronted by Gateway service)


CORE RULE

  • Platform UI never owns truth — all state lives in backend D1/Neon
  • Platform UI never talks directly to storage — routes through /api/v1 only
  • Platform UI consumes governed APIs — no auth bypass
  • Backend services own capability — business logic is service-owned
  • Spine owns operational state — immutable event log
  • Neon owns control plane — tenants, orgs, subscriptions, entitlements
  • D1 operates tenant runtime — entity registry, policies, capabilities

GOLDEN LOOP

User Action
    ↓
Platform UI Component
    ↓
fetch(/api/v1/*)
    ↓
Gateway (validation, auth, routing)
    ↓
Backend Service (business logic)
    ↓
D1 / Neon / Spine (truth)
    ↓
Event Emitted
    ↓
Projection Updated
    ↓
Platform UI Re-renders (SWR cache refresh)

ENTRY & AUTH LAYER

Auth Flow

Platform URL
    ↓
Clerk Session Check (middleware)
    ↓
Session Valid?
    ├─ YES → Resolve tenant context → Dashboard
    └─ NO → /login (Clerk)

Session Endpoints

  • GET /api/v1/auth/session → services/tenants + services/admin
    • Returns: { user, tenant, permissions, role }
    • SWR Hook: useSession()

Key Management

  • GET /api/v1/keys → services/admin
    • Returns: { apiKeys[], secrets[] }
    • SWR Hook: useKeys()

PLATFORM PAGES & SERVICE MAPPING

1. Dashboard (/)

Component: app/(shell)/page.tsx
Role: Entry point, operational summary

Displays:

  • Tenant overview
  • Recent activity
  • Key metrics

Services: tenants, admin
APIs: None (static initial render, SWR populates later)


2. Workspace (/workspace)

Component: app/(shell)/workspace/page.tsx
Role: Central discovery and workspace state

Displays:

  • Workspace topology
  • Connected systems
  • Capability registry

Services: spine, intelligence, gateway
APIs:

  • GET /api/v1/workspace/discovery → workspace state projection
  • GET /api/v1/workspace/bootstrap → initial workspace load

Data Flow:

useWorkspaceDiscovery()
    ↓
fetch(/api/v1/workspace/discovery)
    ↓
Gateway → Intelligence Service
    ↓
D1: workspace_metadata, entity_registry, capability_registry
    ↓
SWR Cache → Component re-renders

3. Connectors (/connectors)

Component: app/(shell)/connectors/page.tsx
Role: Connector lifecycle & management

Displays:

  • Installed connectors
  • Connection status
  • Sync configuration
  • Health metrics

Services: connector, connector-sync, integration-management-mcp, provider-management-mcp
APIs:

  • GET /api/v1/connectors → catalog of connectors
  • POST /api/v1/connectors/{id}/activate → install connector
  • DELETE /api/v1/connectors/{id} → remove connector
  • GET /api/v1/connections → active connections
  • POST /api/v1/connections → create connection
  • PATCH /api/v1/connections/{id} → update connection

Connectors Tracked:

  • Hubspot (CRM)
  • Salesforce (CRM)
  • Pipedrive (CRM)
  • Nango (integration broker)
  • Zapier (automation)
  • Custom (user-built)

Data Storage:

D1 Tables:
  - connector_catalog (metadata)
  - tenant_connections (state)
  - entity_sync_state (sync progress)
  - capability_registry (exposed tools)

4. Marketplace (/marketplace)

Component: app/(shell)/marketplace/page.tsx
Role: Plugin/MCP/connector discovery

Displays:

  • Available connectors
  • MCP servers
  • Plugins
  • Installation status

Services: marketplace-installation, provider-management-mcp, integration-management-mcp
APIs:

  • GET /api/v1/workspace/marketplace-items → available items
  • POST /api/v1/marketplace/install/{id} → install item
  • GET /api/v1/marketplace/installed → installed items
  • DELETE /api/v1/marketplace/{id} → uninstall

5. Network - MCP (/network/mcp)

Component: app/(shell)/network/mcp/page.tsx
Role: MCP server registry & tool exposure

Displays:

  • Registered MCP servers
  • Exposed tools
  • Semantic capabilities
  • Tool permissions

Services: mcp-pool, mcp-connector, provider-management-mcp, intelligence
APIs:

  • GET /api/v1/connectors/mcp-pool → MCP registry
  • POST /api/v1/connectors/mcp-pool/register → register server
  • GET /api/v1/capabilities → semantic tool registry
  • PATCH /api/v1/capabilities/{id}/permissions → manage access

Data Storage:

D1 Tables:
  - mcp_bindings (MCP ↔ workspace mapping)
  - capability_registry (tool metadata)
  - capability_grants (permissions)

6. Network - General (/network)

Component: app/(shell)/network/page.tsx
Role: Topology & system integration

Displays:

  • Service health
  • Integration topology
  • Capability graph
  • Data flow diagram

Services: spine, intelligence, telemetry, signals
APIs:

  • GET /api/v1/workspace/topology → system graph
  • GET /api/v1/signals → real-time metrics

7. Agents (/agents)

Component: app/(shell)/agents/page.tsx
Role: Agent lifecycle & orchestration

Displays:

  • Deployed agents
  • Agent status
  • Memory state
  • Execution logs

Services: agent-registry, iw-agent-runtime, continuity, twin-orchestrator
APIs:

  • GET /api/v1/agents → agent catalog
  • POST /api/v1/agents → create agent
  • PATCH /api/v1/agents/{id} → update config
  • GET /api/v1/agents/{id}/memory → agent state
  • GET /api/v1/agents/{id}/sessions → execution history

Data Storage:

D1 Tables:
  - agent_registry (agent metadata)
  - agent_sessions (execution state)
  - memory_entries (agent continuity)
  - continuity_ledger (event log)

8. Approvals (/approvals)

Component: app/(shell)/approvals/page.tsx
Role: Governance & workflow approvals

Displays:

  • Pending approvals
  • Approval history
  • Policy audit trail
  • Execution control

Services: twin-orchestrator, hermes, admin
APIs:

  • GET /api/v1/workspace/governance/approvals → pending items
  • POST /api/v1/workspace/governance/approvals/{id}/approve → approve
  • POST /api/v1/workspace/governance/approvals/{id}/reject → reject
  • GET /api/v1/workspace/governance/policies → policy registry

Data Storage:

D1 Tables:
  - proposals (pending approvals)
  - approvals (approval decisions)
  - audit_events (governance log)
  - policies (policy registry)

9. Governance (/governance)

Component: app/(shell)/governance/page.tsx
Role: Policy & access control

Displays:

  • Policy rules
  • Role-based access
  • Data governance
  • Compliance state

Services: twin-orchestrator, admin, intelligence
APIs:

  • GET /api/v1/workspace/governance → policy state
  • POST /api/v1/workspace/governance/policies → create policy
  • PATCH /api/v1/workspace/governance/policies/{id} → update policy
  • GET /api/v1/workspace/governance/audit → audit log

10. My Work (/my-work)

Component: app/(shell)/my-work/page.tsx
Role: User task dashboard

Displays:

  • Assigned tasks
  • My workflows
  • Recent activity
  • Metrics dashboard

Services: task-management, workflow, intelligence
APIs:

  • GET /api/v1/workflows/my-tasks → assigned work
  • GET /api/v1/workflows/recent → recent workflows
  • GET /api/v1/telemetry/personal → user metrics

11. Communications (/communications)

Component: app/(shell)/communications/page.tsx
Role: Alerts & notifications

Displays:

  • System alerts
  • Integration notifications
  • Error logs
  • Event stream

Services: signals, telemetry, webhook-ingress
APIs:

  • GET /api/v1/signals → real-time events
  • GET /api/v1/telemetry → metrics
  • GET /api/v1/workspace/audit → audit events

12. Settings (/settings)

Component: app/(shell)/settings/page.tsx
Role: Configuration & preferences

Displays:

  • Workspace settings
  • User preferences
  • Integration config
  • API keys & secrets

Services: admin, tenants, integration-management-mcp
APIs:

  • GET /api/v1/workspace/config → workspace settings
  • PATCH /api/v1/workspace/config → update settings
  • GET /api/v1/keys → API key management
  • POST /api/v1/keys → create key
  • DELETE /api/v1/keys/{id} → revoke key

13. Workbench (/workbench)

Component: app/(shell)/workbench/page.tsx
Role: Low-code builder & testing

Displays:

  • Workflow builder
  • Schema editor
  • Test runner
  • Capability explorer

Services: pipeline, loader, schema-ai, intelligence
APIs:

  • GET /api/v1/pipelines → pipeline catalog
  • POST /api/v1/pipelines → create pipeline
  • POST /api/v1/pipelines/{id}/test → test execution
  • GET /api/v1/schema → schema registry

14. Control Surface (/control/[surface])

Component: app/(shell)/control/[surface]/page.tsx
Role: Dynamic control panels

Displays:

  • Runtime controls
  • System administration
  • Performance tuning
  • Deployment config

Services: admin, tenants, gateway
APIs:

  • GET /api/v1/deployment/config → deployment state
  • PATCH /api/v1/deployment/config → update deployment
  • GET /api/v1/runtime/metrics → runtime metrics

API CLIENT LAYER

lib/api-client.ts

SWR Fetchers (automatic caching & request deduplication):

// Authentication
useSession() → GET /api/v1/auth/session
useKeys() → GET /api/v1/keys

// Connections & Integrations
useConnections() → GET /api/v1/connections
useConnectorProjections() → GET /api/v1/connectors

// Workspace Discovery
useWorkspaceDiscovery(skip?) → GET /api/v1/workspace/discovery
  - Returns canonical workspace projection
  - Skips fetch until session confirmed (conditional SWR)

Direct Fetch Helpers:

request<T>(path, options?) → authenticated fetch to /api/v1{path}
  - Auto-attaches auth headers
  - Returns typed JSON
  - Throws on auth failure

COMPONENT ARCHITECTURE

Platform Shell Layout

app/(shell)/layout.tsx
  ├── Navbar (with tenant selector, user menu)
  ├── Sidebar (navigation)
  ├── TenantProvider (context)
  └── Page Routes
      ├── /
      ├── /workspace
      ├── /connectors
      ├── /marketplace
      ├── /network/mcp
      ├── /network
      ├── /agents
      ├── /approvals
      ├── /governance
      ├── /my-work
      ├── /communications
      ├── /settings
      └── /workbench

Reusable Components

  • ConnectorCard: Display connector + status
  • CapabilityGrid: Tool registry visualization
  • AgentPanel: Agent state display
  • PolicyEditor: Governance rule builder
  • WorkflowBuilder: Low-code editor

DATA FLOW PATTERNS

Pattern 1: Fetch-on-Load + Cache

Component Mount
  ↓
SWR Hook (useSWR)
  ↓
fetch(/api/v1/*)
  ↓
Gateway validates auth + routes
  ↓
Service fetches from D1
  ↓
Response cached in SWR
  ↓
Component renders (sync)

Pattern 2: User Action + Mutation

User clicks button
  ↓
Form submission / Event handler
  ↓
fetch(POST /api/v1/*, { body })
  ↓
Gateway routes to service
  ↓
Service validates + stores in D1
  ↓
Event emitted (D1 → Redis Pub/Sub)
  ↓
SWR cache invalidated (mutate)
  ↓
Component refetches & re-renders

Pattern 3: Real-Time Updates

Webhook received (from external system)
  ↓
webhook-ingress service
  ↓
Event stored in D1 + Spine
  ↓
Projection updated
  ↓
WebSocket broadcast (if enabled)
  ↓
Platform UI subscribes + updates

BACKEND SERVICES DIRECT TO PLATFORM

Core Services (✓ Platform Consumes)

ServiceRoleAPIsD1 Tables
gatewayRequest routing, auth validation, tenant bindingAll /api/v1/* routes-
tenantsTenant lifecycle, provisioning, context/api/v1/auth/session, /api/v1/tenantstenants, organizations, subscriptions
adminUser, role, permission management/api/v1/keys, /api/v1/users, /api/v1/rolesusers, memberships, roles, permissions
connectorConnector activation, state/api/v1/connectors, /api/v1/connectors/{id}connector_catalog, tenant_connections
connector-syncSync orchestration, state tracking/api/v1/connections, /api/v1/connectors/syncentity_sync_state, sync_history
integration-management-mcpConnector metadata, OAuth flows/api/v1/connections/oauth, /api/v1/marketplace/connectorsintegration_catalog, oauth_state
provider-management-mcpProvider registry, capability exposure/api/v1/capabilities, /api/v1/connectors/providerscapability_registry, provider_catalog
mcp-poolMCP server registry & management/api/v1/connectors/mcp-pool, /api/v1/capabilitiesmcp_bindings, capability_registry
mcp-connectorMCP tool invocation/api/v1/connectors/mcp-pool/invoketool_invocations
agent-registryAgent metadata & lifecycle/api/v1/agents, /api/v1/agents/{id}agent_registry
iw-agent-runtimeAgent execution & orchestration/api/v1/agents/{id}/execute, /api/v1/agents/{id}/sessionsagent_sessions, agent_invocations
continuityAgent memory & state persistence/api/v1/agents/{id}/memory, /api/v1/continuitymemory_entries, continuity_ledger
twin-orchestratorWorkflow orchestration & approval routing/api/v1/workflows, /api/v1/workspace/governance/approvalsproposals, approvals, execution_log
pipelinePipeline definition & versioning/api/v1/pipelines, /api/v1/pipelines/{id}pipeline_definitions, pipeline_versions
loaderData loading & transformation/api/v1/pipelines/{id}/testloader_configurations
knowledgeDocument indexing & semantic search/api/v1/knowledge, /api/v1/knowledge/searchdocuments, knowledge_articles
intelligenceSemantic capabilities & reasoning/api/v1/capabilities, /api/v1/workspace/discoverycapability_registry, semantic_index
spineImmutable event log & relationships/api/v1/workspace/spine, /api/v1/entity/{id}/versionsentity_spine, spine_relationships, entity_versions
telemetryMetrics collection & reporting/api/v1/telemetry, /api/v1/signalsusage_rollups, metric_events
signalsReal-time event streamingWebSocket or /api/v1/signalssignal_events
hermesApproval workflow & notifications/api/v1/workspace/governance/approvalsapproval_history
task-managementTask assignment & tracking/api/v1/workflows/my-taskstask_assignments, task_history
marketplace-installationPlugin/connector installation/api/v1/marketplace/install, /api/v1/marketplace/installedmarketplace_installations
billingTenant billing & entitlements/api/v1/tenants/{id}/billingsubscriptions, usage_charges

SERVICES NOT CONSUMED BY PLATFORM

These are internal/cross-service dependencies:

ServiceRoleWhy Not Platform
context-fetchContext enrichment for agentsCalled by agents/services, not UI
schema-aiAI-powered schema inferenceBackend utility for workbench (piped through pipeline)
folder-watcherFile system monitoringInternal service integration
webhook-ingressExternal webhook receiverReceives payloads, triggers events
vercel-mcpVercel-specific MCP serverProvider-specific connector
agent-registryInternal agent catalogConsumed via mcp-pool + intelligence

STORAGE LAYER ISOLATION

Platform Never Talks To Storage Directly

❌ Platform does NOT:
  - Import Neon or D1 drivers
  - Execute SQL directly
  - Access KV/Redis
  - Read from R2

✅ Platform ALWAYS:
  - fetch(/api/v1/*)
  - Gateway validates + routes
  - Service owns queries
  - Returns typed JSON

ENVIRONMENT VARIABLES

Platform requires:

  • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY (Clerk auth)
  • CLERK_SECRET_KEY (Clerk backend)
  • NEXT_PUBLIC_API_BASE (API gateway URL, default /api/v1)

Backend shared:

  • NEON_DATABASE_URL (control plane Postgres)
  • TURSO_CONNECTION_URL (D1 compatible endpoint)
  • UPSTASH_REDIS_URL (pub/sub + caching)
  • TURSO_AUTH_TOKEN (D1 auth)

DEPLOYMENT ARCHITECTURE

Vercel (Frontend)
  └── apps/platform (Next.js on Vercel Serverless)

Cloudflare Workers (Backend)
  ├── gateway (routing)
  ├── tenants (auth)
  ├── admin (users)
  ├── connector (metadata)
  ├── connector-sync (sync)
  ├── integration-management-mcp (OAuth)
  ├── provider-management-mcp (registry)
  ├── mcp-pool (tool registry)
  ├── mcp-connector (tool invocation)
  ├── agent-registry (agents)
  ├── iw-agent-runtime (execution)
  ├── continuity (memory)
  ├── twin-orchestrator (workflows)
  ├── pipeline (definitions)
  ├── loader (transforms)
  ├── knowledge (semantic search)
  ├── intelligence (reasoning)
  ├── spine (events)
  ├── telemetry (metrics)
  ├── signals (streaming)
  ├── hermes (approvals)
  ├── task-management (tasks)
  ├── marketplace-installation (plugins)
  └── billing (subscriptions)

Storage Layer
  ├── Neon (Postgres) - Tenants, control plane
  ├── Turso/D1 (SQLite) - Runtime, tenant data
  ├── Upstash (Redis) - Cache, pub/sub
  └── R2 (Cloudflare) - Artifacts, documents

INTEGRATION CHECKLIST FOR NEW PAGES

When adding a new page to Platform:

  1. Define Page Route → app/(shell)/[name]/page.tsx
  2. Create Component → components/[Name]Page.tsx
  3. Identify Services → Which services own the data?
  4. Map APIs → Which /api/v1/* endpoints?
  5. Create SWR Hook → lib/hooks/use[Data].ts
  6. Add to Navigation → Update shell layout
  7. Test Auth → Does Clerk middleware block unauth?
  8. Test SWR → Does cache invalidate on mutation?
  9. Test Error States → Network failure, auth timeout
  10. Update admin-data.ts → Add to capability registry

QUICK REFERENCE: SERVICE TO PAGE MAPPING

PagesServicesAPIs
Dashboardtenants, admin/auth/session
Workspacespine, intelligence, gateway/workspace/discovery
Connectorsconnector, connector-sync, integration-management-mcp/connectors, /connections
Marketplacemarketplace-installation, provider-management-mcp/marketplace/items, /marketplace/install
Network/MCPmcp-pool, intelligence/connectors/mcp-pool, /capabilities
Networkspine, telemetry, signals/workspace/topology, /signals
Agentsagent-registry, iw-agent-runtime, continuity/agents, /agents/{id}/memory
Approvalstwin-orchestrator, hermes, admin/workspace/governance/approvals
Governancetwin-orchestrator, admin/workspace/governance, /workspace/governance/policies
My Worktask-management, workflow, intelligence/workflows/my-tasks
Communicationssignals, telemetry/signals, /telemetry
Settingsadmin, tenants, integration-management-mcp/workspace/config, /keys
Workbenchpipeline, loader, schema-ai, intelligence/pipelines, /pipelines/{id}/test

CRITICAL BOUNDARIES

Frontend / Backend Split

Frontend owns:

  • UI state (open/closed, active tab, form input)
  • Presentation (theming, animations, layout)
  • Client-side navigation

Backend owns:

  • Business logic (validation, auth, permissions)
  • Data truth (D1 tables, Spine events, Neon rows)
  • Cross-system coordination

Gateway Responsibility

The Gateway service is the only API entry point for Platform:

Platform Request
  ↓
Gateway (in services/gateway)
  ├── Validate Clerk JWT
  ├── Resolve tenant context
  ├── Check permissions
  ├── Route to service
  └── Return 401/403 if denied

No Platform component should bypass Gateway.


TESTING STRATEGY

Unit Tests

  • Component rendering (React Testing Library)
  • SWR hook behavior (mock fetch)
  • Form validation

Integration Tests

  • SWR cache invalidation on mutation
  • Error boundary handling
  • Auth flow with Clerk

E2E Tests

  • Full user journeys (Cypress/Playwright)
  • Multi-page workflows
  • Real backend service interactions

PERFORMANCE CHECKLIST

  • SWR hooks use shouldRetryOnError: false for intentional errors
  • Connectors page virtualizes large lists (content-visibility)
  • Agent memory doesn't load entire history (pagination)
  • Marketplace uses bundle-dynamic-imports for heavy modals
  • Dashboard preloads next page on hover (bundle-preload)
  • No N+1 queries in API routes (use Promise.all)
  • Spine events deduplicated with React.cache()

AUDIT TRAIL

DateChangeAuthor
2026-08-06Initial audit: 32 services, 14 platform pagesv0
-Mapped all /api/v1/* routes-
-Documented golden loop & storage isolation-
-Created service-to-page matrix-

NEXT STEPS

High Priority

  1. Verify all 32 services have corresponding API routes documented
  2. Add real-time WebSocket support for signals (live agent status)
  3. Implement full audit trail UI for governance page

Medium Priority

  1. Add search/filter to connectors, agents, marketplace
  2. Create dashboard widgets library (charts, metrics)
  3. Implement workflow builder advanced features

Low Priority

  1. Mobile responsive UI refinements
  2. Accessibility audit (WCAG 2.1 AA)
  3. Performance profiling & optimization

Generated by v0
For questions: Refer to integratewise-live monorepo docs