BizOSaaS v2-Rebuild Implementation Plan
Source: Derived from
docs/REBUILD_TASKS.mdStatus: ACTIVE
Overview
This plan outlines the technical steps required to complete the BizOSaaS v2-rebuild, focusing on a lean architecture: "5 containers, 2 languages, 1 database engine."
Phase 0: Observability 🟢
- Deploy SigNoz to Dokploy.
- Instrument Python and Next.js services with OTLP.
- Create platform dashboards and critical alerts.
Phase 1: Foundation 🏗️
- Setup Turborepo monorepo with pnpm.
- Shared packages:
ui,db,config,types,api-client. - Single
docker-compose.ymlfor core stack. - Migrate secrets to Infisical.
- PostgreSQL consolidation (pgvector).
Phase 2: Unified Frontend 🌐
- Next.js 15 App Router initialization.
- Multi-tenant middleware and Auth integration.
- Port Dashboard, Admin, and Directory features.
- Complete CRM and SEO Dashboard UI logic.
- Finalize Payload CMS integration for tenant sites.
Phase 3: AI Service Consolidation 🤖
- FastAPI implementation for
ai-service. - Port all agents (CrewAI) and connectors.
- LLM Router and real-time cost tracking.
- Webhook Bridge for low-code automation (Make/n8n).
Phase 4: BullMQ Workflows ⚡
- Replace Temporal with BullMQ for job processing.
- Implement HITL (Human-in-the-loop) dashboard.
- 29 standard workflows converted to BullMQ jobs.
Phase 5: Enterprise Auth & Social Login 🔐
- Configure
better-authSocial Providers (Google, GitHub, LinkedIn, Microsoft). - Build premium OAuth UI buttons for Login/Register flows.
- Implement automatic account linking and onboarding redirection.
- Research SAML/OIDC support for Enterprise clients.
Phase 6: AI Architecture Refinement 🤖 (New)
- Consolidate 47 CrewAI agents by merging duplicate functionality into 20-Core Architecture agents.
- Provide real capabilities for currently stubbed Analytics agents and Workflow crews.
- Map Orchestrator patterns exclusively to the refined agent pool.
Current Mission: Phase 15 Coreldove Accelerator 🚀
- Google Drive inventory synchronization.
- Multi-platform product scanning (Shopify, Amazon Ready, Flipkart Ready).
- SEO promotion engine for product listings.
- Viral Reels script generator based on stock levels.
Verification Protocol
- Local Build:
turbo run buildmust pass. - Docker Check:
docker compose buildfor all services. - Deployment: CI/CD to Dokploy via GitHub Actions.
Phase 17: Production Deployment Blockers Fix 🔧 (March 2026) — ACTIVE
Priority: CRITICAL — Must complete before VPS deployment.
17A — Fix Redis DNS (EAI_AGAIN bizosaas-redis)
bizosaas-webis on bothbizosaas-network+dokploy-network;redisis only onbizosaas-network- Fix:
docker compose down && docker compose up -d(clean restart resets DNS) - If still fails: Add
- dokploy-networkto theredis:service's networks indocker-compose.yml
17B — Fix Health Check (Wrong Table Name)
- Health check queries
"users"but the Drizzle table is named"user"(singular) - Fix: Change
select count(*) from "users"→select count(*) from "user"inapps/web/src/app/api/health/route.ts - Also make the route return HTTP 200 even when DB query fails (graceful degradation)
17C — Add Payload Tables via Direct SQL
drizzle-kit 0.31.7crashes with apg_constraintbug → Payloadpush: truenever works- Fix: Add
payload_migrationsandpayload_preferencesas raw SQL entries in thestartup.mjsTABLESarray - Also: Delete the broken
spawnSyncPayload sync block fromstartup.mjs
17D — Push to GitHub & Deploy to VPS
git addchanged files →git commit→git push origin v2-rebuild- On VPS:
git pull && docker compose build && docker compose up -d
dokploy curl command
KVM8
curl -X 'GET'
'https://dk8.bizoholic.com/api/project.all'
-H 'accept: application/json'
-H 'x-api-key: FCRmhXnyGnZARHJVNGMZOkPoFytPQjJlngLTwpqgPPlQTQKPGwxtpnzqxSbNbEMp'
KVM 2
curl -X 'GET'
'https://dk.bizoholic.com/api/project.all'
-H 'accept: application/json'
-H 'x-api-key: nnsZhSTQXihvzCsZppVpEJllnNXiZoupWzHckPymYaKTmCCGtCzrAdstcdqBGfRn'
Phase 18: 🔧 March 18, 2026 — Build Unblock & Integration Fixes (COMPLETED)
Priority: CRITICAL
Status: ✅ DONE — All fixes committed to v2-rebuild and pushed.
18A: Fix Next.js Build Error (Route Conflict) ✅
- Root Cause:
apps/web/src/app/(payload)/admin/[[...segments]]/page.tsxconflicted with(admin)/admin/page.tsx. Both resolved to the same/adminURL segment. Next.js 15 enforces strict route specificity. - Fix: Deleted
(payload)/admin/[[...segments]]/page.tsx. Payload CMS admin is correctly served at/cmsvia(payload)/cms/[[...segments]]. - Updated:
payload.config.tsadmin meta configuration. - Commit:
bb5f5230c—fix(web): remove duplicate /admin payload route causing Next.js build error - Build Result: Exit code 0 ✅ verified locally.
18B: Fix BizBot WebSocket 403 (CORS) ✅
- Root Cause:
ai-service/ai-agents/main.pyhadallow_origins=["*"]withallow_credentials=True— Starlette rejects wildcard origins when credentials are enabled (HTTP 403). - Fix: Replaced
allow_origins=["*"]with explicit list:app.bizoholic.com,api.bizoholic.com,admin.bizoholic.com,bizoholic.com,thrillring.com,localhost:3000. - Deployed via:
git push origin v2-rebuild(awaiting Dokploy redeploy of ai-service).
18C: Multi-Channel Order Tracking Sync (Coreldove/T2.10) ✅
- Added
tracking_idandcourierfields toOrdermodel inapps/ai-service/app/ports/ecommerce_port.py. - Updated
list_multi_channel_ordersinapps/ai-service/app/api/ecommerce.pyto expose tracking fields. - Frontend E-Commerce Hub pages are already wired to display these fields.
18D: Internal Frontend Routing & Social Auth Fixes ✅
- Root Cause:
apps/web/src/middleware.tswas not properly passing cleaned hostnames (without www) to the internal rewritten URL path, causingapp/[domain]/page.tsxdatabase tenant lookups to fail (e.g. searching for "www.thrillring.com" instead of "thrillring.com"). Also missing CORS config inbetter-auth. - Fix (Middleware): Strip
www.before creating rewritten URLs and implemented a robust non-www to www redirect for root domains. - Fix (Auth): Replaced direct
onClickvalues in social auth with async handlers catching errors and supplyingcallbackURL="/dashboard". Added extensivetrustedOriginsinauth.tsto allow cross-subdomain logins.
18D: Next Steps (Pending Redeploy)
- Trigger Dokploy redeploy of the
core-stackcompose app to pick up the route fix. - Trigger Dokploy redeploy of
ai-service(if separate) to pick up the CORS fix. - Verify BizBot chat at
app.bizoholic.com— WebSocket should no longer return 403. - Run E2E onboarding test (Coreldove D2C scenario) once containers are healthy.
- Proceed with T2.5 (full onboarding flow test) and T2.16 (broken link audit).