{"slug":"operations/DEPLOYMENT_ARCHITECTURE_VISUAL","title":"IntegrateWise Complete Deployment Architecture","section":"operations","sectionLabel":"Operations","status":"unclassified","type":"document","path":"operations/DEPLOYMENT_ARCHITECTURE_VISUAL.mdx","bytes":21532,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n## High-Level Overview\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                    INTEGRATEWISE PLATFORM                       │\n│                   3 Deployment Profiles                          │\n└─────────────────────────────────────────────────────────────────┘\n\n┌─────────────────┬─────────────────────────┬──────────────────────┐\n│   DEV PROFILE   │ CUSTOMER ZERO PROFILE   │ EXTERNAL USERS       │\n│                 │                         │ PROFILE              │\n├─────────────────┼─────────────────────────┼──────────────────────┤\n│ Environment     │ Environment             │ Environment          │\n│ development     │ production              │ production           │\n│                 │                         │ (multi-tenant)       │\n└─────────────────┴─────────────────────────┴──────────────────────┘\n```\n\n---\n\n## Dev Profile Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                         DEV PROFILE                              │\n│                   dev.integratewise.internal                    │\n└─────────────────────────────────────────────────────────────────┘\n\n        DEVELOPERS\n            │\n            ▼\n    ┌──────────────────┐\n    │   Platform UI    │\n    │ (Next.js App)    │\n    │ Vercel (dev tier)│\n    └────────┬─────────┘\n             │\n             ▼\n    ┌──────────────────┐\n    │  Gateway Worker  │ ◄─── Rate Limit: 1000 req/min\n    │ (Cloudflare)     │      TLS 1.2 + JWT\n    │ dev account      │\n    └────────┬─────────┘\n             │\n             ▼ (31 service workers)\n    ┌──────────────────┐\n    │  Service Workers │ ◄─── Tenants, Admin, Connectors, MCP, etc.\n    │ (Cloudflare)     │      KV (dev namespace)\n    │ dev account      │      D1 (dev binding)\n    └────────┬─────────┘\n             │ (Neon Tunnel - TLS 1.2 + JWT)\n             ▼\n    ┌──────────────────────────┐\n    │  Neon PostgreSQL (dev)   │ ◄─── Connection pool: 10-100\n    │ neon.dev.integratewise   │      Statement cache disabled\n    │ .internal:5432           │      Idle timeout: 60s\n    └──────────────────────────┘\n             │\n             ▼\n    ┌──────────────────┐\n    │  D1 Database     │ ◄─── Runtime state\n    │  (Cloudflare)    │      Tenant data\n    │  dev binding     │      Query results\n    └──────────────────┘\n\n    MCP Pool (Shared - Dev)\n    ├── 2 replicas\n    ├── 100 concurrent connections\n    └── Auto-scaling: 1-5 pods\n\n\nKEY METRICS:\n─────────────\nUptime SLA: 95% (dev only)\nLatency p95: 500ms\nError Rate: 5% tolerance\nCost: ~$105/month\n```\n\n---\n\n## Customer Zero Profile Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                  CUSTOMER ZERO PROFILE                           │\n│              app.customer-zero.integratewise.com                 │\n└─────────────────────────────────────────────────────────────────┘\n\n    CUSTOMER ZERO\n    OPERATIONS\n         │\n         ▼\n    ┌──────────────────┐\n    │   Platform UI    │\n    │ (Next.js App)    │\n    │ Vercel (prod)    │\n    │ 3-region         │\n    └────────┬─────────┘\n             │\n             ▼\n    ┌──────────────────┐\n    │  Gateway Worker  │ ◄─── Rate Limit: 100 req/sec\n    │ (Cloudflare)     │      TLS 1.3 + mTLS\n    │ customer-zero    │      Let's Encrypt cert\n    │ account          │      60-day rotation\n    └────────┬─────────┘\n             │\n             ▼ (31 service workers)\n    ┌──────────────────┐\n    │  Service Workers │ ◄─── Tenants, Admin, Connectors, MCP, etc.\n    │ (Cloudflare)     │      KV (customer-zero ns)\n    │ customer-zero    │      D1 (customer-zero binding)\n    │ account          │\n    └────────┬─────────┘\n             │\n    ┌────────┴─────────┐\n    │                  │\n    │ MCP Pool         │\n    │ (Dedicated)      │ ◄─── 4 replicas\n    │ 500 conns        │      Auto-scale: 5-20\n    │                  │      $500/month\n    │                  │\n    └────────┬─────────┘\n             │\n             │ (Neon Tunnel - TLS 1.3 + mTLS)\n             │ Pinned cert + 2 backups\n             │\n             ▼\n    ┌──────────────────────────┐\n    │  Neon PostgreSQL         │ ◄─── Dedicated instance\n    │ neon.customer-zero       │      Connection pool: 10-100\n    │ .integratewise.internal  │      Statement cache: 50\n    │ :5432                    │      Idle timeout: 60s\n    │ (CUSTOMER ZERO)          │      Continuous backup\n    └──────────────────────────┘\n             │\n             ▼\n    ┌──────────────────┐\n    │  D1 Database     │ ◄─── Dedicated dataset\n    │ customer-zero    │      Tenant isolation\n    │ binding          │      Row-Level Security: N/A\n    └──────────────────┘\n             │\n             ▼\n    ┌──────────────────┐\n    │  R2 Artifacts    │ ◄─── Documents, backups\n    │  customer-zero   │      Private access\n    │  bucket          │\n    └──────────────────┘\n\n\nHEALTH CHECKS (Automated):\n──────────────────────────\n  Every 6 hours: Full health check\n  Every 12 hours: Certificate rotation check\n  Every hour: Database backup verification\n\nKEY METRICS:\n─────────────\nUptime SLA: 99.5%\nLatency p95: 100ms\nError Rate: 1% tolerance\nCost: ~$850/month\nSecurity: SOC 2 ready, mTLS, backup certs\n```\n\n---\n\n## External Users Profile Architecture (Multi-region)\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│               EXTERNAL USERS PROFILE (PRODUCTION)                │\n│                    app.integratewise.com                         │\n│                  5-Region Global Deployment                      │\n└─────────────────────────────────────────────────────────────────┘\n\n    END USERS\n    ├── US\n    ├── EU\n    ├── AP\n    └── Other\n         │\n         ▼\n    ┌─────────────────────────────────┐\n    │   CDN Cache (Cloudflare Edge)   │ ◄─── 200+ PoPs\n    │   DDoS Protection               │      WAF Rules\n    │   Rate Limiting                 │      Geo-blocking\n    └──────────────┬──────────────────┘\n                   │\n      ┌────────────┼────────────┐\n      │            │            │\n      ▼            ▼            ▼\n    ┌──────────────────────────────────┐\n    │     Region-Specific Routing      │\n    │ (Cloudflare Geo-routing)         │\n    │                                  │\n    │  US-EAST  EU-WEST  AP-SOUTH     │\n    └────┬─────────┬─────────┬────────┘\n         │         │         │\n         ▼         ▼         ▼\n    ┌──────────────┐  ┌──────────────┐  ┌──────────────┐\n    │US-EAST       │  │EU-WEST       │  │AP-SOUTH      │\n    │Workers       │  │Workers       │  │Workers       │\n    │              │  │              │  │              │\n    │Gateway       │  │Gateway       │  │Gateway       │\n    │(50 conns)    │  │(50 conns)    │  │(50 conns)    │\n    └────┬─────────┘  └────┬─────────┘  └────┬─────────┘\n         │                 │                 │\n         │ (Rate Limited)  │ (Rate Limited)  │ (Rate Limited)\n         │ 50 req/sec      │ 50 req/sec      │ 50 req/sec\n         │                 │                 │\n         └─────────────────┼─────────────────┘\n                           │\n                    (Load Balancer)\n                           │\n                    ┌──────┴──────┐\n                    │             │\n                    ▼             ▼\n            ┌──────────────────────────────┐\n            │   Service Workers Pool       │\n            │  (31 services, distributed)  │\n            │                              │\n            │  Tenants, Admin, Connectors, │\n            │  MCP, Agents, Knowledge, etc.│\n            │                              │\n            │  KV (multi-tenant ns)        │\n            │  D1 (multi-tenant binding)   │\n            │  Queues (event processing)   │\n            └──────────────┬───────────────┘\n                           │\n                    MCP Pool (Load-balanced)\n                    ├── 10-50 auto-scaling replicas\n                    ├── Per-tenant rate limiting\n                    └── Shared resource pool\n                           │\n                    ┌──────┴──────────────────┐\n                    │                         │\n    Neon Tunnel (TLS 1.3 + mTLS + Pinning) ◄──┘\n    Certificate rotation: every 330 days\n    Backups: 3 (auto-shifted every rotation)\n    Circuit Breaker: enabled (50% threshold)\n                    │\n        ┌───────────┼───────────┐\n        │           │           │\n        ▼           ▼           ▼\n    ┌─────────────────────────────────────┐\n    │    Neon Multi-Tenant PostgreSQL     │\n    │  neon.integratewise.io (3 regions)  │\n    │                                     │\n    │  Primary + Read Replicas (per region)│\n    │  Connection pool: 50-500            │\n    │  Statement cache: 50                │\n    │  Idle timeout: 30s                  │\n    │  RLS Enforced (per tenant)          │\n    │  Continuous backup                  │\n    │  Failover: automatic                │\n    └─────────────────────────────────────┘\n         │\n         ├─ US-EAST replica\n         ├─ EU-WEST replica\n         └─ AP-SOUTH replica\n\n         Primary (any region, auto-elected)\n             │\n             ▼\n         ┌──────────────────┐\n         │  D1 Multi-tenant │ ◄─── Query-time filtering\n         │  Database        │      Tenant ID + org_id\n         │                  │      View-based isolation\n         └──────────────────┘\n             │\n             ▼\n         ┌──────────────────┐\n         │  R2 Artifacts    │ ◄─── Tenant-prefixed buckets\n         │  (multi-tenant)  │      Private access\n         │  Cache: 24h      │\n         └──────────────────┘\n\n\nHEALTH CHECKS (Automated):\n──────────────────────────\n  Every 5 minutes: Platform/Gateway health\n  Every hour: Database backup verification\n  Every hour: Metrics aggregation\n  Every month: Report generation\n\nSECURITY FEATURES:\n──────────────────\n  DDoS Protection: Cloudflare Pro+\n  WAF Rules: Full ruleset\n  Rate Limiting: Per-tenant (50 req/sec)\n  mTLS: Certificate pinning + 3 backups\n  RLS: Row-Level Security enforced\n  Encryption: TLS 1.3 (TLS 1.2 fallback)\n\nKEY METRICS:\n─────────────\nUptime SLA: 99.9%\nLatency p95: 50ms (target)\nError Rate: 0.1% tolerance\nCost: ~$2,200/month\nSecurity: SOC 2 + GDPR compliant\nRedundancy: 5 regions, auto-failover\n```\n\n---\n\n## Data Flow: The Golden Loop\n\n```\nUSER ACTION (any profile)\n    │\n    ▼\n┌─────────────────────────────┐\n│  Platform UI (React)        │\n│  - Form submit              │\n│  - Button click             │\n│  - State update             │\n└──────────┬──────────────────┘\n           │\n           ▼\n┌─────────────────────────────┐\n│  Service Client Hook        │\n│  (lib/services/*)           │\n│  - Build request            │\n│  - Add auth headers         │\n│  - Serialize data           │\n└──────────┬──────────────────┘\n           │\n           ▼\n┌─────────────────────────────┐\n│  Gateway Worker             │\n│  - Auth validation          │\n│  - Tenant binding           │\n│  - Rate limit check         │\n│  - Route to service         │\n└──────────┬──────────────────┘\n           │\n           ▼\n┌─────────────────────────────┐\n│  Service Worker             │\n│  (32 backend services)      │\n│  - Business logic           │\n│  - Validation               │\n│  - Generate events          │\n└──────────┬──────────────────┘\n           │\n           ▼\n┌─────────────────────────────┐\n│  Neon Tunnel                │\n│  - TLS handshake            │\n│  - mTLS verification        │\n│  - Connection pooling       │\n└──────────┬──────────────────┘\n           │\n           ▼\n┌─────────────────────────────┐\n│  PostgreSQL Query Execution │\n│  - RLS policies applied     │\n│  - Data modification        │\n│  - Trigger execution        │\n│  - Event generation         │\n└──────────┬──────────────────┘\n           │\n           ▼\n┌─────────────────────────────┐\n│  Event Publishing           │\n│  - Write event to queue     │\n│  - Update cache (KV)        │\n│  - Publish webhook          │\n└──────────┬──────────────────┘\n           │\n           ├─────────────────────────┐\n           │                         │\n           ▼                         ▼\n    ┌────────────────┐      ┌──────────────────┐\n    │  Cache Refresh │      │  Event Consumers │\n    │  (D1, KV)      │      │  (Services)      │\n    │  - Invalidate  │      │  - Process event │\n    │  - Rebuild     │      │  - Side effects  │\n    └────────┬───────┘      └──────────┬───────┘\n             │                         │\n             └──────────────┬──────────┘\n                           │\n                           ▼\n                ┌─────────────────────────────┐\n                │  UI Update (SWR/React)      │\n                │  - Refetch data             │\n                │  - Re-render component      │\n                │  - Show confirmation        │\n                └─────────────────────────────┘\n                           │\n                           ▼\n                    USER SEES RESULT\n```\n\n---\n\n## Deployment Pipeline\n\n### Dev Profile\n\n```\nDeveloper Push\n    ↓\n  Tests\n    ↓\n  Build (Platform UI)\n    ↓\n  Deploy to Vercel (dev)\n    ↓\n  Deploy Workers (Cloudflare dev)\n    ↓\n  Update Neon tunnel (dev)\n    ↓\n  Smoke tests\n    ↓\n  Notify dev team\n```\n\n### Customer Zero Profile\n\n```\nTag: customer-zero-v*\n    ↓\n  Full test suite\n    ↓\n  Build (Platform UI, optimized)\n    ↓\n  Deploy to Vercel (customer-zero)\n    ↓\n  Deploy Workers (Cloudflare customer-zero)\n    ↓\n  Update Neon tunnel (cert rotation check)\n    ↓\n  Integration tests\n    ↓\n  Health check all endpoints\n    ↓\n  Notify ops team\n```\n\n### External Users Profile\n\n```\nTag: release-v*\n    ↓\n  Full test suite + performance tests\n    ↓\n  Build (Platform UI, production-optimized)\n    ↓\n  Deploy to Vercel (production)\n    ↓\n  Deploy Workers (Cloudflare production, multi-region)\n    ↓\n  Update Neon tunnel (multi-region, RLS check)\n    ↓\n  Canary deployment (10% traffic, 1 hour)\n    ↓\n  Load tests\n    ↓\n  Full rollout (100% traffic)\n    ↓\n  Notify customers via status page\n```\n\n---\n\n## Infrastructure Costs by Profile\n\n| Component          | Dev      | Customer Zero | External Users |\n| ------------------ | -------- | ------------- | -------------- |\n| Vercel             | $50      | $300          | $500           |\n| Cloudflare Workers | $5       | $50           | $200           |\n| Neon Database      | $50      | $500          | $1,500         |\n| **Total/Month**    | **$105** | **$850**      | **$2,200**     |\n\n---\n\n## Security by Profile\n\n| Aspect            | Dev         | Customer Zero       | External Users          |\n| ----------------- | ----------- | ------------------- | ----------------------- |\n| Tunnel Encryption | TLS 1.2     | TLS 1.3             | TLS 1.3 + 1.2 fallback  |\n| Authentication    | JWT         | mTLS                | mTLS + pinning          |\n| Certificate       | Self-signed | Let's Encrypt (90d) | DigiCert EV (1yr)       |\n| Backup Certs      | None        | 2                   | 3                       |\n| RLS               | Disabled    | N/A (single org)    | Enforced (multi-tenant) |\n| WAF               | None        | None                | Full ruleset            |\n| DDoS Protection   | None        | None                | Cloudflare Pro+         |\n| SLA               | 95%         | 99.5%               | 99.9%                   |\n| Compliance        | None        | SOC 2 ready         | SOC 2 + GDPR            |\n"}