Unclassified

IntegrateWise System & Architecture Documentation

Engineering & IT Reference Guide

Version: 1.0
Classification: Internal + Partner
Last Updated: January 2026
Audience: CTOs, IT Teams, Security Teams, Integration Partners


Table of Contents

  1. Executive Summary
  2. High-Level Architecture
  3. Data Flow Diagrams
  4. Data Storage Architecture
  5. Cloud vs User Systems
  6. Integration Architecture
  7. Failure & Retry Behavior
  8. Latency Expectations
  9. Scalability Model
  10. Network Architecture

1. Executive Summary

1.1 What IntegrateWise Is

IntegrateWise is a cloud-native unified workspace platform that:

  • Connects to your existing business tools via secure OAuth 2.0
  • Normalizes data into a consistent schema (one source of truth)
  • Routes data to appropriate teams with role-based permissions
  • Provides AI-powered automation suggestions (user-approved)
  • Generates documents and reports from unified data

1.2 Architecture Philosophy

PrincipleImplementation
Edge-FirstAPI runs on Cloudflare's global edge network (300+ PoPs)
Zero TrustAll requests authenticated, no implicit trust
Data IsolationTenant data isolated via Row-Level Security
User ControlAll automations require explicit user approval
No Data TrainingCustomer data never used for AI model training

1.3 Technology Stack Summary

┌─────────────────────────────────────────────────────────────┐
│                    TECHNOLOGY STACK                          │
├─────────────────────────────────────────────────────────────┤
│  Frontend        │  React 18 + Vite + TypeScript            │
│  Mobile          │  React Native (iOS/Android)              │
│  API Layer       │  Cloudflare Workers (Edge)               │
│  Database        │  Supabase PostgreSQL 15                  │
│  Vector Search   │  pgvector extension                      │
│  Cache           │  Cloudflare KV                           │
│  Queue           │  Cloudflare Queues                       │
│  Storage         │  Cloudflare R2 (S3-compatible)           │
│  Automation      │  n8n Cloud                               │
│  AI              │  OpenAI API + Anthropic API              │
│  Auth            │  Supabase Auth (OAuth 2.0, SAML)         │
│  CDN             │  Cloudflare (automatic)                  │
└─────────────────────────────────────────────────────────────┘

2. High-Level Architecture

2.1 System Architecture Diagram

                                    ┌─────────────────────┐
                                    │    END USERS        │
                                    │  (Web / Mobile)     │
                                    └──────────┬──────────┘
                                               │
                                               │ HTTPS
                                               ▼
┌──────────────────────────────────────────────────────────────────────────────┐
│                         CLOUDFLARE EDGE NETWORK                               │
│                        (300+ Global Points of Presence)                       │
│  ┌────────────────┐  ┌────────────────┐  ┌────────────────┐                  │
│  │   Cloudflare   │  │   Cloudflare   │  │   Cloudflare   │                  │
│  │     Pages      │  │    Workers     │  │      WAF       │                  │
│  │   (Frontend)   │  │   (API Edge)   │  │   (Security)   │                  │
│  └───────┬────────┘  └───────┬────────┘  └────────────────┘                  │
│          │                   │                                                │
│          │    ┌──────────────┼──────────────┐                                │
│          │    │              │              │                                │
│          │    ▼              ▼              ▼                                │
│          │  ┌──────┐    ┌──────┐    ┌──────────┐                             │
│          │  │  KV  │    │Queues│    │    R2    │                             │
│          │  │Cache │    │      │    │ Storage  │                             │
│          │  └──────┘    └──────┘    └──────────┘                             │
└──────────┼───────────────────┼───────────────────────────────────────────────┘
           │                   │
           │                   │ Secure Connection (mTLS)
           │                   ▼
           │    ┌──────────────────────────────────────────────────────────────┐
           │    │                    SUPABASE CLOUD                             │
           │    │  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐       │
           │    │  │  PostgreSQL  │  │   Realtime   │  │  Supabase    │       │
           │    │  │   Database   │  │   (WebSocket)│  │    Auth      │       │
           │    │  │  + pgvector  │  │              │  │              │       │
           │    │  └──────────────┘  └──────────────┘  └──────────────┘       │
           │    └──────────────────────────────────────────────────────────────┘
           │                   │
           │                   │
           │    ┌──────────────┼──────────────┐
           │    │              │              │
           │    ▼              ▼              ▼
           │  ┌──────────┐  ┌──────────┐  ┌──────────┐
           │  │  n8n     │  │  OpenAI  │  │Anthropic │
           │  │  Cloud   │  │   API    │  │   API    │
           │  │(Workflow)│  │          │  │          │
           │  └──────────┘  └──────────┘  └──────────┘
           │
           │
           ▼
┌──────────────────────────────────────────────────────────────────────────────┐
│                         EXTERNAL INTEGRATIONS                                 │
│                        (Customer's Existing Tools)                            │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐            │
│  │  Slack  │  │ HubSpot │  │  Gmail  │  │ Notion  │  │ Sheets  │            │
│  └─────────┘  └─────────┘  └─────────┘  └─────────┘  └─────────┘            │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐            │
│  │Salesforce│ │ Zendesk │  │  Jira   │  │ Stripe  │  │ GitHub  │            │
│  │(Coming) │  │(Coming) │  │(Coming) │  │(Coming) │  │(Coming) │            │
│  └─────────┘  └─────────┘  └─────────┘  └─────────┘  └─────────┘            │
└──────────────────────────────────────────────────────────────────────────────┘

2.2 Layer Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│ LAYER 7: PRESENTATION                                                        │
│ React Web App + React Native Mobile                                          │
│ • Renders unified data views                                                 │
│ • Role-based UI components                                                   │
│ • Real-time updates via WebSocket                                            │
├─────────────────────────────────────────────────────────────────────────────┤
│ LAYER 6: RENDER ENGINE                                                       │
│ Document Generation (Cloudflare Workers)                                     │
│ • DOCX, PPTX, PDF, Email generation                                          │
│ • Template merging with live data                                            │
│ • Scheduled report generation                                                │
├─────────────────────────────────────────────────────────────────────────────┤
│ LAYER 5: AUTOMATION ENGINE                                                   │
│ n8n Cloud + Cloudflare Workers                                               │
│ • Event-driven triggers                                                      │
│ • Condition evaluation                                                       │
│ • Suggestion queue (user approval)                                           │
├─────────────────────────────────────────────────────────────────────────────┤
│ LAYER 4: BRAIN (AI MEMORY)                                                   │
│ Vector Database (pgvector)                                                   │
│ • Conversation storage                                                       │
│ • Semantic search                                                            │
│ • AI context retrieval                                                       │
├─────────────────────────────────────────────────────────────────────────────┤
│ LAYER 3: CONNECTORS (LOADERS)                                                │
│ OAuth 2.0 Integration Layer                                                  │
│ • Token management                                                           │
│ • Data sync scheduling                                                       │
│ • Rate limit handling                                                        │
├─────────────────────────────────────────────────────────────────────────────┤
│ LAYER 2: HUBS (ROUTING)                                                      │
│ Permission & Routing Engine                                                  │
│ • Team-based data routing                                                    │
│ • Role-based access control                                                  │
│ • Audit logging                                                              │
├─────────────────────────────────────────────────────────────────────────────┤
│ LAYER 1: SPINE (DATA LAYER)                                                  │
│ Supabase PostgreSQL                                                          │
│ • Normalized data schemas (Zod)                                              │
│ • Row-level security                                                         │
│ • Foreign key relationships                                                  │
├─────────────────────────────────────────────────────────────────────────────┤
│ LAYER 0: EXTERNAL TOOLS                                                      │
│ Customer's Existing SaaS Applications                                        │
│ • Source systems (HubSpot, Slack, etc.)                                      │
│ • Read via OAuth 2.0 APIs                                                    │
│ • Optional write-back (user-enabled)                                         │
└─────────────────────────────────────────────────────────────────────────────┘

3. Data Flow Diagrams

3.1 Data Ingestion Flow (CONNECT → IMPORT)

┌─────────────────────────────────────────────────────────────────────────────┐
│                         DATA INGESTION FLOW                                  │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│  External   │     │   OAuth     │     │    Sync     │     │  Transform  │
│    Tool     │────▶│   Handler   │────▶│   Engine    │────▶│   Pipeline  │
│  (HubSpot)  │     │             │     │             │     │             │
└─────────────┘     └─────────────┘     └─────────────┘     └──────┬──────┘
                                                                   │
     Step 1:              Step 2:            Step 3:               │ Step 4:
     User clicks      OAuth redirect      Scheduled or         Validate &
     "Connect"        & token store       on-demand sync       Normalize
                                                                   │
                                                                   ▼
┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Unified   │     │   Routing   │     │    Audit    │     │    Zod      │
│   Storage   │◀────│    Engine   │◀────│    Logger   │◀────│   Schema    │
│  (Supabase) │     │   (Hubs)    │     │             │     │  Validation │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘

     Step 8:              Step 7:            Step 6:               Step 5:
     Store in          Route to           Log every            Validate
     tenant DB         correct hub        operation            against
                                                               contract

Detailed Steps:

StepComponentActionDuration
1FrontendUser initiates OAuth flow< 1s
2OAuth HandlerRedirect to provider, receive tokens5-10s
3Sync EngineFetch data via API, handle pagination10s - 5min
4Transform PipelineClean, dedupe, format data< 1s/record
5Zod ValidationValidate against schema contract< 1ms/record
6Audit LoggerLog sync event with metadata< 10ms
7Routing EngineDetermine target hub(s)< 5ms
8DatabaseInsert/update with RLS< 50ms

3.2 Automation Flow (AUTOMATE)

┌─────────────────────────────────────────────────────────────────────────────┐
│                          AUTOMATION FLOW                                     │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Event     │     │  Trigger    │     │  Condition  │
│  Detected   │────▶│   Matcher   │────▶│  Evaluator  │
│             │     │             │     │             │
└─────────────┘     └─────────────┘     └──────┬──────┘
                                               │
     Events:             Match:                │ Evaluate:
     • Record created    • Which automations   │ • All conditions
     • Field changed     • Which triggers      │ • AND/OR logic
     • Time elapsed                            │
                                               │
                         ┌─────────────────────┴─────────────────────┐
                         │                                           │
                         ▼                                           ▼
              ┌─────────────────────┐                    ┌─────────────────────┐
              │   APPROVAL MODE:    │                    │   APPROVAL MODE:    │
              │   "suggest_only"    │                    │ "auto_run_notify"   │
              └──────────┬──────────┘                    └──────────┬──────────┘
                         │                                          │
                         ▼                                          ▼
              ┌─────────────────────┐                    ┌─────────────────────┐
              │   Suggestion        │                    │   Execute Action    │
              │   Queue             │                    │   Immediately       │
              │   (Await Approval)  │                    │                     │
              └──────────┬──────────┘                    └──────────┬──────────┘
                         │                                          │
                         │ User clicks                              │
                         │ "Approve"                                │
                         │                                          │
                         └────────────────────┬─────────────────────┘
                                              │
                                              ▼
                              ┌─────────────────────────┐
                              │    Execute Actions      │
                              │    • Update field       │
                              │    • Create task        │
                              │    • Send notification  │
                              │    • Create alert       │
                              └─────────────────────────┘

3.3 Document Generation Flow (CREATE)

┌─────────────────────────────────────────────────────────────────────────────┐
│                       DOCUMENT GENERATION FLOW                               │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   User      │     │  Template   │     │    Data     │     │   Render    │
│   Request   │────▶│   Loader    │────▶│   Fetcher   │────▶│   Engine    │
│             │     │             │     │             │     │             │
└─────────────┘     └─────────────┘     └─────────────┘     └──────┬──────┘
                                                                   │
     Input:              Load:               Query:                │ Merge:
     • Template ID       • DOCX/PPTX        • Accounts             │ • Replace
     • Data filters      • Email HTML       • Metrics              │   placeholders
     • Output format     • Placeholders     • Activities           │ • Format values
                                                                   │
                                                                   ▼
┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   User      │     │   Signed    │     │    R2       │     │   Output    │
│  Download   │◀────│    URL      │◀────│   Storage   │◀────│  Generator  │
│             │     │  (15 min)   │     │             │     │             │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘

     Output:            Secure:              Store:              Generate:
     • Download file    • Time-limited      • Temporary         • DOCX/PPTX
     • Open in app      • Signed URL        • 24hr retention    • PDF/Email

3.4 AI Memory Flow (REMEMBER)

┌─────────────────────────────────────────────────────────────────────────────┐
│                          AI MEMORY FLOW (BRAIN)                              │
└─────────────────────────────────────────────────────────────────────────────┘

                           STORING CONVERSATIONS
                           ─────────────────────

┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│  AI Chat    │     │  Browser    │     │  Embedding  │     │   Vector    │
│ (ChatGPT/   │────▶│  Extension  │────▶│   Model     │────▶│   Store     │
│  Claude)    │     │             │     │ (OpenAI)    │     │ (pgvector)  │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘

     Source:            Capture:            Convert:             Store:
     • ChatGPT          • Conversation      • Text → Vector      • 1536-dim
     • Claude           • Metadata          • 1536 dimensions    • Tenant isolated
     • Gemini           • Timestamp                              • Indexed


                           SEARCHING MEMORIES
                           ──────────────────

┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Search    │     │  Embedding  │     │   Vector    │     │   Results   │
│   Query     │────▶│   Model     │────▶│   Search    │────▶│  (Ranked)   │
│             │     │             │     │  (cosine)   │     │             │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘

     Input:             Convert:            Match:               Output:
     • Natural          • Query → Vector    • Similarity > 0.7   • Top 10
       language         • Same model        • Filter by tenant   • With scores

4. Data Storage Architecture

4.1 Storage Overview

┌─────────────────────────────────────────────────────────────────────────────┐
│                         DATA STORAGE MAP                                     │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐    │
│  │                    SUPABASE POSTGRESQL                               │    │
│  │                    (Primary Data Store)                              │    │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐                  │    │
│  │  │   Core      │  │   Vector    │  │   Audit     │                  │    │
│  │  │   Tables    │  │   Store     │  │   Logs      │                  │    │
│  │  │             │  │ (pgvector)  │  │             │                  │    │
│  │  │ • accounts  │  │             │  │ • actions   │                  │    │
│  │  │ • contacts  │  │ • memories  │  │ • changes   │                  │    │
│  │  │ • deals     │  │ • embeddings│  │ • logins    │                  │    │
│  │  │ • tasks     │  │             │  │             │                  │    │
│  │  └─────────────┘  └─────────────┘  └─────────────┘                  │    │
│  └─────────────────────────────────────────────────────────────────────┘    │
│                                                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐    │
│  │                    CLOUDFLARE KV                                     │    │
│  │                    (Edge Cache)                                      │    │
│  │  • Session tokens        • Rate limit counters                      │    │
│  │  • API response cache    • Feature flags                            │    │
│  │  • User preferences      • Connector status                         │    │
│  └─────────────────────────────────────────────────────────────────────┘    │
│                                                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐    │
│  │                    CLOUDFLARE R2                                     │    │
│  │                    (Object Storage)                                  │    │
│  │  • Generated documents   • Template files                           │    │
│  │  • Attachments           • Export archives                          │    │
│  │  • User uploads          • Backup snapshots                         │    │
│  └─────────────────────────────────────────────────────────────────────┘    │
│                                                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐    │
│  │                    CLOUDFLARE QUEUES                                 │    │
│  │                    (Async Processing)                                │    │
│  │  • Sync job queue        • Email queue                              │    │
│  │  • Webhook delivery      • Report generation                        │    │
│  │  • Automation triggers   • Bulk operations                          │    │
│  └─────────────────────────────────────────────────────────────────────┘    │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

4.2 Data by Storage Type

Data TypeStorageLocationRetentionEncryption
Core Business DataPostgreSQLSupabase (AWS)Until deletedAES-256
Vector EmbeddingspgvectorSupabase (AWS)Until deletedAES-256
Audit LogsPostgreSQLSupabase (AWS)2 yearsAES-256
Session TokensKVCloudflare Edge24 hoursTLS only
API CacheKVCloudflare Edge5-60 minTLS only
Generated DocsR2Cloudflare24 hoursAES-256
AttachmentsR2CloudflareUntil deletedAES-256
Sync JobsQueuesCloudflareUntil processedTLS only

4.3 Database Schema (Simplified)

┌─────────────────────────────────────────────────────────────────────────────┐
│                         DATABASE SCHEMA                                      │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────────┐       ┌─────────────────┐       ┌─────────────────┐
│  organizations  │       │     users       │       │     teams       │
├─────────────────┤       ├─────────────────┤       ├─────────────────┤
│ id (PK)         │──┐    │ id (PK)         │       │ id (PK)         │
│ name            │  │    │ organization_id │───┐   │ organization_id │
│ plan            │  │    │ email           │   │   │ name            │
│ settings        │  │    │ role            │   │   │ hub_id          │
└─────────────────┘  │    │ team_ids[]      │   │   └─────────────────┘
                     │    └─────────────────┘   │
                     │                          │
                     │    ┌─────────────────────┘
                     │    │
                     ▼    ▼
┌─────────────────┐       ┌─────────────────┐       ┌─────────────────┐
│    accounts     │       │    contacts     │       │     deals       │
├─────────────────┤       ├─────────────────┤       ├─────────────────┤
│ id (PK)         │◀──┐   │ id (PK)         │       │ id (PK)         │
│ organization_id │   │   │ organization_id │       │ organization_id │
│ external_id     │   │   │ account_id (FK) │───────│ account_id (FK) │
│ source          │   │   │ email           │       │ amount          │
│ name            │   │   │ name            │       │ stage           │
│ health_score    │   └───│                 │       │                 │
│ mrr             │       └─────────────────┘       └─────────────────┘
└─────────────────┘

                     ┌─────────────────┐       ┌─────────────────┐
                     │  health_scores  │       │   audit_logs    │
                     ├─────────────────┤       ├─────────────────┤
                     │ id (PK)         │       │ id (PK)         │
                     │ account_id (FK) │       │ organization_id │
                     │ score           │       │ user_id         │
                     │ components      │       │ action          │
                     │ trend           │       │ resource_type   │
                     └─────────────────┘       │ resource_id     │
                                               │ timestamp       │
                                               └─────────────────┘

4.4 Row-Level Security (Multi-Tenancy)

-- Every table has organization_id column
-- RLS policy ensures tenant isolation

ALTER TABLE accounts ENABLE ROW LEVEL SECURITY;

CREATE POLICY accounts_isolation ON accounts
  USING (organization_id = current_setting('app.organization_id')::UUID);

-- Set organization context on each request
SET app.organization_id = 'org_abc123';

-- All queries automatically filtered by organization
SELECT * FROM accounts;  -- Only returns org_abc123's accounts

5. Cloud vs User Systems

5.1 What Runs Where

┌─────────────────────────────────────────────────────────────────────────────┐
│                    INTEGRATEWISE CLOUD                                       │
│                    (Managed by IntegrateWise)                                │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ✓ Web Application (React frontend)                                         │
│  ✓ API Layer (Cloudflare Workers)                                           │
│  ✓ Database (Supabase PostgreSQL)                                           │
│  ✓ File Storage (Cloudflare R2)                                             │
│  ✓ Automation Engine (n8n Cloud)                                            │
│  ✓ Document Generation                                                      │
│  ✓ AI Processing (via OpenAI/Anthropic APIs)                                │
│                                                                              │
│  Data Location: Cloudflare Global + AWS us-east-1 (Supabase)                │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────────┐
│                    CUSTOMER SYSTEMS                                          │
│                    (Customer's Environment)                                  │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ✓ Existing SaaS tools (HubSpot, Slack, etc.)                               │
│  ✓ Browser (for web access)                                                 │
│  ✓ Mobile device (for mobile app)                                           │
│  ✓ Browser extension (optional, for AI memory capture)                      │
│                                                                              │
│  Nothing installed on customer servers                                      │
│  No agents or daemons required                                              │
│  No VPN or network changes required                                         │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────────┐
│                    THIRD-PARTY SERVICES                                      │
│                    (External Dependencies)                                   │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ✓ Cloudflare (CDN, Workers, KV, R2, Queues)                                │
│  ✓ Supabase (PostgreSQL, Auth, Realtime)                                    │
│  ✓ OpenAI (GPT-4 for AI features)                                           │
│  ✓ Anthropic (Claude for AI features)                                       │
│  ✓ n8n Cloud (Workflow automation)                                          │
│                                                                              │
│  All vendors are SOC 2 Type II certified                                    │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

5.2 Data Never Leaves Cloud Boundary

Data TypeWhere ProcessedWhere StoredCustomer Access
Business dataIntegrateWise APISupabase DBVia app/API
Generated docsIntegrateWise WorkersR2 (temp)Download link
AI conversationsOpenAI/AnthropicSupabase DBVia Brain search
Audit logsIntegrateWise APISupabase DBVia app/API
Files/attachmentsIntegrateWise APIR2Download link

5.3 No On-Premise Deployment (Currently)

IntegrateWise is cloud-only. We do not currently offer:

  • On-premise installation
  • Private cloud deployment
  • Air-gapped deployments
  • Self-hosted options

Roadmap: Enterprise self-hosted option planned for 2027.


6. Integration Architecture

6.1 How Integrations Connect

┌─────────────────────────────────────────────────────────────────────────────┐
│                      INTEGRATION CONNECTION FLOW                             │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────┐                    ┌─────────────┐                    ┌─────────┐
│  User   │                    │IntegrateWise│                    │ HubSpot │
│         │                    │             │                    │  (etc)  │
└────┬────┘                    └──────┬──────┘                    └────┬────┘
     │                                │                                │
     │  1. Click "Connect HubSpot"    │                                │
     │───────────────────────────────▶│                                │
     │                                │                                │
     │  2. Redirect to HubSpot OAuth  │                                │
     │◀───────────────────────────────│                                │
     │                                │                                │
     │  3. User authorizes            │                                │
     │────────────────────────────────┼───────────────────────────────▶│
     │                                │                                │
     │                                │  4. Redirect with auth code    │
     │                                │◀───────────────────────────────│
     │                                │                                │
     │                                │  5. Exchange code for tokens   │
     │                                │───────────────────────────────▶│
     │                                │                                │
     │                                │  6. Access + Refresh tokens    │
     │                                │◀───────────────────────────────│
     │                                │                                │
     │                                │  7. Store encrypted tokens     │
     │                                │  (in Supabase)                 │
     │                                │                                │
     │  8. Connection successful      │                                │
     │◀───────────────────────────────│                                │
     │                                │                                │

6.2 Sync Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                         SYNC ARCHITECTURE                                    │
└─────────────────────────────────────────────────────────────────────────────┘

                              SCHEDULED SYNC
                              ─────────────

     ┌─────────────┐
     │   Cron      │  Every 15 min (configurable)
     │  Scheduler  │
     └──────┬──────┘
            │
            ▼
     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
     │  Get Active │     │  Check Last │     │  Calculate  │
     │ Connections │────▶│  Sync Time  │────▶│    Delta    │
     └─────────────┘     └─────────────┘     └──────┬──────┘
                                                    │
                                                    ▼
     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
     │   Fetch     │     │   Handle    │     │   Call      │
     │  All Pages  │◀────│  Pagination │◀────│  External   │
     └─────────────┘     └─────────────┘     │    API      │
                                             └─────────────┘


                              REAL-TIME SYNC (Slack)
                              ─────────────────────

     ┌─────────────┐
     │   Slack     │  Webhook POST
     │   Event     │
     └──────┬──────┘
            │
            ▼
     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
     │  Webhook    │     │   Verify    │     │   Process   │
     │  Endpoint   │────▶│  Signature  │────▶│   Event     │
     │  (Worker)   │     │             │     │             │
     └─────────────┘     └─────────────┘     └──────┬──────┘
                                                    │
                                                    ▼
                                             ┌─────────────┐
                                             │   Update    │
                                             │   Database  │
                                             └─────────────┘

6.3 Integration Permissions Matrix

IntegrationReadWriteDeleteWebhookOAuth Scopes
Slack✅✅❌✅channels:read, users:read, chat:write
HubSpot✅✅❌❌crm.objects.contacts.read, crm.objects.companies.read
Gmail✅❌❌❌gmail.readonly
Notion✅✅❌❌read_content, update_content
Sheets✅✅❌❌spreadsheets

Note: Write and delete permissions are optional. Users can connect in read-only mode.


7. Failure & Retry Behavior

7.1 Retry Strategy Overview

┌─────────────────────────────────────────────────────────────────────────────┐
│                         RETRY STRATEGY                                       │
└─────────────────────────────────────────────────────────────────────────────┘

                    EXPONENTIAL BACKOFF WITH JITTER
                    ──────────────────────────────

     Attempt 1          Attempt 2          Attempt 3          Attempt 4
         │                  │                  │                  │
         ▼                  ▼                  ▼                  ▼
     ┌───────┐          ┌───────┐          ┌───────┐          ┌───────┐
     │ Try   │          │ Wait  │          │ Wait  │          │ Wait  │
     │       │──FAIL───▶│ 1-2s  │──FAIL───▶│ 4-8s  │──FAIL───▶│16-32s │
     └───────┘          └───────┘          └───────┘          └───────┘
                                                                   │
                                                              FAIL │
                                                                   ▼
                                                          ┌───────────────┐
                                                          │ Dead Letter   │
                                                          │ Queue         │
                                                          │ (Alert Admin) │
                                                          └───────────────┘

7.2 Retry Configuration by Operation

OperationMax RetriesInitial DelayMax DelayTimeout
API Sync51s32s30s
Webhook Delivery101s5 min10s
Document Generation35s30s60s
AI Completion32s10s30s
Email Send55s5 min15s
Database Write3100ms2s5s

7.3 Error Handling by Type

Error TypeHTTP CodeRetry?Action
Rate Limited429YesWait for Retry-After header
Server Error500-599YesExponential backoff
Bad Request400NoLog error, alert user
Unauthorized401OnceRefresh token, retry
Forbidden403NoAlert user, check permissions
Not Found404NoLog, continue sync
Timeout-YesExponential backoff
Connection-YesExponential backoff

7.4 Circuit Breaker Pattern

┌─────────────────────────────────────────────────────────────────────────────┐
│                       CIRCUIT BREAKER STATES                                 │
└─────────────────────────────────────────────────────────────────────────────┘

     ┌───────────┐                    ┌───────────┐                    ┌───────────┐
     │  CLOSED   │                    │   OPEN    │                    │HALF-OPEN  │
     │           │                    │           │                    │           │
     │  Normal   │   5 failures in    │ All calls │   After 60s       │ Test call │
     │ operation │──  60 seconds  ───▶│  blocked  │── cooldown ──────▶│  allowed  │
     │           │                    │           │                    │           │
     └───────────┘                    └─────┬─────┘                    └─────┬─────┘
          ▲                                 │                               │
          │                                 │                               │
          │                                 │ Still failing                 │ Success
          │                                 └───────────────────────────────┤
          │                                                                 │
          └─────────────────────────────────────────────────────────────────┘
StateBehavior
CLOSEDNormal operation, all requests pass through
OPENAll requests fail immediately (no external calls)
HALF-OPENLimited requests allowed to test recovery

7.5 Failure Notification

Failure TypeAlert ChannelRecipient
Sync failure (3x)Email + AppConnection owner
Webhook delivery failed (10x)EmailAdmin
Circuit breaker openSlack + EmailEngineering
Database connection lostPagerDutyOn-call

8. Latency Expectations

8.1 Response Time Targets (P95)

OperationTargetLocationNotes
API Request (simple)< 100msEdgeCached or simple query
API Request (complex)< 500msEdge → DBMulti-table joins
Dashboard Load< 2sEdge → DBWith prefetch
Search (text)< 200msDBPostgreSQL FTS
Search (vector)< 300msDBpgvector cosine
Document Generation< 5sWorkerDepends on size
Initial Sync1-10 minBackgroundDepends on data volume
Incremental Sync< 1 minBackgroundDelta only

8.2 Latency by Region

┌─────────────────────────────────────────────────────────────────────────────┐
│                    LATENCY BY USER REGION                                    │
└─────────────────────────────────────────────────────────────────────────────┘

     User Location        Edge Response        DB Response        Total
     ─────────────        ─────────────        ───────────        ─────

     US East              < 20ms               < 30ms             < 100ms
     US West              < 20ms               < 50ms             < 120ms
     Europe (West)        < 20ms               < 80ms             < 150ms
     Europe (East)        < 30ms               < 100ms            < 180ms
     Asia Pacific         < 30ms               < 150ms            < 230ms
     India                < 30ms               < 180ms            < 260ms
     South America        < 40ms               < 120ms            < 210ms

     Note: Database is in AWS us-east-1 (Supabase)
     Edge caching reduces DB latency impact for read-heavy operations

8.3 Performance Optimization

OptimizationImplementationImpact
Edge CachingCloudflare KV80% of reads served from edge
Connection PoolingSupabase built-inReduced connection overhead
Query OptimizationIndexed columns< 50ms for common queries
Lazy LoadingFrontend chunkingFaster initial render
PrefetchingPredictive loadsPerceived instant navigation
CompressionBrotli/gzip70% smaller payloads

9. Scalability Model

9.1 Current Capacity

ResourceCurrent LimitScaling Path
Concurrent Users10,000Horizontal (Workers auto-scale)
Requests/Second100,000Horizontal (Cloudflare)
Database Storage8 GBVertical (Supabase Pro: 8GB)
Database Connections60Connection pooling
File StorageUnlimitedPay-as-you-go (R2)
Records per Org1,000,000Partitioning at scale

9.2 Scaling Strategy

┌─────────────────────────────────────────────────────────────────────────────┐
│                       SCALING STRATEGY                                       │
└─────────────────────────────────────────────────────────────────────────────┘

     CURRENT (0-1000 orgs)              GROWTH (1000-10000 orgs)
     ────────────────────               ─────────────────────────

     ┌─────────────────┐                ┌─────────────────┐
     │  Single DB      │       →        │  Read Replicas  │
     │  (Supabase Pro) │                │  + Connection   │
     │                 │                │    Pooling      │
     └─────────────────┘                └─────────────────┘

     ┌─────────────────┐                ┌─────────────────┐
     │  Workers        │       →        │  Workers        │
     │  (Auto-scale)   │                │  (Auto-scale)   │
     │                 │                │  + More regions │
     └─────────────────┘                └─────────────────┘

     ┌─────────────────┐                ┌─────────────────┐
     │  n8n Cloud      │       →        │  Dedicated n8n  │
     │  (Shared)       │                │  Instance       │
     └─────────────────┘                └─────────────────┘


     ENTERPRISE (10000+ orgs)
     ─────────────────────────

     ┌─────────────────┐
     │  Sharded DB     │
     │  (By org_id)    │
     │                 │
     └─────────────────┘

     ┌─────────────────┐
     │  Dedicated      │
     │  Compute per    │
     │  Large Customer │
     └─────────────────┘

10. Network Architecture

10.1 Network Flow

┌─────────────────────────────────────────────────────────────────────────────┐
│                         NETWORK ARCHITECTURE                                 │
└─────────────────────────────────────────────────────────────────────────────┘

                              INTERNET
                                 │
                                 │ HTTPS (TLS 1.3)
                                 ▼
     ┌───────────────────────────────────────────────────────────────────────┐
     │                    CLOUDFLARE WAF                                      │
     │  • DDoS protection                                                     │
     │  • Rate limiting                                                       │
     │  • Bot detection                                                       │
     │  • IP reputation                                                       │
     └────────────────────────────┬──────────────────────────────────────────┘
                                  │
                                  │ Internal
                                  ▼
     ┌───────────────────────────────────────────────────────────────────────┐
     │                    CLOUDFLARE WORKERS                                  │
     │  • Request validation                                                  │
     │  • Authentication                                                      │
     │  • Business logic                                                      │
     └────────────────────────────┬──────────────────────────────────────────┘
                                  │
                                  │ Private (Mutual TLS)
                                  ▼
     ┌───────────────────────────────────────────────────────────────────────┐
     │                    SUPABASE                                            │
     │  • PostgreSQL                                                          │
     │  • Connection pooling (PgBouncer)                                      │
     │  • Row-level security                                                  │
     └───────────────────────────────────────────────────────────────────────┘

10.2 Required Firewall Rules

For customers with egress filtering:

DirectionSourceDestinationPortProtocolPurpose
OutboundUser*.integratewise.com443HTTPSApplication
OutboundUser*.cloudflare.com443HTTPSCDN
OutboundUser*.supabase.co443HTTPSAuth/Realtime

No inbound rules required - IntegrateWise does not need to connect to customer networks.

10.3 IP Addresses

IntegrateWise uses Cloudflare's IP ranges. For allowlisting:

# Cloudflare IPv4 ranges
https://www.cloudflare.com/ips-v4

# Cloudflare IPv6 ranges
https://www.cloudflare.com/ips-v6

Note: We recommend allowlisting by domain (*.integratewise.com) rather than IP, as Cloudflare IPs may change.


Appendix A: Technology Decision Log

DecisionChoiceAlternatives ConsideredRationale
FrontendReactVue, SvelteEcosystem, hiring pool
APICloudflare WorkersAWS Lambda, VercelEdge performance, cost
DatabaseSupabase PostgreSQLPlanetScale, NeonAuth integration, realtime
QueueCloudflare QueuesSQS, RabbitMQSame vendor, simplicity
StorageCloudflare R2S3, GCSNo egress fees
Automationn8nTemporal, Step FunctionsVisual builder, self-hostable
AIOpenAI + AnthropicSingle vendorBest models, redundancy

Appendix B: Glossary

TermDefinition
EdgeCloudflare's global network (300+ data centers)
WorkerServerless function running on Cloudflare's edge
RLSRow-Level Security - PostgreSQL feature for multi-tenancy
pgvectorPostgreSQL extension for vector similarity search
KVKey-Value store for edge caching
R2S3-compatible object storage by Cloudflare
SpineIntegrateWise's core data layer
HubTeam/function-based routing layer
BrainAI memory and vector search system

Document Version: 1.0
Last Updated: January 2026
Owner: Engineering Team
Review Cycle: Quarterly

For questions: architecture@integratewise.com