{"slug":"operations/ONBOARDING_TO_SYNC_SPECIFICATION","title":"Onboarding to Sync Specification","section":"operations","sectionLabel":"Operations","status":"unclassified","type":"document","path":"operations/ONBOARDING_TO_SYNC_SPECIFICATION.mdx","bytes":2708,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n## Tenant Onboarding Flow\n\n```\nSignup → Supabase Auth → Tenant Created → Domain Selection → Connector OAuth\n    ↓\nSchema Resolution (department × industry) → Tenant Spine Config\n    ↓\nConnector Connected → Flow Classification (A/B/C) → Initial Hydration\n    ↓\nCreamy Load (30 days) → Pipeline → Spine → Entity 360 → Twin Active\n```\n\n## Step 1: Tenant Creation\n\n- Supabase auth creates user\n- `provision_tenant_spine` RPC creates tenant record\n- Tenant bucket computed: B0 (no data)\n\n## Step 2: Domain Selection\n\n- User selects department (CS, Sales, BizOps, etc.)\n- Optional: industry selection (SaaS, Healthcare, etc.)\n- Schema resolved: `getSpineConfig(industry, department)`\n- Entity types and priority fields determined\n\n## Step 3: Connector OAuth\n\n- User selects connector from IntegrationsHub (filtered by domain)\n- OAuth flow: `/api/v1/connectors/:provider/authorize`\n- Callback: tokens encrypted and stored\n- Flow classified: A (structured), B (context), C (AI)\n\n## Step 4: Initial Hydration\n\n### Flow A/B: Creamy Sync\n\n```\ntriggerInitialConnectorHydration(env, tenantId, provider)\n  → Loader extracts 30 days of data\n  → Pipeline queue receives records\n  → 8-stage normalizer processes each\n  → Spine-v2 writes to schema-routed tables\n  → Tenant bucket: B0 → B2 (creamy done)\n```\n\n### Flow C: D1 Buffer\n\n```\ninitializeD1Buffer(tenantId, provider, env)\n  → D1 buffer created for AI source\n  → Triage rules applied\n  → Approved content → Knowledge UI\n  → Tenant bucket stays at current level\n```\n\n## Step 5: Progressive Hydration (B0 → B7)\n\n| Bucket | Trigger          | What Happens                  |\n| ------ | ---------------- | ----------------------------- |\n| B0→B1  | Domain selected  | Schema resolved               |\n| B1→B2  | Creamy sync done | 30 days of data in Spine      |\n| B2→B3  | Full sync done   | Complete historical data      |\n| B3→B4  | Flow B connected | Context (emails, docs) linked |\n| B4→B5  | Signals active   | Twin triggers start firing    |\n| B5→B6  | Flow C active    | AI memory feeding Entity 360  |\n| B6→B7  | All layers       | Full cognitive capability     |\n\n## Sync Entitlements by Plan\n\n| Plan         | Sync Interval | Max Records/Sync | Connectors | Delta Sync |\n| ------------ | ------------- | ---------------- | ---------- | ---------- |\n| Free         | 24h           | 1,000            | 1          | Yes        |\n| Starter      | 4h            | 5,000            | 3          | Yes        |\n| Professional | 1h            | 25,000           | 10         | Yes        |\n| Enterprise   | 15min         | 100,000          | Unlimited  | Yes        |\n"}