{"slug":"business/QUICK_START_SIMPLE","title":"Quick Start: 3-Step Implementation","section":"business","sectionLabel":"Business","status":"unclassified","type":"document","path":"business/QUICK_START_SIMPLE.mdx","bytes":5314,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n\n> **Tier C — Historical.** This document is a point-in-time snapshot preserved for reference. For current architecture, see [CANONICAL_PLATFORM_ARCHITECTURE.md](../architecture/CANONICAL_PLATFORM_ARCHITECTURE.md).\n\n**Goal**: Click marketplace app → OAuth → Features available\n\n**Time**: 2 days (1 day OAuth endpoint, 1 day frontend integration)\n\n---\n\n## Step 1: Deploy OAuth Endpoint (4 hours)\n\n### Files to Create\n\n```\nservices/continuity-bridge/src/\n├── oauth-handler.ts (OAuth endpoint)\n└── jwt-validator.ts (Token validation)\n```\n\n### Code\n\n**OAuth Endpoint**:\n```typescript\n// GET /auth/authorize?app=claude&redirect_uri=...&email=...&org_name=...\n// Returns: Redirect to callback with JWT token\n```\n\n**JWT Validator**:\n```typescript\n// Check Authorization header\n// Validate JWT\n// Extract: user_id, tenant_id, email\n// Continue to next middleware\n```\n\n### Deploy\n\n```bash\ncd services/continuity-bridge\nnpm run build\nnpm run deploy\n```\n\n**Verification**:\n```bash\ncurl https://integratewise.com/auth/authorize \\\n  -G \\\n  --data-urlencode \"app=claude\" \\\n  --data-urlencode \"redirect_uri=claude-extension://callback\" \\\n  --data-urlencode \"email=test@company.com\" \\\n  --data-urlencode \"org_name=Test%20Company\"\n\n# Expected: Redirect with token in query params\n```\n\n---\n\n## Step 2: Add Feature Gate to All Routes (2 hours)\n\n### Update Gateway\n\n**File**: `services/gateway/src/app.ts`\n\n```typescript\n\napp.use(validateJWT);\napp.use(featureGate);\n\n// All routes now require valid JWT\n// All requests have: req.tenant_id, req.user_id\n// All queries automatically scoped by tenant_id\n```\n\n**Verification**:\n```bash\n# Without token:\ncurl https://gateway.integratewise.com/api/v1/spine/accounts\n# Response: 401 Unauthorized\n\n# With token:\ncurl https://gateway.integratewise.com/api/v1/spine/accounts \\\n  -H \"Authorization: Bearer eyJhbGc...\"\n# Response: 200 OK (accounts for this tenant)\n```\n\n---\n\n## Step 3: Update Frontends (4 hours)\n\n### All 5 frontends use same pattern\n\n1. Check token on load\n2. If no token → Show \"Connect\" button\n3. If valid token → Show workbench\n4. Connect button redirects to OAuth\n5. OAuth callback stores token → Refresh → Workbench shows\n\n### Example: Claude Desktop\n\n**Claude**: OAuth handler → JWT issued → Claude extension stores JWT → All MCP calls include JWT\n\n### Example: Replit\n\n**Frontend**: React app → `useAuth()` hook → Check token → Show/hide features\n\n### Example: Customer Portal\n\n**Portal**: Same React pattern → OAuth → Features available\n\n---\n\n## Checklist: Go Live\n\n- [ ] OAuth endpoint deployed\n- [ ] JWT generation verified\n- [ ] JWT validation middleware in Gateway\n- [ ] Feature gate middleware in Gateway\n- [ ] All 5 marketplace apps configured\n- [ ] Frontend: useAuth hook added\n- [ ] Frontend: ConnectButton component added\n- [ ] Frontend: OAuth callback handler added\n- [ ] Manual test: Click connect → OAuth → Token stored → Workbench shows\n- [ ] All 5 platforms tested\n- [ ] Production JWT secret configured\n- [ ] HTTPS enforced on all redirect_uris\n- [ ] Monitoring: OAuth success rate > 99%\n- [ ] Monitoring: Token validation latency < 50ms\n\n---\n\n## Files to Modify\n\n```\nBackend:\n  ✅ services/continuity-bridge/src/oauth-handler.ts (NEW)\n  ✅ services/gateway/src/middleware/jwt-validator.ts (NEW)\n  ✅ services/gateway/src/middleware/feature-gate.ts (NEW)\n  ✅ services/gateway/src/app.ts (MODIFY - add middleware)\n\nFrontend (example):\n  ✅ frontends/workbench/src/hooks/useAuth.ts (NEW)\n  ✅ frontends/workbench/src/components/ConnectButton.tsx (NEW)\n  ✅ frontends/workbench/src/app/auth/callback/page.tsx (NEW)\n  ✅ frontends/workbench/src/app/page.tsx (MODIFY - conditional render)\n\nConfig:\n  ✅ .env: JWT_SECRET (production value)\n  ✅ .env: All 5 apps with redirect_uris configured\n```\n\n---\n\n## Success Metrics\n\n- OAuth success rate: > 99%\n- Time from click to features available: < 3 seconds\n- Feature visibility consistency across all 5 platforms: 100%\n- No re-authentication needed for 24 hours: ✓\n- Logout removes token and shows \"Connect\" button: ✓\n\n---\n\n## Post-Launch Monitoring\n\n1. **OAuth success rate** - Target: > 99%\n2. **JWT validation latency** - Target: < 50ms\n3. **Feature gate latency** - Target: < 10ms\n4. **Token storage success** - Target: 100%\n5. **Cross-platform consistency** - Target: All 5 platforms show same features\n\n---\n\n## Rollback Plan\n\nIf issues:\n1. Disable feature gate middleware (show public features)\n2. Revert OAuth endpoint (users click \"Connect\" but redirected to previous flow)\n3. Clear all JWT tokens from KV\n\nShould take < 10 minutes.\n\n---\n\n## Estimated Timeline\n\n- Day 1 (8 hours):\n  - Morning: OAuth endpoint + JWT (2 hours)\n  - Afternoon: Feature gate + Gateway integration (2 hours)\n  - Late: Frontend changes (2 hours)\n  - End: Manual testing (2 hours)\n\n- Day 2 (4 hours):\n  - Morning: Deploy to production (1 hour)\n  - Monitor first connections (2 hours)\n  - Iterate based on feedback (1 hour)\n\n**Launch**: End of Day 2\n\n---\n\n## That's It\n\nNo complex flows.\nNo multiple OAuth providers.\nNo feature flags.\nNo A/B tests.\n\nOne endpoint. One token. Multiple frontends. All see the same features.\n\nClick → OAuth → Features.\n\nSimple. Clean. Done.\n"}