{"slug":"developers/IMPLEMENTATION_READY","title":"Implementation Ready: Complete GTM Motion","section":"developers","sectionLabel":"Developers","status":"unclassified","type":"document","path":"developers/IMPLEMENTATION_READY.mdx","bytes":6980,"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**Status**: PRODUCTION READY | Build Time: 2 Days | Launch: This Week\n\n---\n\n## The Motion (2 Minutes to Understand)\n\n```\nUser clicks marketplace app button\n    ↓\nRedirected to OAuth\n    ↓\nEnters email + org name\n    ↓\nBackend creates tenant + issues JWT\n    ↓\nRedirected back with token\n    ↓\nAll features available\n\nTotal time: 2 minutes\n```\n\n---\n\n## 3 Documents to Read (In Order)\n\n### 1. QUICK_START_SIMPLE.md (13 min read)\n**What to do**: 3-step implementation plan\n- Step 1: Deploy OAuth endpoint (4 hours)\n- Step 2: Add feature gate (2 hours)\n- Step 3: Update frontends (4 hours)\n- Launch: End of Day 2\n\n**Action**: Read this first if you want to START BUILDING TODAY\n\n### 2. CONTINUITY_BRIDGE_SIMPLE.md (15 min read)\n**What to do**: Complete OAuth implementation with full code\n- OAuth endpoint code (copy-paste ready)\n- JWT validator code (copy-paste ready)\n- Multi-app support (5 platforms)\n- Deployment checklist\n\n**Action**: Read this when building the backend\n\n### 3. FEATURE_ACTIVATION_SIMPLE.md (15 min read)\n**What to do**: Frontend integration + feature visibility\n- useAuth hook (copy-paste ready)\n- ConnectButton component (copy-paste ready)\n- OAuth callback handler (copy-paste ready)\n- Binary state logic (connected or not)\n\n**Action**: Read this when building the frontend\n\n---\n\n## Your Architecture (From Platform Diagram)\n\n```\nCustomer Ecosystem\n    ↓ (customer uses)\nContinuity Bridge ← ONE OAuth endpoint (handles all apps)\n    ↓\nIdentity + Organization (Tenant + User)\n    ↓\nJWT Token (24-hour expiration)\n    ↓\nAll 5 Frontends:\n  • Claude Desktop\n  • ChatGPT\n  • Perplexity\n  • Replit\n  • Lovable\n    ↓\nGateway Layer (JWT validation + feature gate)\n    ↓\nAdaptive Human Workbench (8 projections)\n    ↓\nFeatures Available (Spine, Agent Lee, Memory, Tasks)\n```\n\n---\n\n## Files You Need to Create/Modify\n\n### Backend (Day 1, 8 hours)\n\n**Create**:\n```\nservices/continuity-bridge/src/\n├── oauth-handler.ts (NEW)\n└── jwt-validator.ts (NEW)\n```\n\n**Modify**:\n```\nservices/gateway/src/\n├── middleware/feature-gate.ts (NEW)\n├── app.ts (ADD middleware)\n```\n\n**Setup**:\n```\n.env\n├── JWT_SECRET (production value)\n└── ALLOWED_APPS (claude, chatgpt, perplexity, replit, lovable)\n```\n\n### Frontend (Day 1, 4 hours)\n\n**Create**:\n```\nfrontends/workbench/src/\n├── hooks/useAuth.ts (NEW)\n├── components/ConnectButton.tsx (NEW)\n└── app/auth/callback/page.tsx (NEW)\n```\n\n**Modify**:\n```\nfrontends/workbench/src/\n├── app/page.tsx (conditional render)\n```\n\n---\n\n## Checklist: Day 1\n\nMorning (OAuth Endpoint):\n- [ ] Read QUICK_START_SIMPLE.md\n- [ ] Read CONTINUITY_BRIDGE_SIMPLE.md\n- [ ] Create oauth-handler.ts\n- [ ] Create jwt-validator.ts\n- [ ] Deploy to staging\n- [ ] Test OAuth flow manually\n\nAfternoon (Feature Gate):\n- [ ] Create feature-gate.ts\n- [ ] Add JWT validation to Gateway\n- [ ] Add feature gate to all routes\n- [ ] Test with Postman (without token → 401, with token → 200)\n\nEvening (Frontend):\n- [ ] Read FEATURE_ACTIVATION_SIMPLE.md\n- [ ] Create useAuth hook\n- [ ] Create ConnectButton component\n- [ ] Create OAuth callback handler\n- [ ] Update page.tsx to use conditional rendering\n- [ ] Manual end-to-end test: click → OAuth → token → features\n\n---\n\n## Checklist: Day 2\n\nMorning (Production):\n- [ ] Deploy OAuth endpoint to production\n- [ ] Deploy Gateway changes to production\n- [ ] Deploy frontend to production\n- [ ] Verify all 5 marketplace apps redirect correctly\n\nAfternoon (Monitor + Iterate):\n- [ ] Watch OAuth success rate (target: > 99%)\n- [ ] Watch first 10 users onboard\n- [ ] Check feature visibility\n- [ ] Gather feedback\n- [ ] Fix any issues\n\nEvening (Wrap):\n- [ ] Document any changes\n- [ ] Update playbooks\n- [ ] Plan Phase 2\n\n---\n\n## Success Metrics (Track These)\n\n**Launch Day**:\n- OAuth success rate: > 99%\n- Time to features: < 3 seconds\n- Token storage success: 100%\n- Feature consistency across 5 platforms: 100%\n\n**Launch Week**:\n- Daily active users: +20% per day\n- Feature usage: > 80% of users try at least one feature\n- Support tickets about \"why can't I see features\": 0\n- OAuth error rate: < 1%\n\n---\n\n## Deployment Commands\n\n### Build\n```bash\ncd services/continuity-bridge && npm run build\ncd services/gateway && npm run build\ncd frontends/workbench && npm run build\n```\n\n### Deploy to Staging\n```bash\nwrangler deploy --env staging\n```\n\n### Deploy to Production\n```bash\nwrangler deploy --env production\n```\n\n### Monitor\n```bash\nwrangler tail --env production\n```\n\n---\n\n## Verification Commands\n\n### Test OAuth Endpoint\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\nExpected: 302 redirect with `?token=...&tenant_id=...`\n\n### Test JWT Validation\n```bash\n# Without token:\ncurl https://gateway.integratewise.com/api/v1/health\n# Response: 401 Unauthorized\n\n# With token:\ncurl https://gateway.integratewise.com/api/v1/health \\\n  -H \"Authorization: Bearer eyJhbGc...\"\n# Response: 200 OK\n```\n\n### Test All 5 Apps\n```bash\n# Claude Desktop\ncurl \"https://integratewise.com/auth/authorize?app=claude&...\"\n\n# ChatGPT\ncurl \"https://integratewise.com/auth/authorize?app=chatgpt&...\"\n\n# Perplexity\ncurl \"https://integratewise.com/auth/authorize?app=perplexity&...\"\n\n# Replit\ncurl \"https://integratewise.com/auth/authorize?app=replit&...\"\n\n# Lovable\ncurl \"https://integratewise.com/auth/authorize?app=lovable&...\"\n```\n\nAll should redirect with token.\n\n---\n\n## Rollback Plan (If Issues)\n\n1. Disable feature gate middleware\n   ```typescript\n   // Comment out in Gateway app.ts\n   // app.use(featureGate);\n   ```\n\n2. Revert JWT validation\n   ```typescript\n   // Comment out in Gateway app.ts\n   // app.use(validateJWT);\n   ```\n\n3. Clear all tokens from KV\n   ```bash\n   wrangler kv:key delete integratewise_tokens \"*\"\n   ```\n\nTime to rollback: < 10 minutes\n\n---\n\n## What Happens After Launch\n\n**Week 1**: Scale to 1000 users\n**Week 2**: Add AI agent integration (Agent Lee)\n**Week 3**: Cross-domain metrics\n**Week 4**: Usage-based billing\n\n---\n\n## Support\n\nIf issues:\n1. Check logs: `wrangler tail`\n2. Check database: OAuth tokens being created?\n3. Check frontend: Token stored in localStorage?\n4. Check Gateway: JWT validation passing?\n\n---\n\n## That's It\n\nNo complex flows.\nNo multiple OAuth providers.\nNo feature flags.\n\nOne endpoint. One token. Five platforms. All features available.\n\n**Click → OAuth → Features**\n\nEverything is documented. Everything is coded. Everything is ready.\n\nStart with QUICK_START_SIMPLE.md and build today.\n\nLaunch this week.\n\nWin.\n"}