Unclassified

IntegrateWise Complete Deployment Architecture

High-Level Overview

┌─────────────────────────────────────────────────────────────────┐
│                    INTEGRATEWISE PLATFORM                       │
│                   3 Deployment Profiles                          │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────┬─────────────────────────┬──────────────────────┐
│   DEV PROFILE   │ CUSTOMER ZERO PROFILE   │ EXTERNAL USERS       │
│                 │                         │ PROFILE              │
├─────────────────┼─────────────────────────┼──────────────────────┤
│ Environment     │ Environment             │ Environment          │
│ development     │ production              │ production           │
│                 │                         │ (multi-tenant)       │
└─────────────────┴─────────────────────────┴──────────────────────┘

Dev Profile Architecture

┌─────────────────────────────────────────────────────────────────┐
│                         DEV PROFILE                              │
│                   dev.integratewise.internal                    │
└─────────────────────────────────────────────────────────────────┘

        DEVELOPERS
            │
            ▼
    ┌──────────────────┐
    │   Platform UI    │
    │ (Next.js App)    │
    │ Vercel (dev tier)│
    └────────┬─────────┘
             │
             ▼
    ┌──────────────────┐
    │  Gateway Worker  │ ◄─── Rate Limit: 1000 req/min
    │ (Cloudflare)     │      TLS 1.2 + JWT
    │ dev account      │
    └────────┬─────────┘
             │
             ▼ (31 service workers)
    ┌──────────────────┐
    │  Service Workers │ ◄─── Tenants, Admin, Connectors, MCP, etc.
    │ (Cloudflare)     │      KV (dev namespace)
    │ dev account      │      D1 (dev binding)
    └────────┬─────────┘
             │ (Neon Tunnel - TLS 1.2 + JWT)
             ▼
    ┌──────────────────────────┐
    │  Neon PostgreSQL (dev)   │ ◄─── Connection pool: 10-100
    │ neon.dev.integratewise   │      Statement cache disabled
    │ .internal:5432           │      Idle timeout: 60s
    └──────────────────────────┘
             │
             ▼
    ┌──────────────────┐
    │  D1 Database     │ ◄─── Runtime state
    │  (Cloudflare)    │      Tenant data
    │  dev binding     │      Query results
    └──────────────────┘

    MCP Pool (Shared - Dev)
    ├── 2 replicas
    ├── 100 concurrent connections
    └── Auto-scaling: 1-5 pods


KEY METRICS:
─────────────
Uptime SLA: 95% (dev only)
Latency p95: 500ms
Error Rate: 5% tolerance
Cost: ~$105/month

Customer Zero Profile Architecture

┌─────────────────────────────────────────────────────────────────┐
│                  CUSTOMER ZERO PROFILE                           │
│              app.customer-zero.integratewise.com                 │
└─────────────────────────────────────────────────────────────────┘

    CUSTOMER ZERO
    OPERATIONS
         │
         ▼
    ┌──────────────────┐
    │   Platform UI    │
    │ (Next.js App)    │
    │ Vercel (prod)    │
    │ 3-region         │
    └────────┬─────────┘
             │
             ▼
    ┌──────────────────┐
    │  Gateway Worker  │ ◄─── Rate Limit: 100 req/sec
    │ (Cloudflare)     │      TLS 1.3 + mTLS
    │ customer-zero    │      Let's Encrypt cert
    │ account          │      60-day rotation
    └────────┬─────────┘
             │
             ▼ (31 service workers)
    ┌──────────────────┐
    │  Service Workers │ ◄─── Tenants, Admin, Connectors, MCP, etc.
    │ (Cloudflare)     │      KV (customer-zero ns)
    │ customer-zero    │      D1 (customer-zero binding)
    │ account          │
    └────────┬─────────┘
             │
    ┌────────┴─────────┐
    │                  │
    │ MCP Pool         │
    │ (Dedicated)      │ ◄─── 4 replicas
    │ 500 conns        │      Auto-scale: 5-20
    │                  │      $500/month
    │                  │
    └────────┬─────────┘
             │
             │ (Neon Tunnel - TLS 1.3 + mTLS)
             │ Pinned cert + 2 backups
             │
             ▼
    ┌──────────────────────────┐
    │  Neon PostgreSQL         │ ◄─── Dedicated instance
    │ neon.customer-zero       │      Connection pool: 10-100
    │ .integratewise.internal  │      Statement cache: 50
    │ :5432                    │      Idle timeout: 60s
    │ (CUSTOMER ZERO)          │      Continuous backup
    └──────────────────────────┘
             │
             ▼
    ┌──────────────────┐
    │  D1 Database     │ ◄─── Dedicated dataset
    │ customer-zero    │      Tenant isolation
    │ binding          │      Row-Level Security: N/A
    └──────────────────┘
             │
             ▼
    ┌──────────────────┐
    │  R2 Artifacts    │ ◄─── Documents, backups
    │  customer-zero   │      Private access
    │  bucket          │
    └──────────────────┘


HEALTH CHECKS (Automated):
──────────────────────────
  Every 6 hours: Full health check
  Every 12 hours: Certificate rotation check
  Every hour: Database backup verification

KEY METRICS:
─────────────
Uptime SLA: 99.5%
Latency p95: 100ms
Error Rate: 1% tolerance
Cost: ~$850/month
Security: SOC 2 ready, mTLS, backup certs

External Users Profile Architecture (Multi-region)

┌─────────────────────────────────────────────────────────────────┐
│               EXTERNAL USERS PROFILE (PRODUCTION)                │
│                    app.integratewise.com                         │
│                  5-Region Global Deployment                      │
└─────────────────────────────────────────────────────────────────┘

    END USERS
    ├── US
    ├── EU
    ├── AP
    └── Other
         │
         ▼
    ┌─────────────────────────────────┐
    │   CDN Cache (Cloudflare Edge)   │ ◄─── 200+ PoPs
    │   DDoS Protection               │      WAF Rules
    │   Rate Limiting                 │      Geo-blocking
    └──────────────┬──────────────────┘
                   │
      ┌────────────┼────────────┐
      │            │            │
      ▼            ▼            ▼
    ┌──────────────────────────────────┐
    │     Region-Specific Routing      │
    │ (Cloudflare Geo-routing)         │
    │                                  │
    │  US-EAST  EU-WEST  AP-SOUTH     │
    └────┬─────────┬─────────┬────────┘
         │         │         │
         ▼         ▼         ▼
    ┌──────────────┐  ┌──────────────┐  ┌──────────────┐
    │US-EAST       │  │EU-WEST       │  │AP-SOUTH      │
    │Workers       │  │Workers       │  │Workers       │
    │              │  │              │  │              │
    │Gateway       │  │Gateway       │  │Gateway       │
    │(50 conns)    │  │(50 conns)    │  │(50 conns)    │
    └────┬─────────┘  └────┬─────────┘  └────┬─────────┘
         │                 │                 │
         │ (Rate Limited)  │ (Rate Limited)  │ (Rate Limited)
         │ 50 req/sec      │ 50 req/sec      │ 50 req/sec
         │                 │                 │
         └─────────────────┼─────────────────┘
                           │
                    (Load Balancer)
                           │
                    ┌──────┴──────┐
                    │             │
                    ▼             ▼
            ┌──────────────────────────────┐
            │   Service Workers Pool       │
            │  (31 services, distributed)  │
            │                              │
            │  Tenants, Admin, Connectors, │
            │  MCP, Agents, Knowledge, etc.│
            │                              │
            │  KV (multi-tenant ns)        │
            │  D1 (multi-tenant binding)   │
            │  Queues (event processing)   │
            └──────────────┬───────────────┘
                           │
                    MCP Pool (Load-balanced)
                    ├── 10-50 auto-scaling replicas
                    ├── Per-tenant rate limiting
                    └── Shared resource pool
                           │
                    ┌──────┴──────────────────┐
                    │                         │
    Neon Tunnel (TLS 1.3 + mTLS + Pinning) ◄──┘
    Certificate rotation: every 330 days
    Backups: 3 (auto-shifted every rotation)
    Circuit Breaker: enabled (50% threshold)
                    │
        ┌───────────┼───────────┐
        │           │           │
        ▼           ▼           ▼
    ┌─────────────────────────────────────┐
    │    Neon Multi-Tenant PostgreSQL     │
    │  neon.integratewise.io (3 regions)  │
    │                                     │
    │  Primary + Read Replicas (per region)│
    │  Connection pool: 50-500            │
    │  Statement cache: 50                │
    │  Idle timeout: 30s                  │
    │  RLS Enforced (per tenant)          │
    │  Continuous backup                  │
    │  Failover: automatic                │
    └─────────────────────────────────────┘
         │
         ├─ US-EAST replica
         ├─ EU-WEST replica
         └─ AP-SOUTH replica

         Primary (any region, auto-elected)
             │
             ▼
         ┌──────────────────┐
         │  D1 Multi-tenant │ ◄─── Query-time filtering
         │  Database        │      Tenant ID + org_id
         │                  │      View-based isolation
         └──────────────────┘
             │
             ▼
         ┌──────────────────┐
         │  R2 Artifacts    │ ◄─── Tenant-prefixed buckets
         │  (multi-tenant)  │      Private access
         │  Cache: 24h      │
         └──────────────────┘


HEALTH CHECKS (Automated):
──────────────────────────
  Every 5 minutes: Platform/Gateway health
  Every hour: Database backup verification
  Every hour: Metrics aggregation
  Every month: Report generation

SECURITY FEATURES:
──────────────────
  DDoS Protection: Cloudflare Pro+
  WAF Rules: Full ruleset
  Rate Limiting: Per-tenant (50 req/sec)
  mTLS: Certificate pinning + 3 backups
  RLS: Row-Level Security enforced
  Encryption: TLS 1.3 (TLS 1.2 fallback)

KEY METRICS:
─────────────
Uptime SLA: 99.9%
Latency p95: 50ms (target)
Error Rate: 0.1% tolerance
Cost: ~$2,200/month
Security: SOC 2 + GDPR compliant
Redundancy: 5 regions, auto-failover

Data Flow: The Golden Loop

USER ACTION (any profile)
    │
    ▼
┌─────────────────────────────┐
│  Platform UI (React)        │
│  - Form submit              │
│  - Button click             │
│  - State update             │
└──────────┬──────────────────┘
           │
           ▼
┌─────────────────────────────┐
│  Service Client Hook        │
│  (lib/services/*)           │
│  - Build request            │
│  - Add auth headers         │
│  - Serialize data           │
└──────────┬──────────────────┘
           │
           ▼
┌─────────────────────────────┐
│  Gateway Worker             │
│  - Auth validation          │
│  - Tenant binding           │
│  - Rate limit check         │
│  - Route to service         │
└──────────┬──────────────────┘
           │
           ▼
┌─────────────────────────────┐
│  Service Worker             │
│  (32 backend services)      │
│  - Business logic           │
│  - Validation               │
│  - Generate events          │
└──────────┬──────────────────┘
           │
           ▼
┌─────────────────────────────┐
│  Neon Tunnel                │
│  - TLS handshake            │
│  - mTLS verification        │
│  - Connection pooling       │
└──────────┬──────────────────┘
           │
           ▼
┌─────────────────────────────┐
│  PostgreSQL Query Execution │
│  - RLS policies applied     │
│  - Data modification        │
│  - Trigger execution        │
│  - Event generation         │
└──────────┬──────────────────┘
           │
           ▼
┌─────────────────────────────┐
│  Event Publishing           │
│  - Write event to queue     │
│  - Update cache (KV)        │
│  - Publish webhook          │
└──────────┬──────────────────┘
           │
           ├─────────────────────────┐
           │                         │
           ▼                         ▼
    ┌────────────────┐      ┌──────────────────┐
    │  Cache Refresh │      │  Event Consumers │
    │  (D1, KV)      │      │  (Services)      │
    │  - Invalidate  │      │  - Process event │
    │  - Rebuild     │      │  - Side effects  │
    └────────┬───────┘      └──────────┬───────┘
             │                         │
             └──────────────┬──────────┘
                           │
                           ▼
                ┌─────────────────────────────┐
                │  UI Update (SWR/React)      │
                │  - Refetch data             │
                │  - Re-render component      │
                │  - Show confirmation        │
                └─────────────────────────────┘
                           │
                           ▼
                    USER SEES RESULT

Deployment Pipeline

Dev Profile

Developer Push
    ↓
  Tests
    ↓
  Build (Platform UI)
    ↓
  Deploy to Vercel (dev)
    ↓
  Deploy Workers (Cloudflare dev)
    ↓
  Update Neon tunnel (dev)
    ↓
  Smoke tests
    ↓
  Notify dev team

Customer Zero Profile

Tag: customer-zero-v*
    ↓
  Full test suite
    ↓
  Build (Platform UI, optimized)
    ↓
  Deploy to Vercel (customer-zero)
    ↓
  Deploy Workers (Cloudflare customer-zero)
    ↓
  Update Neon tunnel (cert rotation check)
    ↓
  Integration tests
    ↓
  Health check all endpoints
    ↓
  Notify ops team

External Users Profile

Tag: release-v*
    ↓
  Full test suite + performance tests
    ↓
  Build (Platform UI, production-optimized)
    ↓
  Deploy to Vercel (production)
    ↓
  Deploy Workers (Cloudflare production, multi-region)
    ↓
  Update Neon tunnel (multi-region, RLS check)
    ↓
  Canary deployment (10% traffic, 1 hour)
    ↓
  Load tests
    ↓
  Full rollout (100% traffic)
    ↓
  Notify customers via status page

Infrastructure Costs by Profile

ComponentDevCustomer ZeroExternal Users
Vercel$50$300$500
Cloudflare Workers$5$50$200
Neon Database$50$500$1,500
Total/Month$105$850$2,200

Security by Profile

AspectDevCustomer ZeroExternal Users
Tunnel EncryptionTLS 1.2TLS 1.3TLS 1.3 + 1.2 fallback
AuthenticationJWTmTLSmTLS + pinning
CertificateSelf-signedLet's Encrypt (90d)DigiCert EV (1yr)
Backup CertsNone23
RLSDisabledN/A (single org)Enforced (multi-tenant)
WAFNoneNoneFull ruleset
DDoS ProtectionNoneNoneCloudflare Pro+
SLA95%99.5%99.9%
ComplianceNoneSOC 2 readySOC 2 + GDPR