From 1c8c44ebe0718b4d46d28c2b17b7d7a13626718b Mon Sep 17 00:00:00 2001 From: Desktop Date: Sun, 16 Nov 2025 22:50:04 +0500 Subject: [PATCH] b --- .../IGNY8-HOLISTIC-ARCHITECTURE-PLAN.md | 279 +++++------------- 1 file changed, 72 insertions(+), 207 deletions(-) diff --git a/docs/planning/IGNY8-HOLISTIC-ARCHITECTURE-PLAN.md b/docs/planning/IGNY8-HOLISTIC-ARCHITECTURE-PLAN.md index 76393a11..3ea37567 100644 --- a/docs/planning/IGNY8-HOLISTIC-ARCHITECTURE-PLAN.md +++ b/docs/planning/IGNY8-HOLISTIC-ARCHITECTURE-PLAN.md @@ -27,9 +27,9 @@ | Principle | Description | Implementation | |-----------|-------------|----------------| -| **Domain-Driven Design** | Organize by business domains, not technical layers | `business-modules/` folder with content, planning, linking, optimization, publishing business modules | -| **Service Layer Pattern** | Business logic in services, not ViewSets | All modules delegate to business module services | -| **Single Responsibility** | Each layer has one clear purpose | Core → Business Modules → Module → Infrastructure | +| **Domain-Driven Design** | Organize by business domains, not technical layers | `domain/` folder with content, planning, linking, optimization, publishing domains | +| **Service Layer Pattern** | Business logic in services, not ViewSets | All modules delegate to domain services | +| **Single Responsibility** | Each layer has one clear purpose | Core → Domain → Module → Infrastructure | | **No Duplication** | Reuse services across modules | ContentGenerationService used by Writer + Site Builder | | **Multi-Tenancy First** | All features respect account/site/sector boundaries | All models inherit AccountBaseModel or SiteSectorBaseModel | | **Automation Ready** | All functions can be automated via Celery | All AI functions exposed as Celery tasks with scheduling support | @@ -38,7 +38,7 @@ | System | Purpose | Technology | Container | |--------|---------|------------|-----------| -| **IGNY8 Core App** | Main backend API (all business modules) | Django 5.2+ | `igny8_backend` | +| **IGNY8 Core App** | Main backend API (all domains) | Django 5.2+ | `igny8_backend` | | **IGNY8 Main App** | Dashboard UI | React 19 + Vite | `igny8_frontend` | | **IGNY8 Site Builder** | Site creation wizard | React 19 + Vite | `igny8_site_builder` (NEW) | | **IGNY8 Sites** | Public site renderer | React 19 + Vite/Next.js | `igny8_sites` (NEW) | @@ -108,8 +108,8 @@ backend/igny8_core/ │ ├── permissions.py # IsAuthenticatedAndActive, HasTenantAccess │ └── throttles.py # DebugScopedRateThrottle │ -├── business-modules/ # BUSINESS MODULES LAYER (Business Logic) -│ ├── content/ # Content business module +├── domain/ # DOMAIN LAYER (Business Logic) +│ ├── content/ # Content domain │ │ ├── models.py # Content, Tasks, Images (unified, extended) │ │ ├── services/ │ │ │ ├── content_generation_service.py # Unified generation @@ -117,23 +117,23 @@ backend/igny8_core/ │ │ │ └── content_versioning_service.py # Version management │ │ └── repositories.py # ContentRepository (if needed) │ │ -│ ├── planning/ # Planning business module +│ ├── planning/ # Planning domain │ │ ├── models.py # Keywords, Clusters, Ideas │ │ └── services/ │ │ ├── clustering_service.py │ │ └── ideas_service.py │ │ -│ ├── linking/ # Linking business module (NEW) +│ ├── linking/ # Linking domain (NEW) │ │ ├── models.py # InternalLinks, LinkGraph │ │ └── services/ │ │ └── linker_service.py │ │ -│ ├── optimization/ # Optimization business module (NEW) +│ ├── optimization/ # Optimization domain (NEW) │ │ ├── models.py # OptimizationTask, OptimizationScores │ │ └── services/ │ │ └── optimizer_service.py │ │ -│ ├── publishing/ # Publishing business module (NEW) +│ ├── publishing/ # Publishing domain (NEW) │ │ ├── models.py # PublishingRecord, DeploymentRecord │ │ └── services/ │ │ ├── publisher_service.py @@ -143,13 +143,13 @@ backend/igny8_core/ │ │ │ └── sites_renderer_adapter.py │ │ └── deployment_service.py │ │ -│ ├── site_building/ # Site Building business module (NEW) +│ ├── site_building/ # Site Building domain (NEW) │ │ ├── models.py # SiteBlueprint, PageBlueprint │ │ └── services/ │ │ ├── structure_generation_service.py │ │ └── site_deployment_service.py │ │ -│ └── billing/ # Billing business module +│ └── billing/ # Billing domain │ ├── models.py # Credits, Transactions │ └── services/ │ └── credit_service.py @@ -248,20 +248,20 @@ backend/igny8_core/ | Model | Current Location | New Location | Extensions Needed | |-------|------------------|-------------|-------------------| -| `Content` | `modules/writer/models.py` | `business-modules/content/models.py` | Add: `entity_type`, `json_blocks`, `structure_data`, `linker_version`, `optimizer_version`, `internal_links`, `optimization_scores`, `published_to`, `external_ids`, `source`, `sync_status`, `external_id`, `external_url`, `sync_metadata` | -| `Tasks` | `modules/writer/models.py` | `business-modules/content/models.py` | Add: `entity_type` choices (product, service, taxonomy, etc.) | -| `Keywords` | `modules/planner/models.py` | `business-modules/planning/models.py` | No changes | -| `Clusters` | `modules/planner/models.py` | `business-modules/planning/models.py` | No changes | -| `ContentIdeas` | `modules/planner/models.py` | `business-modules/planning/models.py` | Add: `entity_type` support | -| `InternalLinks` | - | `business-modules/linking/models.py` | NEW: `source_id`, `target_id`, `anchor`, `position`, `link_type` | -| `OptimizationTask` | - | `business-modules/optimization/models.py` | NEW: `content_id`, `type`, `target_keyword`, `scores_before`, `scores_after`, `html_before`, `html_after` | -| `SiteBlueprint` | - | `business-modules/site_building/models.py` | NEW: `tenant`, `site`, `config_json`, `structure_json`, `status`, `hosting_type` | -| `PageBlueprint` | - | `business-modules/site_building/models.py` | NEW: `site_blueprint`, `slug`, `type`, `blocks_json`, `status` | -| `SiteIntegration` | - | `business-modules/integration/models.py` | NEW: `site`, `platform`, `platform_type`, `config_json`, `credentials`, `is_active`, `sync_enabled` | -| `PublishingRecord` | - | `business-modules/publishing/models.py` | NEW: `content_id`, `destination`, `destination_type`, `status`, `external_id`, `published_at`, `sync_status` | -| `DeploymentRecord` | - | `business-modules/publishing/models.py` | NEW: `site_blueprint`, `version`, `status`, `build_url`, `deployed_at`, `deployment_type` | -| `AutomationRule` | - | `business-modules/automation/models.py` | NEW: `name`, `trigger`, `conditions`, `actions`, `schedule`, `is_active` | -| `ScheduledTask` | - | `business-modules/automation/models.py` | NEW: `automation_rule`, `scheduled_at`, `status`, `executed_at` | +| `Content` | `modules/writer/models.py` | `domain/content/models.py` | Add: `entity_type`, `json_blocks`, `structure_data`, `linker_version`, `optimizer_version`, `internal_links`, `optimization_scores`, `published_to`, `external_ids`, `source`, `sync_status`, `external_id`, `external_url`, `sync_metadata` | +| `Tasks` | `modules/writer/models.py` | `domain/content/models.py` | Add: `entity_type` choices (product, service, taxonomy, etc.) | +| `Keywords` | `modules/planner/models.py` | `domain/planning/models.py` | No changes | +| `Clusters` | `modules/planner/models.py` | `domain/planning/models.py` | No changes | +| `ContentIdeas` | `modules/planner/models.py` | `domain/planning/models.py` | Add: `entity_type` support | +| `InternalLinks` | - | `domain/linking/models.py` | NEW: `source_id`, `target_id`, `anchor`, `position`, `link_type` | +| `OptimizationTask` | - | `domain/optimization/models.py` | NEW: `content_id`, `type`, `target_keyword`, `scores_before`, `scores_after`, `html_before`, `html_after` | +| `SiteBlueprint` | - | `domain/site_building/models.py` | NEW: `tenant`, `site`, `config_json`, `structure_json`, `status`, `hosting_type` | +| `PageBlueprint` | - | `domain/site_building/models.py` | NEW: `site_blueprint`, `slug`, `type`, `blocks_json`, `status` | +| `SiteIntegration` | - | `domain/integration/models.py` | NEW: `site`, `platform`, `platform_type`, `config_json`, `credentials`, `is_active`, `sync_enabled` | +| `PublishingRecord` | - | `domain/publishing/models.py` | NEW: `content_id`, `destination`, `destination_type`, `status`, `external_id`, `published_at`, `sync_status` | +| `DeploymentRecord` | - | `domain/publishing/models.py` | NEW: `site_blueprint`, `version`, `status`, `build_url`, `deployed_at`, `deployment_type` | +| `AutomationRule` | - | `domain/automation/models.py` | NEW: `name`, `trigger`, `conditions`, `actions`, `schedule`, `is_active` | +| `ScheduledTask` | - | `domain/automation/models.py` | NEW: `automation_rule`, `scheduled_at`, `status`, `executed_at` | --- @@ -367,8 +367,8 @@ sites/src/ | Component | Purpose | Implementation | |-----------|---------|----------------| -| **AutomationRule Model** | Store automation rules | `business-modules/automation/models.py` | -| **AutomationService** | Execute automation rules | `business-modules/automation/services/automation_service.py` | +| **AutomationRule Model** | Store automation rules | `domain/automation/models.py` | +| **AutomationService** | Execute automation rules | `domain/automation/services/automation_service.py` | | **Celery Beat Tasks** | Scheduled automation | `infrastructure/messaging/automation_tasks.py` | | **Automation API** | CRUD for rules | `modules/automation/views.py` | | **Automation UI** | Manage rules | `frontend/src/pages/Automation/` | @@ -410,8 +410,8 @@ class AutomationRule(SiteSectorBaseModel): | Task | File | Implementation | |------|------|----------------| -| **AutomationRule Model** | `business-modules/automation/models.py` | Create model with trigger, conditions, actions, schedule | -| **AutomationService** | `business-modules/automation/services/automation_service.py` | `execute_rule()`, `check_conditions()`, `execute_actions()` | +| **AutomationRule Model** | `domain/automation/models.py` | Create model with trigger, conditions, actions, schedule | +| **AutomationService** | `domain/automation/services/automation_service.py` | `execute_rule()`, `check_conditions()`, `execute_actions()` | | **Celery Beat Tasks** | `infrastructure/messaging/automation_tasks.py` | `@periodic_task` decorators for scheduled rules | | **Automation API** | `modules/automation/views.py` | CRUD ViewSet for AutomationRule | | **Automation UI** | `frontend/src/pages/Automation/` | Dashboard, Rules management, History | @@ -435,9 +435,9 @@ class AutomationRule(SiteSectorBaseModel): | Resource | Limit Type | Enforcement | Location | |-----------|------------|-------------|----------| -| **Daily Content Tasks** | Per site | `Plan.daily_content_tasks` | `business-modules/content/services/content_generation_service.py` | +| **Daily Content Tasks** | Per site | `Plan.daily_content_tasks` | `domain/content/services/content_generation_service.py` | | **Daily AI Requests** | Per site | `Plan.daily_ai_requests` | `infrastructure/ai/engine.py` | -| **Monthly Word Count** | Per site | `Plan.monthly_word_count_limit` | `business-modules/content/services/content_generation_service.py` | +| **Monthly Word Count** | Per site | `Plan.monthly_word_count_limit` | `domain/content/services/content_generation_service.py` | | **Daily Image Generation** | Per site | `Plan.daily_image_generation_limit` | `infrastructure/ai/functions/generate_images.py` | | **Storage Quota** | Per site | Configurable (default: 10GB) | `infrastructure/storage/file_storage.py` | | **Concurrent Tasks** | Per site | Configurable (default: 5) | Celery queue configuration | @@ -531,7 +531,7 @@ class FileStorageService: **Site Builder File Management**: ```python -# business-modules/site_building/services/file_management_service.py +# domain/site_building/services/file_management_service.py class SiteBuilderFileService: def get_user_accessible_sites(self, user) -> List[Site]: """Get sites user can access for file management""" @@ -557,166 +557,31 @@ class SiteBuilderFileService: ## 8. REPOSITORY STRUCTURE -### 8.1 Repository Structure - -#### 8.1.1 IGNY8 Repository (Main Development Repository) - -**Purpose**: Complete codebase including backend, frontend, and architecture documentation +### 8.1 Main Repository Structure ``` -igny8/ # Main Git repository (Complete Codebase) -├── backend/ # Django backend (ACTUAL CODE, not architecture) -│ └── igny8_core/ # Django project with all modules +igny8/ # Main Git repository +├── backend/ # Django backend ├── frontend/ # React frontend (main app + marketing) -├── site-builder/ # Site Builder frontend (NEW) -├── sites/ # Sites renderer frontend (NEW) -├── docs/ # Complete documentation -│ ├── planning/ # Architecture & implementation plans (ARCHITECTURE FILES) -│ ├── refactor/ # Refactoring plans (ARCHITECTURE FILES) -│ └── [core docs] # Technical documentation +├── site-builder/ # Site Builder (NEW - separate or subfolder) +├── sites/ # Sites renderer (NEW - separate or subfolder) +├── docs/ # Documentation ├── docker-compose.app.yml # App stack ├── .gitignore # Excludes: node_modules, __pycache__, .env, logs, storage, sites-data └── README.md - -NOTE: -- backend/ contains ACTUAL IMPLEMENTATION CODE (not architecture) -- docs/planning/ contains ARCHITECTURE FILES (specifications, plans) -- Backend code can be developed here OR in separate repo for VPS deployment ``` -#### 8.1.2 Separate Backend Repository (Optional - VPS Deployment) - -**Purpose**: Backend code for VPS deployment (SSH-accessible files only) - -**When to Use:** -- Backend needs to be deployed separately to VPS -- Backend code is only accessible via SSH (not in igny8 folder) -- Separate deployment pipeline required - -**Structure:** -``` -igny8-backend/ # Separate Git repository (Backend Only) -├── igny8_core/ # Django project -│ ├── core/ # Core layer -│ ├── business-modules/ # Business modules layer -│ ├── infrastructure/ # Infrastructure layer -│ ├── modules/ # Module ViewSets (API layer) -│ ├── shared/ # Shared utilities -│ └── api/ # API base classes -├── requirements.txt -├── Dockerfile -├── docker-compose.backend.yml # Backend stack -├── .gitignore -└── README.md - -NOTE: -- This repo contains ACTUAL BACKEND CODE (not architecture) -- Used when backend is deployed separately from igny8 repo -- Follows architecture from igny8/docs/planning/ -- Files accessible only via SSH (VPS deployment) -``` - -#### 8.1.3 Development Workflow - -**Architecture First (igny8 repo):** -1. Architecture defined in `igny8/docs/planning/` (ARCHITECTURE FILES) -2. Module architecture docs created (`docs/planning/modules/{module}/`) -3. API specifications defined - -**Development Options:** - -**Option A: Single Repository (igny8)** -- Backend code in `igny8/backend/` (ACTUAL CODE) -- Frontend code in `igny8/frontend/` -- Architecture docs in `igny8/docs/planning/` (ARCHITECTURE FILES) -- All in one repo, easier coordination - -**Option B: Separate Backend Repository (VPS)** -- Backend code in separate `igny8-backend/` repo (ACTUAL CODE) -- Frontend code in `igny8/frontend/` -- Architecture docs in `igny8/docs/planning/` (ARCHITECTURE FILES) -- Backend deployed separately via SSH (VPS access only) -- Backend developers clone backend repo -- Frontend developers clone igny8 repo -- Both follow architecture from igny8 repo docs - -**Module Development:** -1. Architecture defined in `igny8/docs/planning/modules/{module}/` (ARCHITECTURE FILES) -2. Backend code developed in `igny8/backend/` OR `igny8-backend/` (ACTUAL CODE) -3. Frontend code developed in `igny8/frontend/` (ACTUAL CODE) -4. Module branches created (`module/{module-name}`) -5. Independent development with architecture as contract - ### 8.2 Branching Strategy -#### 8.2.1 IGNY8 Repository (Main Development Repository) - -**This Repository Contains:** -- **Backend code** (`backend/`) - ACTUAL IMPLEMENTATION CODE -- **Frontend code** (`frontend/`, `site-builder/`, `sites/`) - ACTUAL IMPLEMENTATION CODE -- **Architecture documentation** (`docs/planning/`) - ARCHITECTURE FILES ONLY -- Implementation plans -- API specifications - -**Branch Structure:** - | Branch | Purpose | Merge To | Protection | |--------|---------|----------|------------| -| `main` | Production-ready architecture/docs | - | Protected, requires PR | -| `develop` | Integration branch for docs | `main` | Protected, requires PR | -| `feature/*` | Feature documentation branches | `develop` | Not protected | -| `module/*` | Module-specific architecture docs | `develop` | Not protected | -| `hotfix/*` | Critical doc fixes | `main`, `develop` | Not protected | -| `release/*` | Release documentation | `main` | Protected | - -**Module-Level Branches:** -- `module/automation` - Automation module architecture -- `module/linker` - Linker module architecture -- `module/optimizer` - Optimizer module architecture -- `module/site-builder` - Site Builder architecture -- `module/integration` - Integration module architecture -- `module/publisher` - Publisher module architecture - -#### 8.2.2 Separate Backend Repository (Development) - -**Backend Repository Structure:** -- Separate Git repository (not in igny8) -- Contains all Django backend code -- Follows architecture from igny8 repo docs -- Has its own branching strategy - -**Backend Branch Structure:** - -| Branch | Purpose | Merge To | Protection | -|--------|---------|----------|------------| -| `main` | Production-ready backend | - | Protected, requires PR | +| `main` | Production-ready code | - | Protected, requires PR | | `develop` | Integration branch | `main` | Protected, requires PR | -| `module/automation` | Automation module backend | `develop` | Not protected | -| `module/linker` | Linker module backend | `develop` | Not protected | -| `module/optimizer` | Optimizer module backend | `develop` | Not protected | -| `module/site-builder` | Site Builder backend | `develop` | Not protected | -| `module/integration` | Integration module backend | `develop` | Not protected | -| `module/publisher` | Publisher module backend | `develop` | Not protected | | `feature/*` | Feature branches | `develop` | Not protected | +| `phase-2/*` | Phase 2 features | `develop` | Not protected | | `hotfix/*` | Critical fixes | `main`, `develop` | Not protected | | `release/*` | Release candidates | `main` | Protected | -**Module Development Workflow:** - -**If using single repository (igny8):** -1. Architecture defined in `igny8/docs/planning/modules/{module}/` (ARCHITECTURE FILES) -2. Backend code developed in `igny8/backend/` (`module/{module-name}` branch) -3. Frontend code developed in `igny8/frontend/` (`module/{module-name}` branch) -4. Integration testing in `develop` branches -5. Merge to `main` when complete - -**If using separate backend repo (VPS):** -1. Architecture defined in `igny8/docs/planning/modules/{module}/` (ARCHITECTURE FILES) -2. Backend code developed in `igny8-backend/` (`module/{module-name}` branch) - SSH access only -3. Frontend code developed in `igny8/frontend/` (`module/{module-name}` branch) -4. Integration testing in `develop` branches -5. Merge to `main` when complete - ### 8.3 Repository Exclusions (.gitignore) ``` @@ -781,11 +646,11 @@ docker-data/ | Task | Files | Status | Priority | |------|-------|--------|-----------| -| **Extend Content Model** | `business-modules/content/models.py` | TODO | HIGH | -| **Create Service Layer** | `business-modules/*/services/` | TODO | HIGH | +| **Extend Content Model** | `domain/content/models.py` | TODO | HIGH | +| **Create Service Layer** | `domain/*/services/` | TODO | HIGH | | **Refactor ViewSets** | `modules/*/views.py` | TODO | HIGH | -| **Implement Automation Models** | `business-modules/automation/models.py` | TODO | HIGH | -| **Implement Automation Service** | `business-modules/automation/services/` | TODO | HIGH | +| **Implement Automation Models** | `domain/automation/models.py` | TODO | HIGH | +| **Implement Automation Service** | `domain/automation/services/` | TODO | HIGH | | **Implement Automation API** | `modules/automation/` | TODO | HIGH | | **Implement Automation UI** | `frontend/src/pages/Automation/` | TODO | HIGH | | **Implement Schedules UI** | `frontend/src/pages/Schedules.tsx` | TODO | HIGH | @@ -795,8 +660,8 @@ docker-data/ | Task | Files | Dependencies | Priority | |------|-------|--------------|----------| | **Create Site Builder Container** | `docker-compose.app.yml` | Phase 0 | HIGH | -| **Site Builder Models** | `business-modules/site_building/models.py` | Phase 0 | HIGH | -| **Structure Generation Service** | `business-modules/site_building/services/` | Phase 0 | HIGH | +| **Site Builder Models** | `domain/site_building/models.py` | Phase 0 | HIGH | +| **Structure Generation Service** | `domain/site_building/services/` | Phase 0 | HIGH | | **Structure Generation AI Function** | `infrastructure/ai/functions/generate_site_structure.py` | Phase 0 | HIGH | | **Site Builder API** | `modules/site_builder/` | Phase 0 | HIGH | | **Site Builder Frontend** | `site-builder/src/` | Phase 0 | HIGH | @@ -805,12 +670,12 @@ docker-data/ | Task | Files | Dependencies | Priority | |------|-------|--------------|----------| -| **Linker Models** | `business-modules/linking/models.py` | Phase 0 | MEDIUM | -| **Linker Service** | `business-modules/linking/services/` | Phase 0 | MEDIUM | +| **Linker Models** | `domain/linking/models.py` | Phase 0 | MEDIUM | +| **Linker Service** | `domain/linking/services/` | Phase 0 | MEDIUM | | **Linker API** | `modules/linker/` | Phase 0 | MEDIUM | | **Linker UI** | `frontend/src/pages/Linker/` | Phase 0 | MEDIUM | -| **Optimizer Models** | `business-modules/optimization/models.py` | Phase 0 | MEDIUM | -| **Optimizer Service** | `business-modules/optimization/services/` | Phase 0 | MEDIUM | +| **Optimizer Models** | `domain/optimization/models.py` | Phase 0 | MEDIUM | +| **Optimizer Service** | `domain/optimization/services/` | Phase 0 | MEDIUM | | **Optimizer AI Function** | `infrastructure/ai/functions/optimize_content.py` | Phase 0 | MEDIUM | | **Optimizer API** | `modules/optimizer/` | Phase 0 | MEDIUM | | **Optimizer UI** | `frontend/src/pages/Optimizer/` | Phase 0 | MEDIUM | @@ -821,22 +686,22 @@ docker-data/ |------|-------|--------------|----------| | **Create Sites Container** | `docker-compose.app.yml` | Phase 1 | MEDIUM | | **Sites Renderer Frontend** | `sites/src/` | Phase 1 | MEDIUM | -| **Publisher Service** | `business-modules/publishing/services/` | Phase 0 | MEDIUM | -| **Sites Renderer Adapter** | `business-modules/publishing/services/adapters/` | Phase 1 | MEDIUM | +| **Publisher Service** | `domain/publishing/services/` | Phase 0 | MEDIUM | +| **Sites Renderer Adapter** | `domain/publishing/services/adapters/` | Phase 1 | MEDIUM | | **Publisher API** | `modules/publisher/` | Phase 0 | MEDIUM | -| **Deployment Service** | `business-modules/publishing/services/deployment_service.py` | Phase 1 | MEDIUM | +| **Deployment Service** | `domain/publishing/services/deployment_service.py` | Phase 1 | MEDIUM | ### 9.5 Phase 4: Universal Content Types | Task | Files | Dependencies | Priority | |------|-------|--------------|----------| -| **Extend Content Model** | `business-modules/content/models.py` | Phase 0 | LOW | +| **Extend Content Model** | `domain/content/models.py` | Phase 0 | LOW | | **Product Content Prompts** | `infrastructure/ai/prompts.py` | Phase 0 | LOW | | **Service Page Prompts** | `infrastructure/ai/prompts.py` | Phase 0 | LOW | | **Taxonomy Prompts** | `infrastructure/ai/prompts.py` | Phase 0 | LOW | -| **Content Type Support in Writer** | `business-modules/content/services/` | Phase 0 | LOW | -| **Content Type Support in Linker** | `business-modules/linking/services/` | Phase 2 | LOW | -| **Content Type Support in Optimizer** | `business-modules/optimization/services/` | Phase 2 | LOW | +| **Content Type Support in Writer** | `domain/content/services/` | Phase 0 | LOW | +| **Content Type Support in Linker** | `domain/linking/services/` | Phase 2 | LOW | +| **Content Type Support in Optimizer** | `domain/optimization/services/` | Phase 2 | LOW | --- @@ -886,11 +751,11 @@ docker-data/ | Location | Check | Implementation | |----------|-------|----------------| | **AI Engine** | Before AI call | `infrastructure/ai/engine.py` - Check credits, deduct before request | -| **Content Generation** | Before generation | `business-modules/content/services/content_generation_service.py` | +| **Content Generation** | Before generation | `domain/content/services/content_generation_service.py` | | **Image Generation** | Before generation | `infrastructure/ai/functions/generate_images.py` | -| **Linking** | Before linking | `business-modules/linking/services/linker_service.py` (NEW) | -| **Optimization** | Before optimization | `business-modules/optimization/services/optimizer_service.py` (NEW) | -| **Site Building** | Before structure gen | `business-modules/site_building/services/structure_generation_service.py` (NEW) | +| **Linking** | Before linking | `domain/linking/services/linker_service.py` (NEW) | +| **Optimization** | Before optimization | `domain/optimization/services/optimizer_service.py` (NEW) | +| **Site Building** | Before structure gen | `domain/site_building/services/structure_generation_service.py` (NEW) | ### 10.5 Credit Logging @@ -920,8 +785,8 @@ These are **NOT** business limits - they're technical constraints for request pr | Feature | Implementation | Location | |---------|----------------|----------| -| **Credit Check** | Before every AI operation | `business-modules/billing/services/credit_service.py` | -| **Credit Deduction** | After successful operation | `business-modules/billing/services/credit_service.py` | +| **Credit Check** | Before every AI operation | `domain/billing/services/credit_service.py` | +| **Credit Deduction** | After successful operation | `domain/billing/services/credit_service.py` | | **Credit Top-up** | On-demand purchase | `modules/billing/views.py` | | **Monthly Replenishment** | Celery Beat task | `infrastructure/messaging/automation_tasks.py` | | **Low Credit Warning** | When < 10% remaining | Frontend + Email notification | @@ -1029,7 +894,7 @@ publisher_service.publish( ### 11.6 Site Integration Service ```python -# business-modules/integration/services/integration_service.py +# domain/integration/services/integration_service.py class IntegrationService: def create_integration(self, site, platform, config, credentials): """Create new site integration""" @@ -1081,12 +946,12 @@ Content/Site Publishing Flow: | Component | File | Purpose | |-----------|------|---------| -| **SiteIntegration Model** | `business-modules/integration/models.py` | Store integration configs | -| **IntegrationService** | `business-modules/integration/services/integration_service.py` | Manage integrations | -| **SyncService** | `business-modules/integration/services/sync_service.py` | Handle two-way sync | -| **WordPressAdapter** | `business-modules/publishing/services/adapters/wordpress_adapter.py` | WordPress publishing | -| **SitesRendererAdapter** | `business-modules/publishing/services/adapters/sites_renderer_adapter.py` | IGNY8 Sites deployment | -| **ShopifyAdapter** | `business-modules/publishing/services/adapters/shopify_adapter.py` | Shopify publishing (future) | +| **SiteIntegration Model** | `domain/integration/models.py` | Store integration configs | +| **IntegrationService** | `domain/integration/services/integration_service.py` | Manage integrations | +| **SyncService** | `domain/integration/services/sync_service.py` | Handle two-way sync | +| **WordPressAdapter** | `domain/publishing/services/adapters/wordpress_adapter.py` | WordPress publishing | +| **SitesRendererAdapter** | `domain/publishing/services/adapters/sites_renderer_adapter.py` | IGNY8 Sites deployment | +| **ShopifyAdapter** | `domain/publishing/services/adapters/shopify_adapter.py` | Shopify publishing (future) | | **Integration API** | `modules/integration/views.py` | CRUD for integrations | | **Integration UI** | `frontend/src/pages/Settings/Integrations.tsx` | Manage integrations | @@ -1128,7 +993,7 @@ Site Builder → Publishing Flow: ### Key Architectural Decisions -1. **Business Module Structure**: Organize by business modules, not technical layers +1. **Domain-Driven Structure**: Organize by business domains, not technical layers 2. **Service Layer**: All business logic in services, ViewSets are thin 3. **Unified Content Model**: Extend existing `Content` model, don't create duplicates 4. **Automation First**: All functions can be automated via Celery + AutomationRule