系统架构与重构计划
Digital Employee Platform - System Architecture & Refactoring Plan
Date: 2026-01-23 Version: 1.0 Status: In Progress
1. Domain & System Strategy (前店后厂模式)
Adopting a "Dual-Core" architecture to separate Marketing (SEO/Content) from SaaS Application (Functionality/Interactive).
| Component | Domain | Tech Stack | Responsibility | Note |
|---|---|---|---|---|
| Official Portal | www.sdosoft.com | Next.js (SSG) / Astro | Marketing & Lead Gen: SEO, Products, Solutions, Pricing, Cases. | Focused on speed & static content. |
| AI Console | ai.sdosoft.com | Next.js (App Router) | SaaS Application: Workspace, Digital Employees, GEO Dashboard, Settings. | Heavily interactive, client-side rendering. |
| API Gateway | api.sdosoft.com | FastAPI | Backend Services: Business logic, DB access, AI Agents orchestration. | Stateless REST API. |
| Documentation | docs.sdosoft.com | Docusaurus / GitBook | Dev Support: User manuals, API references. | Static site. |
2. Monorepo Directory Structure
The project will transition to a structured Monorepo to manage these distinct applications.
3. Auth & Session Strategy (Unified Experience)
To ensure seamless transitions between www and ai, we share authentication state via Root Domain Cookies.
- Cookie Domain:
.sdosoft.com(Allows subdomains to access). - Token Storage:
access_tokenstored in Cookie (HttpOnly recommended) or Client Storage with domain check. - User Flow:
- User lands on
www.sdosoft.com. - System checks for Token.
- If present: Header button shows "Enter Console" -> Links to
ai.sdosoft.com. - If absent: Header button shows "Login / Sign Up".
- If present: Header button shows "Enter Console" -> Links to
- Login happens on
ai.sdosoft.com/login(or centralized auth). - On success, Token is written to
.sdosoft.com.
- User lands on
4. Refactoring Roadmap
Phase 1: Preparation (Current)
- Document Architecture.
- Initialize
apps/official-sitestructure. - Configure
apps/web-consoleas the dedicated AI Console (metadata updates).
Phase 2: Migration
- Move
apps/web-console/app/landing->apps/official-site/app/page.tsx(Home). - Move
apps/web-console/app/solution->apps/official-site/app/solution. - Clean up
web-consoleto remove static marketing pages.
Phase 3: Integration
- Implement Shared Cookie Logic.
- Unify UI Design System (Colors, Fonts) across apps.