"`
+3. Check conditionals have matching closing parens/braces
+
+**Common Pattern:**
+```tsx
+{condition && (
+
+ {/* Content */}
+
+ {/* Missing closing parenthesis causes "adjacent elements" error */}
+}
+```
+
+**Solution:** Ensure every opening bracket has matching close bracket
+
+---
+
+## Best Practices Summary
+
+### State Management
+✅ **DO:** Immediately persist auth tokens synchronously
+✅ **DO:** Selectively remove localStorage keys
+✅ **DO:** Reset dependent stores on logout
+❌ **DON'T:** Use `localStorage.clear()`
+❌ **DON'T:** Rely solely on Zustand persist middleware timing
+
+### Error Handling
+✅ **DO:** Check authentication errors BEFORE throwing
+✅ **DO:** Force logout on invalid tokens
+✅ **DO:** Redirect to login after logout
+❌ **DON'T:** Throw errors before checking auth status
+❌ **DON'T:** Leave invalid tokens in storage
+
+### Component Architecture
+✅ **DO:** Lazy-load data at component level
+✅ **DO:** Skip unnecessary data loading (hideSiteSector pattern)
+✅ **DO:** Keep components in Router context
+❌ **DON'T:** Load data globally in AppLayout
+❌ **DON'T:** Use Router hooks outside Router context
+
+### Permission System
+✅ **DO:** Implement bypass at ALL permission layers
+✅ **DO:** Include system accounts in bypass checks
+✅ **DO:** Use consistent bypass logic everywhere
+❌ **DON'T:** Forget middleware layer bypass
+❌ **DON'T:** Mix permission approaches
+
+### Docker Builds
+✅ **DO:** Use `--no-cache` after major changes
+✅ **DO:** Restart containers after rebuilds
+✅ **DO:** Check logs for module loading errors
+❌ **DON'T:** Trust build cache after git commits
+❌ **DON'T:** Deploy without testing fresh build
+
+---
+
+## Quick Reference: File Locations
+
+### Authentication
+- Token handling: `frontend/src/services/api.ts`
+- Auth store: `frontend/src/store/authStore.ts`
+- Middleware: `backend/igny8_core/auth/middleware.py`
+
+### Permissions
+- Permission classes: `backend/igny8_core/api/permissions.py`
+- Base viewsets: `backend/igny8_core/api/base.py`
+- Validation utils: `backend/igny8_core/auth/utils.py`
+
+### Site/Sector
+- Site store: `frontend/src/store/siteStore.ts`
+- Sector store: `frontend/src/store/sectorStore.ts`
+- PageHeader: `frontend/src/components/common/PageHeader.tsx`
+
+### Billing
+- Billing API: `frontend/src/services/billing.api.ts`
+- Plans page: `frontend/src/pages/account/PlansAndBillingPage.tsx`
+- Plan model: `backend/igny8_core/auth/models.py`
+
+---
+
+**End of Knowledge Base**
+*Update this document when architectural patterns change or new common issues are discovered.*
diff --git a/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/MANAGED-ADDON-PLAN.md b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/MANAGED-ADDON-PLAN.md
new file mode 100644
index 00000000..4a566b39
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/MANAGED-ADDON-PLAN.md
@@ -0,0 +1,146 @@
+# Managed Add-on Plans (Marketing + App)
+
+**Date:** 2026-01-20
+
+## Goals
+- Offer managed services as an optional add-on per site.
+- Keep core SaaS plans unchanged while enabling add-on selection at pricing, signup, and billing.
+- Provide clear separation between **Core Plans** and **Managed Add-ons** in backend, frontend, and billing UI.
+
+---
+
+## Proposed Managed Add-on Tiers
+- **Managed Lite** — **$100/site/month**
+- **Managed Pro** — **$399/site/month**
+
+### Managed Features (shared)
+- Onboarding & setup: site integration, automation schedule, content settings.
+- Monthly SEO content plan: keyword import from library/clustering, topic strategy, content calendar.
+- Content QA & optimization: review queue checks, SEO meta validation, internal link suggestions.
+- Publishing ops: scheduled publishing, status monitoring, retry/failure handling.
+- Reporting: monthly performance + usage summary (credits, content velocity, publishing outcomes).
+- Support & tuning: strategy optimization/tweaks, automation adjustments, issue triage.
+
+### Pro extras
+- Proactive monitoring and escalation.
+- Priority response.
+- Expanded strategy iteration (more frequent adjustments).
+
+---
+
+## Marketing Site (https://igny8.com/pricing)
+
+### Layout changes
+1. **Keep Core Plans section unchanged**.
+2. Add a **big + icon** directly below the pricing table.
+3. Add **one single horizontal card** for Managed Add-on:
+ - Visible badge: **COMING SOON**
+ - Card title: “Managed Add-on (Per Site)”
+ - Short summary of major features (1 line)
+ - **Toggle switch** inside the card for **Managed Lite / Managed Pro**
+ - Show price per site for the selected toggle
+4. No other sections or FAQs added.
+
+### Suggested UX copy
+- “Managed Add-on (Per Site) — Coming Soon”
+- “Choose Lite or Pro”
+
+---
+
+## Signup Page (https://app.igny8.com/signup)
+
+### Layout changes
+Add **Step 2: Managed Add-ons (Optional)** after plan selection.
+- Toggle per site: “Add managed services to selected site(s)”
+- If user selects a plan with multiple sites:
+ - Show checkboxes for each site slot.
+ - Default: none selected.
+- Inline price calculator:
+ - “Managed Lite x N sites = $X/mo”
+ - “Managed Pro x N sites = $X/mo”
+
+### UX notes
+- Keep signup friction low.
+- If user skips add-on, allow adding later from Billing.
+
+---
+
+## App Billing & Plans (Account → Plans & Billing)
+
+### New UI sections
+1. **Current Plan** remains unchanged.
+2. Add **“Managed Add-ons”** section:
+ - Show current add-on tier (if any) and assigned sites.
+ - Show monthly add-on price and next renewal date.
+3. Add **“Upgrade Add-ons”** tab or sub-panel:
+ - Choose Managed Lite/Pro.
+ - Assign to site(s).
+ - Update monthly total.
+
+### Existing users
+- If a user already subscribed to a managed add-on:
+ - Display in **Plan** tab summary.
+ - Include in billing history and invoice breakdown.
+
+---
+
+## Backend Model Changes
+
+### Option A (Minimal changes in Plan model)
+Add fields to `Plan`:
+- `plan_type` (choices: `core`, `managed`) — distinguishes SaaS vs add-on.
+- `per_site` (bool, default false) — marks managed add-ons.
+- `managed_tier` (optional slug: `lite`, `pro`).
+
+Add optional relation to `Account` or `Site`:
+- New model `SiteManagementAddon`:
+ - `site` (FK)
+ - `plan` (FK to Plan where `plan_type=managed`)
+ - `status`, `current_period_start`, `current_period_end`
+ - `external_subscription_id`
+
+### Option B (Separate ManagedPlan model)
+Create `ManagedPlan` model (clone of Plan fields needed for pricing + name).
+Keep `Plan` for core SaaS only.
+
+**Recommendation:** Option A (fewer tables, uses existing pricing pipeline).
+
+---
+
+## Backend Billing Logic
+- Managed add-ons are **per site**.
+- Create separate Stripe subscription items per site, or a single subscription with quantity = number of managed sites.
+- Billing summary should show:
+ - Core plan price
+ - Managed add-on subtotal (N sites x price)
+ - Total monthly
+
+---
+
+## Frontend Data Contracts
+
+### API additions
+- `GET /api/v1/auth/plans/?type=core` (core plans only)
+- `GET /api/v1/auth/plans/?type=managed` (managed add-ons)
+- `GET /api/v1/account/managed-addons/` (current user add-ons + site assignments)
+- `POST /api/v1/account/managed-addons/` (assign add-on to site(s))
+- `PUT /api/v1/account/managed-addons/{id}/` (upgrade/downgrade add-on tier)
+
+---
+
+## Pricing Copy (Core Plans)
+Suggested renames to keep consistency:
+- Starter → **Launch**
+- Growth → **Growth** (keep)
+- Scale → **Scale** (keep)
+
+---
+
+## Rollout Checklist
+- Add plan_type + per_site fields + migration.
+- Add managed add-on seed data (Lite/Pro).
+- Add managed add-on endpoints + serializer filtering.
+- Update pricing page layout (marketing).
+- Update signup flow (managed add-on step).
+- Update billing page (Managed Add-ons section).
+- Update invoices to show core + managed breakdown.
diff --git a/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/MODELS.md b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/MODELS.md
new file mode 100644
index 00000000..2f1a0a3a
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/MODELS.md
@@ -0,0 +1,851 @@
+# Database Models Reference
+
+**Last Verified:** January 20, 2026
+**Version:** 1.8.4
+**Total Models:** 52+
+
+---
+
+## Data Scoping Overview
+
+| Scope | Models | Base Class | Filter By |
+|-------|--------|------------|-----------|
+| **Global** | `IntegrationProvider`, `AIModelConfig`, `SystemAISettings`, `GlobalAIPrompt`, `GlobalAuthorProfile`, `GlobalStrategy`, `GlobalModuleSettings`, `Industry`, `IndustrySector`, `SeedKeyword` | `models.Model` | None (platform-wide) |
+| **Account** | `Account`, `User`, `Plan`, `Subscription`, `AccountSettings`, `ModuleEnableSettings`, `AISettings`, `AIPrompt`, `AuthorProfile`, `CreditBalance`, `PasswordResetToken` | `AccountBaseModel` | `account` |
+| **Site** | `Site`, `PublishingSettings`, `AutomationConfig`, `DefaultAutomationConfig`, `AutomationRun`, `SiteIntegration`, `SiteUserAccess` | `AccountBaseModel` | `account`, `site` |
+| **Site+Sector** | `Keywords`, `Clusters`, `ContentIdeas`, `Tasks`, `Content`, `Images`, `ContentTaxonomyRelation` | `SiteSectorBaseModel` | `site`, `sector` |
+| **Billing** | `CreditCostConfig`, `BillingConfiguration`, `CreditPackage`, `PaymentMethodConfig`, `WebhookEvent` | `models.Model` | varies |
+| **System** | `SystemSettings`, `UserSettings`, `EmailSettings`, `EmailTemplate`, `EmailLog` | `models.Model` | varies |
+| **Plugins** | `Plugin`, `PluginVersion`, `PluginInstallation`, `PluginDownload` | `models.Model` | varies |
+
+---
+
+## Model Count by Location
+
+| Location | Count | Models |
+|----------|-------|--------|
+| `auth/models.py` | 10 | Account, User, Plan, Subscription, Industry, IndustrySector, SeedKeyword, Site, SiteUserAccess, PasswordResetToken |
+| `modules/system/` | 10 | IntegrationProvider, SystemAISettings, SystemSettings, UserSettings, EmailSettings, EmailTemplate, EmailLog, GlobalAIPrompt, GlobalAuthorProfile, GlobalStrategy |
+| `business/automation/` | 3 | DefaultAutomationConfig, AutomationConfig, AutomationRun |
+| `business/billing/` | 6 | CreditCostConfig, BillingConfiguration, CreditPackage, PaymentMethodConfig, AIModelConfig, WebhookEvent |
+| `business/content/` | 1 | ContentTaxonomyRelation |
+| `plugins/` | 4 | Plugin, PluginVersion, PluginInstallation, PluginDownload |
+| `modules/planner/` | 3 | Keywords, Clusters, ContentIdeas |
+| `modules/writer/` | 3 | Tasks, Content, Images |
+
+---
+
+## System Models (v1.4.0+) (`igny8_core/modules/system/`)
+
+**Purpose:** Centralized AI configuration, provider API keys, and system-wide defaults.
+
+### IntegrationProvider (NEW v1.4.0)
+
+Centralized storage for ALL external service API keys. Admin-only.
+
+```python
+class IntegrationProvider(models.Model):
+ """Per final-model-schemas.md - Centralized API key storage"""
+ provider_id = CharField(max_length=50, primary_key=True) # openai, runware, stripe, etc.
+ display_name = CharField(max_length=100)
+ provider_type = CharField(max_length=20) # ai, payment, email, storage
+
+ # Authentication
+ api_key = CharField(max_length=500, blank=True)
+ api_secret = CharField(max_length=500, blank=True)
+ webhook_secret = CharField(max_length=500, blank=True)
+ api_endpoint = URLField(blank=True)
+
+ # Configuration
+ config = JSONField(default=dict)
+ is_active = BooleanField(default=True)
+ is_sandbox = BooleanField(default=False)
+
+ # Audit
+ updated_by = ForeignKey(User, null=True)
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+**Seeded Providers:**
+- `openai` - AI (text + DALL-E)
+- `runware` - AI (images)
+- `anthropic` - AI (future)
+- `stripe` - Payment
+- `paypal` - Payment
+- `resend` - Email
+
+**Helper Methods:**
+- `IntegrationProvider.get_provider(provider_id)` - Get active provider
+- `IntegrationProvider.get_api_key(provider_id)` - Get API key for provider
+- `IntegrationProvider.get_providers_by_type(type)` - List providers by type
+
+---
+
+### AIModelConfig (NEW v1.4.0)
+
+Single Source of Truth for all AI models with pricing and credit configuration.
+
+```python
+class AIModelConfig(models.Model):
+ """Per final-model-schemas.md - Model definitions + pricing"""
+ model_name = CharField(max_length=100, unique=True) # gpt-4o-mini, dall-e-3, runware:97@1
+ model_type = CharField(max_length=20) # text, image
+ provider = CharField(max_length=50) # Links to IntegrationProvider
+ display_name = CharField(max_length=200)
+
+ is_default = BooleanField(default=False) # One default per type
+ is_active = BooleanField(default=True)
+
+ # Text Model Pricing (per 1K tokens)
+ cost_per_1k_input = DecimalField(max_digits=10, decimal_places=6, null=True)
+ cost_per_1k_output = DecimalField(max_digits=10, decimal_places=6, null=True)
+ tokens_per_credit = IntegerField(null=True) # e.g., 1000, 10000
+
+ # Image Model Pricing
+ credits_per_image = IntegerField(null=True) # e.g., 1, 5, 15
+ quality_tier = CharField(max_length=20, null=True) # basic, quality, premium
+
+ # Model Limits
+ max_tokens = IntegerField(null=True)
+ context_window = IntegerField(null=True)
+ capabilities = JSONField(default=dict) # vision, function_calling, etc.
+
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+**Credit Configuration Examples:**
+
+| Model | Type | tokens_per_credit | credits_per_image | quality_tier |
+|-------|------|-------------------|-------------------|--------------|
+| gpt-4o | text | 1000 | - | - |
+| gpt-4o-mini | text | 10000 | - | - |
+| runware:97@1 | image | - | 1 | basic |
+| dall-e-3 | image | - | 5 | quality |
+| google:4@2 | image | - | 15 | premium |
+
+**Image Model Reference (v1.5.0 Planned):**
+
+| Model | AIR ID | Tier | Supported Dimensions |
+|-------|--------|------|---------------------|
+| Hi Dream Full | `runware:97@1` | Basic | 1024×1024, 1280×768 |
+| Bria 3.2 | `bria:10@1` | Quality | 1024×1024, 1344×768 |
+| Nano Banana | `google:4@2` | Premium | 1024×1024, 1376×768 |
+
+**Helper Methods:**
+- `AIModelConfig.get_default_text_model()` - Get default text model
+- `AIModelConfig.get_default_image_model()` - Get default image model
+- `AIModelConfig.get_image_models_by_tier()` - List image models by quality tier
+
+---
+
+### SystemAISettings (NEW v1.4.0)
+
+System-wide AI defaults. Singleton (pk=1).
+
+```python
+class SystemAISettings(models.Model):
+ """Per final-model-schemas.md - Renamed from GlobalIntegrationSettings"""
+ # AI Parameters
+ temperature = FloatField(default=0.7) # 0.0-2.0
+ max_tokens = IntegerField(default=8192)
+
+ # Image Generation Settings
+ image_style = CharField(max_length=30, default='photorealistic')
+ image_quality = CharField(max_length=20, default='standard') # standard, hd
+ max_images_per_article = IntegerField(default=4) # 1-8
+ image_size = CharField(max_length=20, default='1024x1024')
+
+ # Audit
+ updated_by = ForeignKey(User, null=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+**Image Style Choices:**
+- `photorealistic` - Ultra realistic photography
+- `illustration` - Digital illustration
+- `3d_render` - Computer generated 3D
+- `minimal_flat` - Minimal / Flat Design
+- `artistic` - Artistic / Painterly
+- `cartoon` - Cartoon / Stylized
+
+**Image Size Choices:**
+- `1024x1024` - Square
+- `1792x1024` - Landscape
+- `1024x1792` - Portrait
+
+**Helper Methods:**
+- `SystemAISettings.get_instance()` - Get singleton instance
+- `SystemAISettings.get_effective_temperature(account)` - Get with account override
+- `SystemAISettings.get_effective_image_style(account)` - Get with account override
+
+---
+
+### AccountSettings (Per-Account Overrides)
+
+Generic key-value store for account-specific settings.
+
+```python
+class AccountSettings(AccountBaseModel):
+ """Per final-model-schemas.md - Account overrides"""
+ key = CharField(max_length=100) # Setting key
+ value = JSONField(default=dict) # Setting value
+
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+**AI-Related Keys** (override SystemAISettings defaults):
+
+| Key | Type | Example | Notes |
+|-----|------|---------|-------|
+| `ai.temperature` | float | 0.8 | Override system default |
+| `ai.max_tokens` | int | 8192 | Override system default |
+| `ai.image_style` | string | "illustration" | Override system default |
+| `ai.image_quality` | string | "hd" | Override system default |
+| `ai.max_images` | int | 6 | Override system default |
+| `ai.image_quality_tier` | string | "premium" | User's preferred tier |
+
+---
+
+### CreditCostConfig (Operation-Level Pricing)
+
+Fixed credit costs per operation type.
+
+```python
+class CreditCostConfig(models.Model):
+ """Per final-model-schemas.md - Operation pricing"""
+ operation_type = CharField(max_length=50, primary_key=True) # Unique operation ID
+ display_name = CharField(max_length=100)
+ base_credits = IntegerField(default=1) # Fixed credits per operation
+ is_active = BooleanField(default=True)
+ description = TextField(blank=True)
+```
+
+**Note:** `tokens_per_credit` moved to AIModelConfig as of v1.4.0.
+
+---
+
+## DEPRECATED Models
+
+### GlobalIntegrationSettings (DEPRECATED in v1.4.0)
+
+**Replaced by:** `IntegrationProvider` (API keys) + `AIModelConfig` (model configs) + `SystemAISettings` (defaults)
+
+```python
+# DEPRECATED - Do not use
+class GlobalIntegrationSettings(models.Model):
+ # API keys now in IntegrationProvider
+ openai_api_key = CharField(max_length=500) # → IntegrationProvider.get_api_key('openai')
+ runware_api_key = CharField(max_length=500) # → IntegrationProvider.get_api_key('runware')
+
+ # Models now in AIModelConfig
+ openai_model = CharField(default='gpt-4o-mini') # → AIModelConfig.is_default
+
+ # Settings now in SystemAISettings
+ openai_temperature = FloatField(default=0.7) # → SystemAISettings.temperature
+ openai_max_tokens = IntegerField(default=8192) # → SystemAISettings.max_tokens
+```
+
+---
+
+### GlobalAIPrompt
+
+```python
+class GlobalAIPrompt(models.Model):
+ prompt_type = CharField(max_length=100) # clustering, ideas, content_generation
+ prompt_value = TextField()
+ variables = JSONField(default=list)
+ is_active = BooleanField(default=True)
+```
+
+### GlobalAuthorProfile
+
+```python
+class GlobalAuthorProfile(models.Model):
+ name = CharField(max_length=255)
+ tone = CharField(max_length=50) # professional, casual, technical
+ language = CharField(max_length=10, default='en')
+ is_active = BooleanField(default=True)
+```
+
+---
+
+## Auth Models (`igny8_core/auth/models/`)
+
+### User
+
+```python
+class User(AbstractBaseUser, PermissionsMixin):
+ id = UUIDField(primary_key=True)
+ email = EmailField(unique=True)
+ first_name = CharField(max_length=150)
+ last_name = CharField(max_length=150)
+
+ account = ForeignKey(Account, related_name='users')
+ role = ForeignKey(Group, null=True)
+
+ is_active = BooleanField(default=True)
+ is_staff = BooleanField(default=False)
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+**Relations:** Account (many-to-one)
+
+---
+
+### Account
+
+```python
+class Account(models.Model):
+ id = UUIDField(primary_key=True)
+ name = CharField(max_length=255)
+
+ plan = ForeignKey(Plan, null=True)
+ owner = ForeignKey(User, related_name='owned_accounts')
+
+ is_active = BooleanField(default=True)
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+**Relations:** Plan (many-to-one), Users (one-to-many), Sites (one-to-many)
+
+---
+
+### Site
+
+```python
+class Site(models.Model):
+ id = UUIDField(primary_key=True)
+ name = CharField(max_length=255)
+ domain = CharField(max_length=255, blank=True)
+
+ account = ForeignKey(Account, related_name='sites')
+ industry = ForeignKey(Industry, null=True)
+
+ is_active = BooleanField(default=True)
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+**Relations:** Account (many-to-one), Sectors (one-to-many), Industries (many-to-one)
+
+---
+
+### Sector
+
+```python
+class Sector(models.Model):
+ id = UUIDField(primary_key=True)
+ name = CharField(max_length=255)
+ description = TextField(blank=True)
+
+ site = ForeignKey(Site, related_name='sectors')
+
+ is_active = BooleanField(default=True)
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+**Relations:** Site (many-to-one)
+
+---
+
+### Industry
+
+```python
+class Industry(models.Model):
+ id = UUIDField(primary_key=True)
+ name = CharField(max_length=255)
+ description = TextField(blank=True)
+```
+
+**Used for:** Default seed keywords, industry-specific prompts
+
+---
+
+## Planner Models (`igny8_core/modules/planner/models.py`)
+
+### Keyword
+
+```python
+class Keyword(models.Model):
+ id = UUIDField(primary_key=True)
+ keyword = CharField(max_length=255)
+
+ site = ForeignKey(Site, related_name='keywords')
+ sector = ForeignKey(Sector, null=True, related_name='keywords')
+ cluster = ForeignKey(Cluster, null=True, related_name='keywords')
+
+ search_volume = IntegerField(null=True)
+ difficulty = IntegerField(null=True)
+ cpc = DecimalField(null=True)
+
+ status = CharField(choices=KEYWORD_STATUS) # new, mapped
+
+ created_by = ForeignKey(User)
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+**Status Values:**
+- `new` - Ready for clustering
+- `mapped` - Assigned to a cluster
+
+---
+
+### Cluster
+
+```python
+class Cluster(models.Model):
+ id = UUIDField(primary_key=True)
+ name = CharField(max_length=255)
+ description = TextField(blank=True)
+
+ site = ForeignKey(Site, related_name='clusters')
+ sector = ForeignKey(Sector, null=True, related_name='clusters')
+
+ created_by = ForeignKey(User)
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+**Relations:** Site, Sector, Keywords (one-to-many), ContentIdeas (one-to-many)
+
+---
+
+### ContentIdea
+
+```python
+class ContentIdea(models.Model):
+ id = UUIDField(primary_key=True)
+ title = CharField(max_length=255)
+ description = TextField(blank=True)
+
+ site = ForeignKey(Site, related_name='ideas')
+ sector = ForeignKey(Sector, null=True)
+ cluster = ForeignKey(Cluster, related_name='ideas')
+
+ primary_keyword = ForeignKey(Keyword, related_name='primary_ideas')
+ secondary_keywords = ManyToManyField(Keyword, related_name='secondary_ideas')
+
+ status = CharField(choices=IDEA_STATUS) # pending, approved, used, archived
+
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+---
+
+## Writer Models (`igny8_core/modules/writer/models.py`)
+
+### Task
+
+```python
+class Task(models.Model):
+ id = UUIDField(primary_key=True)
+ title = CharField(max_length=255)
+ brief = TextField(blank=True)
+
+ site = ForeignKey(Site, related_name='tasks')
+ sector = ForeignKey(Sector, null=True)
+ idea = ForeignKey(ContentIdea, null=True, related_name='tasks')
+
+ primary_keyword = CharField(max_length=255)
+ secondary_keywords = JSONField(default=list)
+
+ status = CharField(choices=TASK_STATUS) # queued, completed
+
+ assigned_to = ForeignKey(User, null=True)
+ due_date = DateField(null=True)
+
+ created_by = ForeignKey(User)
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+---
+
+### Content
+
+```python
+class Content(models.Model):
+ id = UUIDField(primary_key=True)
+ title = CharField(max_length=255)
+ body = TextField() # HTML content
+ excerpt = TextField(blank=True)
+
+ site = ForeignKey(Site, related_name='content')
+ sector = ForeignKey(Sector, null=True)
+ task = ForeignKey(Task, related_name='content')
+
+ meta_title = CharField(max_length=255, blank=True)
+ meta_description = TextField(blank=True)
+
+ # Workflow status
+ status = CharField(choices=CONTENT_STATUS) # draft, review, approved, published
+
+ # Publishing status (v1.3.2)
+ site_status = CharField(choices=SITE_STATUS) # not_published, scheduled, publishing, published, failed
+ scheduled_publish_at = DateTimeField(null=True)
+ site_status_updated_at = DateTimeField(null=True)
+
+ # External site reference
+ external_id = CharField(max_length=255, blank=True) # WordPress post ID
+ external_url = URLField(blank=True) # Published URL
+
+ word_count = IntegerField(default=0)
+
+ created_by = ForeignKey(User)
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+**Workflow Status Values (status):**
+- `draft` - Initial state after generation
+- `review` - Pending human review
+- `approved` - Ready for publishing (v1.3.2: NEW status)
+- `published` - Published to WordPress
+
+**Publishing Status Values (site_status) - v1.3.2:**
+- `not_published` - Not yet scheduled for external site
+- `scheduled` - Scheduled for future publishing
+- `publishing` - Currently being published
+- `published` - Successfully published to external site
+- `failed` - Publishing failed
+
+---
+
+### ContentImage
+
+```python
+class ContentImage(models.Model):
+ id = UUIDField(primary_key=True)
+ content = ForeignKey(Content, related_name='images')
+
+ url = URLField()
+ thumbnail_url = URLField(blank=True)
+ alt_text = CharField(max_length=255)
+ caption = TextField(blank=True)
+
+ is_featured = BooleanField(default=False)
+ position = IntegerField(default=0)
+
+ # AI generation metadata
+ prompt = TextField(blank=True)
+ provider = CharField(max_length=50) # dalle, runware
+
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+---
+
+## Integration Models (`igny8_core/business/integration/models.py`)
+
+### SiteIntegration
+
+**⚠️ Note:** For WordPress, `Site.wp_api_key` is the **SINGLE source of truth** for API authentication. SiteIntegration is used for sync tracking and future multi-platform support.
+
+```python
+class SiteIntegration(models.Model):
+ id = UUIDField(primary_key=True)
+ name = CharField(max_length=255)
+
+ site = ForeignKey(Site, related_name='integrations')
+ platform = CharField(max_length=50) # wordpress, shopify (future)
+
+ # Configuration
+ external_site_url = URLField()
+ config_json = JSONField(default=dict) # Platform-specific settings
+ credentials_json = JSONField(default=dict) # Reserved for future platforms (NOT for WordPress)
+
+ # Sync Tracking
+ sync_enabled = BooleanField(default=True)
+ sync_status = CharField(max_length=50) # pending/syncing/completed/error
+ last_sync_at = DateTimeField(null=True)
+ sync_error = TextField(null=True)
+
+ # Connection
+ connection_status = CharField(max_length=50) # connected/error
+ is_active = BooleanField(default=True)
+
+ # Cached WordPress structure (from initial sync)
+ categories = JSONField(default=list)
+ tags = JSONField(default=list)
+ authors = JSONField(default=list)
+ post_types = JSONField(default=list)
+ structure_updated_at = DateTimeField(null=True)
+
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+---
+
+### PublishingSettings (NEW v1.3.2)
+
+```python
+class PublishingSettings(AccountBaseModel):
+ """Site-level publishing configuration. Controls auto-approval, publishing limits, and scheduling."""
+
+ site = OneToOneField(Site, related_name='publishing_settings')
+
+ # Auto-approval settings
+ auto_approval_enabled = BooleanField(default=True)
+
+ # Auto-publish settings
+ auto_publish_enabled = BooleanField(default=True)
+
+ # Publishing limits
+ daily_publish_limit = PositiveIntegerField(default=3)
+ weekly_publish_limit = PositiveIntegerField(default=15)
+ monthly_publish_limit = PositiveIntegerField(default=50)
+
+ # Publishing schedule
+ publish_days = JSONField(default=['mon', 'tue', 'wed', 'thu', 'fri'])
+ publish_time_slots = JSONField(default=['09:00', '14:00', '18:00'])
+
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+**Default Values:**
+- `auto_approval_enabled`: True (auto-approve after review)
+- `auto_publish_enabled`: True (auto-publish approved content)
+- `daily_publish_limit`: 3 articles per day
+- `weekly_publish_limit`: 15 articles per week
+- `monthly_publish_limit`: 50 articles per month
+- `publish_days`: Monday through Friday
+- `publish_time_slots`: 9:00 AM, 2:00 PM, 6:00 PM
+
+**Usage:**
+```python
+# Get or create with defaults
+settings, created = PublishingSettings.get_or_create_for_site(site)
+```
+
+---
+
+## Billing Models (`igny8_core/business/billing/models.py`)
+
+### Plan
+
+```python
+class Plan(models.Model):
+ id = UUIDField(primary_key=True)
+ name = CharField(max_length=100)
+ slug = SlugField(unique=True)
+
+ idea_credits = IntegerField(default=0)
+ content_credits = IntegerField(default=0)
+ image_credits = IntegerField(default=0)
+ optimization_credits = IntegerField(default=0)
+
+ max_sites = IntegerField(default=1)
+ max_users = IntegerField(default=1)
+
+ price_monthly = DecimalField(max_digits=10, decimal_places=2)
+ price_yearly = DecimalField(max_digits=10, decimal_places=2)
+
+ is_active = BooleanField(default=True)
+ is_internal = BooleanField(default=False)
+```
+
+---
+
+### CreditBalance
+
+```python
+class CreditBalance(models.Model):
+ account = ForeignKey(Account, related_name='credit_balances')
+ site = ForeignKey(Site, null=True, related_name='credit_balances')
+
+ idea_credits = IntegerField(default=0)
+ content_credits = IntegerField(default=0)
+ image_credits = IntegerField(default=0)
+ optimization_credits = IntegerField(default=0)
+
+ period_start = DateField()
+ period_end = DateField()
+
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+---
+
+### CreditUsage
+
+```python
+class CreditUsage(models.Model):
+ account = ForeignKey(Account, related_name='credit_usage')
+ site = ForeignKey(Site, null=True)
+ user = ForeignKey(User)
+
+ credit_type = CharField(max_length=50) # idea, content, image, optimization
+ amount = IntegerField()
+ operation = CharField(max_length=100) # generate_content, etc.
+
+ related_content_type = ForeignKey(ContentType, null=True)
+ related_object_id = UUIDField(null=True)
+
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+---
+
+## System Models (`igny8_core/modules/system/`)
+
+### ModuleEnableSettings
+
+```python
+class ModuleEnableSettings(models.Model):
+ account = OneToOneField(Account, primary_key=True)
+
+ planner_enabled = BooleanField(default=True)
+ writer_enabled = BooleanField(default=True)
+ linker_enabled = BooleanField(default=False)
+ optimizer_enabled = BooleanField(default=False)
+ automation_enabled = BooleanField(default=True)
+ integration_enabled = BooleanField(default=True)
+ publisher_enabled = BooleanField(default=True)
+```
+
+---
+
+### AIIntegrationSettings
+
+```python
+class AIIntegrationSettings(models.Model):
+ account = ForeignKey(Account, related_name='ai_settings')
+
+ # OpenAI
+ openai_api_key = CharField(max_length=255, blank=True)
+ openai_model = CharField(max_length=50, default='gpt-4')
+
+ # Image generation
+ image_provider = CharField(max_length=50, default='dalle') # dalle, runware
+ dalle_api_key = CharField(max_length=255, blank=True)
+ runware_api_key = CharField(max_length=255, blank=True)
+
+ is_validated = BooleanField(default=False)
+ validated_at = DateTimeField(null=True)
+```
+
+---
+
+### PromptTemplate
+
+```python
+class PromptTemplate(models.Model):
+ account = ForeignKey(Account, null=True) # null = system default
+
+ prompt_type = CharField(max_length=100) # auto_cluster, generate_ideas, etc.
+ template = TextField()
+ variables = JSONField(default=list)
+
+ is_active = BooleanField(default=True)
+
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+```
+
+---
+
+## Publisher Models (`igny8_core/modules/publisher/models.py`)
+
+### PublishingRecord
+
+```python
+class PublishingRecord(models.Model):
+ id = UUIDField(primary_key=True)
+ content = ForeignKey(Content, related_name='publishing_records')
+ integration = ForeignKey(SiteIntegration, related_name='publishing_records')
+
+ external_id = CharField(max_length=255) # WordPress post ID
+ external_url = URLField(blank=True)
+
+ status = CharField(max_length=50) # pending, published, failed
+
+ published_at = DateTimeField(null=True)
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+---
+
+## Automation Models (`igny8_core/modules/automation/models.py`)
+
+### AutomationConfig
+
+```python
+class AutomationConfig(models.Model):
+ site = ForeignKey(Site, related_name='automation_configs')
+
+ # Stage limits
+ clustering_limit = IntegerField(default=10)
+ ideas_limit = IntegerField(default=10)
+ content_limit = IntegerField(default=5)
+ image_limit = IntegerField(default=10)
+ publish_limit = IntegerField(default=5)
+
+ # Timing
+ delay_between_operations = IntegerField(default=5) # seconds
+ max_runtime = IntegerField(default=3600) # 1 hour
+
+ # Behavior
+ auto_approve = BooleanField(default=False)
+ auto_publish = BooleanField(default=False)
+ stop_on_error = BooleanField(default=True)
+
+ is_active = BooleanField(default=True)
+```
+
+---
+
+### AutomationRun
+
+```python
+class AutomationRun(models.Model):
+ id = UUIDField(primary_key=True)
+ site = ForeignKey(Site, related_name='automation_runs')
+ config = ForeignKey(AutomationConfig)
+
+ status = CharField(max_length=50) # pending, running, paused, completed, failed, cancelled
+
+ # Progress tracking
+ current_stage = CharField(max_length=50, blank=True)
+ items_processed = IntegerField(default=0)
+ items_total = IntegerField(default=0)
+
+ # Timing
+ started_at = DateTimeField(null=True)
+ completed_at = DateTimeField(null=True)
+
+ # Results
+ error_message = TextField(blank=True)
+
+ started_by = ForeignKey(User)
+ created_at = DateTimeField(auto_now_add=True)
+```
+
+---
+
+## Entity Relationship Overview
+
+```
+Account
+├── Users (many)
+├── Sites (many)
+│ ├── Sectors (many)
+│ ├── Keywords (many)
+│ ├── Clusters (many)
+│ ├── ContentIdeas (many)
+│ ├── Tasks (many)
+│ ├── Content (many)
+│ │ └── ContentImages (many)
+│ ├── SiteIntegrations (many)
+│ │ └── PublishingRecords (many)
+│ └── AutomationConfigs (many)
+│ └── AutomationRuns (many)
+├── Plan (one)
+├── CreditBalances (many)
+├── CreditUsage (many)
+├── ModuleEnableSettings (one)
+├── AIIntegrationSettings (many)
+└── PromptTemplates (many)
+```
diff --git a/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/PAYMENT-SYSTEM.md b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/PAYMENT-SYSTEM.md
new file mode 100644
index 00000000..3cecaf91
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/PAYMENT-SYSTEM.md
@@ -0,0 +1,679 @@
+# Payment System Documentation
+
+> **Version:** 2.0.0
+> **Last Updated:** January 20, 2026
+> **Status:** Production Ready
+
+> **Complete Billing Reference:** For comprehensive billing documentation including the two-pool credit system and renewal workflows, see [BILLING-PAYMENTS-COMPLETE.md](../10-MODULES/BILLING-PAYMENTS-COMPLETE.md)
+
+This document provides payment gateway implementation details for IGNY8.
+
+---
+
+## Table of Contents
+
+1. [System Overview](#system-overview)
+2. [Payment Entry Points](#payment-entry-points)
+3. [Backend Architecture](#backend-architecture)
+4. [Frontend Architecture](#frontend-architecture)
+5. [Payment Flows](#payment-flows)
+6. [Country-Based Payment Rules](#country-based-payment-rules)
+7. [Webhook Processing](#webhook-processing)
+8. [Models Reference](#models-reference)
+9. [Security Features](#security-features)
+
+---
+
+## System Overview
+
+### Supported Payment Methods
+
+| Method | Type | Regions | Use Cases |
+|--------|------|---------|-----------|
+| **Stripe** | Credit/Debit Card | Global | Subscriptions, Credit packages |
+| **PayPal** | PayPal account | Global (except PK) | Subscriptions, Credit packages |
+| **Bank Transfer** | Manual | Pakistan (PK) | Subscriptions, Credit packages |
+
+### Payment Method Selection Logic
+
+```
+┌────────────────────────────────────────────────────────┐
+│ Country-Based Payment Rules │
+├────────────────────────────────────────────────────────┤
+│ │
+│ Global Users (non-PK): │
+│ ✅ Stripe (Credit/Debit Card) │
+│ ✅ PayPal │
+│ ❌ Bank Transfer (not available) │
+│ │
+│ Pakistan Users (PK): │
+│ ✅ Stripe (Credit/Debit Card) │
+│ ❌ PayPal (not available in PK) │
+│ ✅ Bank Transfer (manual) │
+│ │
+└────────────────────────────────────────────────────────┘
+```
+
+### Architecture Overview
+
+```
+┌─────────────────────────────────────────────────────────────────┐
+│ PAYMENT SYSTEM FLOW │
+├─────────────────────────────────────────────────────────────────┤
+│ │
+│ ┌──────────────┐ ┌──────────────┐ │
+│ │ Signup │───────▶ │ /account/ │ │
+│ │ (no pay) │ │ plans │ │
+│ └──────────────┘ └──────┬───────┘ │
+│ │ │
+│ ┌─────────────┴─────────────┐ │
+│ │ │ │
+│ New User? Existing User? │
+│ │ │ │
+│ ▼ ▼ │
+│ ┌──────────────┐ ┌──────────────┐ │
+│ │ PendingPay- │ │ Plans/Billing│ │
+│ │ mentView │ │ Dashboard │ │
+│ └──────┬───────┘ └──────┬───────┘ │
+│ │ │ │
+│ ┌─────────┼─────────┐ ┌────────┼────────┐ │
+│ │ │ │ │ │ │ │
+│ ▼ ▼ ▼ ▼ ▼ ▼ │
+│ Stripe PayPal Bank Upgrade Credits Manage │
+│ Transfer │
+│ │
+└─────────────────────────────────────────────────────────────────┘
+```
+
+---
+
+## Payment Entry Points
+
+### 1. Signup Flow
+
+**File:** `frontend/src/components/auth/SignUpFormUnified.tsx`
+
+**Simplified Signup (No Payment on Signup):**
+- User selects plan and provides details
+- Account created with `status='pending_payment'` for paid plans
+- User redirected to `/account/plans` to complete payment
+- No payment gateway redirect from signup page
+
+```typescript
+// Signup flow creates account only, no checkout
+const handleSignup = async (data) => {
+ const result = await register({
+ email, password, plan_slug, billing_country
+ });
+ // Redirect to plans page for payment
+ navigate('/account/plans');
+};
+```
+
+### 2. Plans & Billing Page
+
+**File:** `frontend/src/pages/account/PlansAndBillingPage.tsx`
+
+Central hub for all payment-related actions:
+
+**For New Users (pending_payment):**
+- Shows `PendingPaymentView` component
+- Full-page payment interface
+- Invoice details and payment method selection
+
+**For Existing Users:**
+- Current plan and subscription status
+- Credit balance and purchase
+- Invoice history and downloads
+- Subscription management
+
+### 3. PendingPaymentView Component
+
+**File:** `frontend/src/components/billing/PendingPaymentView.tsx`
+
+Full-page payment interface for new users:
+- Displays invoice details and plan info
+- Payment method selection based on country
+- Stripe/PayPal redirect or Bank Transfer form
+- Status checking for bank transfer submissions
+
+### 4. Bank Transfer Form
+
+**File:** `frontend/src/components/billing/BankTransferForm.tsx`
+
+Manual payment submission for Pakistan users:
+- Bank account details display
+- Transaction reference input
+- File upload for payment proof
+- Submission and status tracking
+
+---
+
+## Backend Architecture
+
+### Service Layer
+
+#### StripeService
+
+**File:** `backend/igny8_core/business/billing/services/stripe_service.py`
+
+| Method | Description |
+|--------|-------------|
+| `create_checkout_session()` | Create subscription checkout |
+| `create_credit_checkout_session()` | Create credit package checkout |
+| `create_billing_portal_session()` | Customer billing portal |
+| `get_or_create_customer()` | Stripe customer management |
+| `construct_webhook_event()` | Verify webhook signatures |
+
+#### PayPalService
+
+**File:** `backend/igny8_core/business/billing/services/paypal_service.py`
+
+| Method | Description |
+|--------|-------------|
+| `create_order()` | Create one-time payment order |
+| `create_subscription_order()` | Create subscription order |
+| `capture_order()` | Capture approved payment |
+| `verify_webhook_signature()` | Webhook verification |
+
+#### InvoiceService
+
+**File:** `backend/igny8_core/business/billing/services/invoice_service.py`
+
+| Method | Description |
+|--------|-------------|
+| `create_subscription_invoice()` | Invoice for plan subscription |
+| `create_credit_package_invoice()` | Invoice for credit purchase |
+| `mark_paid()` | Mark invoice as paid |
+| `generate_pdf()` | Generate PDF invoice |
+
+#### PaymentService
+
+**File:** `backend/igny8_core/business/billing/services/payment_service.py`
+
+| Method | Description |
+|--------|-------------|
+| `create_stripe_payment()` | Record Stripe payment |
+| `create_paypal_payment()` | Record PayPal payment |
+| `create_manual_payment()` | Record bank transfer |
+| `approve_manual_payment()` | Admin approval |
+
+### API Endpoints
+
+#### Stripe Endpoints
+
+| Endpoint | Method | Description |
+|----------|--------|-------------|
+| `/v1/billing/stripe/config/` | GET | Publishable key |
+| `/v1/billing/stripe/checkout/` | POST | Create checkout session |
+| `/v1/billing/stripe/credit-checkout/` | POST | Credit package checkout |
+| `/v1/billing/stripe/billing-portal/` | POST | Billing portal |
+| `/v1/billing/webhooks/stripe/` | POST | Webhook handler |
+
+#### PayPal Endpoints
+
+| Endpoint | Method | Description |
+|----------|--------|-------------|
+| `/v1/billing/paypal/config/` | GET | Client ID |
+| `/v1/billing/paypal/create-order/` | POST | Credit package order |
+| `/v1/billing/paypal/create-subscription-order/` | POST | Subscription order |
+| `/v1/billing/paypal/capture-order/` | POST | Capture payment |
+| `/v1/billing/webhooks/paypal/` | POST | Webhook handler |
+
+#### Invoice Endpoints
+
+| Endpoint | Method | Description |
+|----------|--------|-------------|
+| `/v1/billing/invoices/` | GET | List invoices |
+| `/v1/billing/invoices/{id}/` | GET | Invoice detail |
+| `/v1/billing/invoices/{id}/download_pdf/` | GET | Download PDF |
+
+#### Payment Endpoints
+
+| Endpoint | Method | Description |
+|----------|--------|-------------|
+| `/v1/billing/payments/` | GET | List payments |
+| `/v1/billing/payments/manual/` | POST | Submit bank transfer |
+| `/v1/billing/admin/payments/confirm/` | POST | Admin approve/reject |
+
+---
+
+## Frontend Architecture
+
+### Services
+
+**File:** `frontend/src/services/billing.api.ts`
+
+Key functions:
+
+```typescript
+// Gateway availability (country-based)
+getAvailablePaymentGateways(userCountry?: string)
+
+// Subscription helpers
+subscribeToPlan(planId, gateway, options)
+purchaseCredits(packageId, gateway, options)
+
+// Stripe functions
+createStripeCheckout(planId, options)
+createStripeCreditCheckout(packageId, options)
+openStripeBillingPortal(returnUrl)
+
+// PayPal functions
+createPayPalSubscriptionOrder(planId, options)
+createPayPalCreditOrder(packageId, options)
+capturePayPalOrder(orderId, metadata)
+
+// Manual payment
+submitManualPayment(invoiceId, data)
+```
+
+### Components
+
+| Component | File | Purpose |
+|-----------|------|---------|
+| `PendingPaymentView` | `/components/billing/PendingPaymentView.tsx` | New user payment |
+| `BankTransferForm` | `/components/billing/BankTransferForm.tsx` | Bank transfer submission |
+| `PendingPaymentBanner` | `/components/billing/PendingPaymentBanner.tsx` | Alert for pending payments |
+| `PaymentGatewaySelector` | `/components/billing/PaymentGatewaySelector.tsx` | Gateway selection UI |
+| `PayInvoiceModal` | `/components/billing/PayInvoiceModal.tsx` | Pay invoice modal |
+
+---
+
+## Payment Flows
+
+### Flow 1: New User Signup with Stripe
+
+```
+1. User submits signup form with plan
+2. Backend creates:
+ - User account
+ - Account (status='pending_payment')
+ - Subscription (status='pending_payment')
+ - Invoice (status='pending')
+3. User redirected to /account/plans
+4. PendingPaymentView displays
+5. User selects Stripe, clicks Pay
+6. Redirect to Stripe Checkout
+7. User completes payment
+8. Stripe webhook received:
+ - Payment recorded
+ - Invoice marked paid
+ - Account activated
+ - Credits added
+9. User redirected back to /account/plans
+10. Success message, dashboard displays
+```
+
+### Flow 2: New User with PayPal (Non-PK)
+
+```
+1. Same as Stripe steps 1-4
+5. User selects PayPal, clicks Pay
+6. PayPal order created
+7. Redirect to PayPal approval
+8. User approves on PayPal
+9. Redirect back with order_id
+10. Frontend calls capture-order
+11. Backend processes:
+ - Payment captured
+ - Payment recorded
+ - Invoice marked paid
+ - Account activated
+ - Credits added
+12. Success displayed
+```
+
+### Flow 3: Pakistan User with Bank Transfer
+
+```
+1. Same as signup steps 1-4
+5. User sees Stripe + Bank Transfer options
+6. User selects Bank Transfer
+7. BankTransferForm displays:
+ - Bank details (SCB Pakistan)
+ - Reference input
+ - Proof upload option
+8. User makes transfer, submits form
+9. Backend creates:
+ - Payment (status='pending_approval')
+10. User sees "Awaiting Approval" status
+11. Admin reviews in Django Admin
+12. Admin approves:
+ - Payment marked succeeded
+ - Invoice marked paid
+ - Account activated
+ - Credits added
+13. User receives email confirmation
+```
+
+### Flow 4: Existing User Buys Credits
+
+```
+1. User on /account/plans clicks "Buy Credits"
+2. Credit package selection modal
+3. User selects package and gateway
+4. For Stripe/PayPal: redirect flow
+5. For Bank Transfer: form submission
+6. On success: credits added to account
+```
+
+---
+
+## Country-Based Payment Rules
+
+### Implementation in Frontend
+
+```typescript
+// billing.api.ts
+export async function getAvailablePaymentGateways(userCountry?: string) {
+ const [stripeAvailable, paypalAvailable] = await Promise.all([
+ isStripeConfigured(),
+ isPayPalConfigured(),
+ ]);
+
+ const isPakistan = userCountry?.toUpperCase() === 'PK';
+
+ return {
+ stripe: stripeAvailable,
+ // PayPal: NOT available for Pakistan
+ paypal: !isPakistan && paypalAvailable,
+ // Bank Transfer: ONLY for Pakistan
+ manual: isPakistan,
+ };
+}
+```
+
+### Usage in Components
+
+```typescript
+// PendingPaymentView.tsx
+const isPakistan = userCountry === 'PK';
+
+// Load gateways with country filter
+const gateways = await getAvailablePaymentGateways(userCountry);
+
+// Show appropriate options
+const paymentOptions = [
+ { type: 'stripe', ... }, // Always shown if configured
+ isPakistan ? { type: 'manual', ... } : { type: 'paypal', ... },
+];
+```
+
+---
+
+## Webhook Processing
+
+### Stripe Webhooks
+
+**Endpoint:** `POST /v1/billing/webhooks/stripe/`
+
+| Event | Handler Action |
+|-------|----------------|
+| `checkout.session.completed` | Activate subscription, add credits |
+| `invoice.paid` | Add renewal credits |
+| `invoice.payment_failed` | Send notification |
+| `customer.subscription.updated` | Sync changes |
+| `customer.subscription.deleted` | Cancel subscription |
+
+**Idempotency:** Checks `WebhookEvent` model before processing:
+```python
+# Check if already processed
+if WebhookEvent.objects.filter(
+ provider='stripe',
+ event_id=event_id,
+ status='processed'
+).exists():
+ return # Already handled
+```
+
+### PayPal Webhooks
+
+**Endpoint:** `POST /v1/billing/webhooks/paypal/`
+
+| Event | Handler Action |
+|-------|----------------|
+| `CHECKOUT.ORDER.APPROVED` | Auto-capture if configured |
+| `PAYMENT.CAPTURE.COMPLETED` | Mark succeeded, add credits |
+| `PAYMENT.CAPTURE.DENIED` | Mark failed |
+| `BILLING.SUBSCRIPTION.ACTIVATED` | Activate subscription |
+
+**Signature Verification:** Enabled and enforced:
+```python
+is_valid = service.verify_webhook_signature(...)
+if not is_valid:
+ return Response({'error': 'Invalid signature'}, status=400)
+```
+
+---
+
+## Models Reference
+
+### Invoice Model
+
+```python
+class Invoice(AccountBaseModel):
+ STATUS_CHOICES = [
+ ('draft', 'Draft'),
+ ('pending', 'Pending'),
+ ('paid', 'Paid'),
+ ('void', 'Void'),
+ ('uncollectible', 'Uncollectible'),
+ ]
+
+ invoice_number = models.CharField(max_length=50, unique=True)
+ subscription = models.ForeignKey('auth.Subscription', ...)
+ status = models.CharField(max_length=20, choices=STATUS_CHOICES)
+ subtotal = models.DecimalField(...)
+ tax = models.DecimalField(...)
+ total = models.DecimalField(...)
+ currency = models.CharField(max_length=3, default='USD')
+ due_date = models.DateField()
+ line_items = models.JSONField(default=list)
+```
+
+### Payment Model
+
+```python
+class Payment(AccountBaseModel):
+ STATUS_CHOICES = [
+ ('pending', 'Pending'),
+ ('pending_approval', 'Pending Approval'),
+ ('succeeded', 'Succeeded'),
+ ('failed', 'Failed'),
+ ('refunded', 'Refunded'),
+ ]
+
+ PAYMENT_METHOD_CHOICES = [
+ ('stripe', 'Stripe'),
+ ('paypal', 'PayPal'),
+ ('bank_transfer', 'Bank Transfer'),
+ ('manual', 'Manual'),
+ ]
+
+ invoice = models.ForeignKey('Invoice', ...)
+ amount = models.DecimalField(...)
+ currency = models.CharField(max_length=3)
+ payment_method = models.CharField(choices=PAYMENT_METHOD_CHOICES)
+ status = models.CharField(choices=STATUS_CHOICES)
+ stripe_payment_intent_id = models.CharField(...)
+ paypal_order_id = models.CharField(...)
+ manual_reference = models.CharField(..., unique=True)
+```
+
+### WebhookEvent Model
+
+```python
+class WebhookEvent(models.Model):
+ """Audit trail for webhook processing"""
+ PROVIDER_CHOICES = [
+ ('stripe', 'Stripe'),
+ ('paypal', 'PayPal'),
+ ]
+
+ provider = models.CharField(choices=PROVIDER_CHOICES)
+ event_id = models.CharField(max_length=255)
+ event_type = models.CharField(max_length=100)
+ payload = models.JSONField()
+ status = models.CharField() # 'pending', 'processed', 'failed'
+ processed_at = models.DateTimeField(null=True)
+ error_message = models.TextField(blank=True)
+```
+
+---
+
+## Security Features
+
+### Implemented Security Measures
+
+1. **Webhook Signature Verification**
+ - Stripe: `stripe.Webhook.construct_event()` with signing secret
+ - PayPal: `verify_webhook_signature()` API call
+
+2. **Idempotency**
+ - `WebhookEvent` model tracks processed events
+ - Duplicate detection before processing
+
+3. **Amount Validation**
+ - PayPal capture validates amount matches expected
+ - Prevents manipulation attacks
+
+4. **Manual Reference Uniqueness**
+ - Database constraint prevents duplicate bank transfer references
+ - Prevents double submission
+
+5. **CSRF Protection**
+ - Webhook endpoints exempt (external callers)
+ - All other endpoints protected
+
+6. **Authentication**
+ - Payment endpoints require `IsAuthenticatedAndActive`
+ - Config endpoints allow `AllowAny` (public keys only)
+
+---
+
+## Admin Operations
+
+### Django Admin Features
+
+**Location:** Django Admin > Billing
+
+- **Invoices:** View, filter, download PDF
+- **Payments:** View, approve/reject manual payments
+- **Credit Transactions:** Audit trail
+- **Credit Packages:** Manage packages
+
+### Manual Payment Approval
+
+```
+1. Admin navigates to Payments in Django Admin
+2. Filter by status='pending_approval'
+3. Review payment details and proof
+4. Click "Approve" or "Reject" action
+5. System automatically:
+ - Updates payment status
+ - Marks invoice paid (if approved)
+ - Activates account (if approved)
+ - Adds credits (if approved)
+ - Sends email notification
+```
+
+---
+
+## Configuration
+
+### Environment Variables
+
+```bash
+# Stripe
+STRIPE_SECRET_KEY=sk_...
+STRIPE_PUBLISHABLE_KEY=pk_...
+STRIPE_WEBHOOK_SECRET=whsec_...
+
+# PayPal
+PAYPAL_CLIENT_ID=...
+PAYPAL_CLIENT_SECRET=...
+PAYPAL_WEBHOOK_ID=...
+PAYPAL_MODE=sandbox|live
+
+# General
+DEFAULT_CURRENCY=USD
+```
+
+### IntegrationProvider Setup
+
+Payment gateways configured via `IntegrationProvider` model in Django Admin:
+
+1. **Stripe Provider:**
+ - Name: "Stripe"
+ - Provider Type: "stripe"
+ - Credentials: `{"secret_key": "...", "publishable_key": "...", "webhook_secret": "..."}`
+
+2. **PayPal Provider:**
+ - Name: "PayPal"
+ - Provider Type: "paypal"
+ - Credentials: `{"client_id": "...", "client_secret": "...", "webhook_id": "..."}`
+
+---
+
+## Troubleshooting
+
+### Common Issues
+
+| Issue | Cause | Solution |
+|-------|-------|----------|
+| "Stripe not configured" | Missing IntegrationProvider | Add Stripe provider in admin |
+| "PayPal not configured" | Missing IntegrationProvider | Add PayPal provider in admin |
+| PayPal shown for PK users | Country not passed correctly | Ensure `billing_country` saved on account |
+| Duplicate payments | Webhook retry without idempotency | Check `WebhookEvent` for duplicates |
+| PDF download fails | Missing `reportlab` | Run `pip install reportlab` |
+
+### Debug Logging
+
+Enable billing debug logs:
+```python
+# settings.py
+LOGGING = {
+ 'loggers': {
+ 'igny8_core.business.billing': {
+ 'level': 'DEBUG',
+ },
+ },
+}
+```
+
+---
+
+## File Reference
+
+### Backend Files
+
+| File | Description |
+|------|-------------|
+| `billing/views/stripe_views.py` | Stripe API endpoints |
+| `billing/views/paypal_views.py` | PayPal API endpoints |
+| `billing/views/refund_views.py` | Refund processing |
+| `billing/services/stripe_service.py` | Stripe service layer |
+| `billing/services/paypal_service.py` | PayPal service layer |
+| `billing/services/invoice_service.py` | Invoice operations |
+| `billing/services/payment_service.py` | Payment operations |
+| `billing/services/pdf_service.py` | PDF generation |
+| `billing/services/email_service.py` | Email notifications |
+| `billing/models.py` | Billing models |
+| `billing/urls.py` | URL routing |
+
+### Frontend Files
+
+| File | Description |
+|------|-------------|
+| `services/billing.api.ts` | API client functions |
+| `pages/account/PlansAndBillingPage.tsx` | Main billing page |
+| `components/billing/PendingPaymentView.tsx` | New user payment |
+| `components/billing/BankTransferForm.tsx` | Bank transfer form |
+| `components/billing/PayInvoiceModal.tsx` | Invoice payment modal |
+| `components/billing/PaymentGatewaySelector.tsx` | Gateway selection |
+| `components/billing/PendingPaymentBanner.tsx` | Payment alert banner |
+
+---
+
+*Document generated from production codebase - January 8, 2026*
diff --git a/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/SEED-KEYWORDS-IMPORT-GUIDE.md b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/SEED-KEYWORDS-IMPORT-GUIDE.md
new file mode 100644
index 00000000..0d10ea75
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/SEED-KEYWORDS-IMPORT-GUIDE.md
@@ -0,0 +1,198 @@
+# Global Keywords Database (SeedKeyword) - Import Guide
+
+**Last Updated:** January 20, 2026
+**Version:** 1.8.4
+
+## Overview
+
+The Global Keywords Database stores canonical keyword suggestions that can be imported into account-specific keywords. These are organized by Industry and Sector.
+
+**Admin URL:** `https://api.igny8.com/admin/igny8_core_auth/seedkeyword/`
+
+---
+
+## Import Functionality
+
+### CSV Format
+
+The import expects a CSV file with the following columns:
+
+| Column | Type | Required | Description | Example |
+|--------|------|----------|-------------|---------|
+| `keyword` | String | **Yes** | The keyword phrase | "best massage chairs" |
+| `industry` | String | **Yes** | Industry name (must exist) | "Health & Wellness" |
+| `sector` | String | **Yes** | Sector name (must exist) | "Massage Products" |
+| `volume` | Integer | No | Monthly search volume | 5400 |
+| `difficulty` | Integer | No | Keyword difficulty (0-100) | 45 |
+| `country` | String | No | Country code (US, CA, GB, etc.) | "US" |
+| `is_active` | Boolean | No | Active status | True |
+
+### Sample CSV
+
+```csv
+keyword,industry,sector,volume,difficulty,country,is_active
+best massage chairs,Health & Wellness,Massage Products,5400,45,US,True
+deep tissue massage chair,Health & Wellness,Massage Products,720,52,US,True
+shiatsu massage chair,Health & Wellness,Massage Products,1200,48,US,True
+```
+
+**Template file available:** `/data/app/igny8/backend/seed_keywords_import_template.csv`
+
+---
+
+## How to Import
+
+### Step 1: Prepare Your CSV File
+
+1. Download the template: `seed_keywords_import_template.csv`
+2. Add your keywords (one per row)
+3. Ensure Industry and Sector names **exactly match** existing records
+4. Save as CSV (UTF-8 encoding)
+
+### Step 2: Import via Django Admin
+
+1. Go to: `https://api.igny8.com/admin/igny8_core_auth/seedkeyword/`
+2. Click **"Import"** button (top right)
+3. Click **"Choose File"** and select your CSV
+4. Click **"Submit"**
+5. Review the preview:
+ - ✅ Green = New records to be created
+ - 🔵 Blue = Existing records to be updated
+ - ❌ Red = Errors (fix and re-import)
+6. If preview looks good, click **"Confirm import"**
+
+### Step 3: Verify Import
+
+- Check the list to see your imported keywords
+- Use filters to find specific industries/sectors
+- Edit any records if needed
+
+---
+
+## Data Validation
+
+The import process automatically:
+
+✅ **Validates volume:** Ensures it's a positive integer (defaults to 0 if invalid)
+✅ **Validates difficulty:** Clamps to 0-100 range
+✅ **Validates country:** Must be one of: US, CA, GB, AE, AU, IN, PK (defaults to US)
+✅ **Handles duplicates:** Uses `(keyword, industry, sector)` as unique key
+✅ **Skip unchanged:** If keyword already exists with same data, it's skipped
+
+---
+
+## Bulk Delete
+
+### How to Delete Keywords
+
+1. Select keywords using checkboxes (or "Select all")
+2. Choose **"Delete selected keywords"** from the action dropdown
+3. Click **"Go"**
+4. Review the confirmation page showing all related objects
+5. Click **"Yes, I'm sure"** to confirm deletion
+
+**Note:** Only superusers and developers can delete seed keywords.
+
+---
+
+## Export Functionality
+
+### Export to CSV/Excel
+
+1. Go to: `https://api.igny8.com/admin/igny8_core_auth/seedkeyword/`
+2. (Optional) Use filters to narrow down results
+3. Click **"Export"** button (top right)
+4. Choose format: CSV, Excel, JSON, etc.
+5. File downloads with all selected fields
+
+**Export includes:**
+- All keyword data
+- Related industry/sector names
+- SEO metrics (volume, difficulty)
+- Metadata (created date, active status)
+
+---
+
+## Common Issues & Solutions
+
+### Issue: "Industry not found" error during import
+
+**Solution:**
+- Ensure the industry name in your CSV **exactly matches** an existing Industry record
+- Check spelling, capitalization, and spacing
+- View existing industries: `/admin/igny8_core_auth/industry/`
+
+### Issue: "Sector not found" error during import
+
+**Solution:**
+- Ensure the sector name in your CSV **exactly matches** an existing IndustrySector record
+- The sector must belong to the specified industry
+- View existing sectors: `/admin/igny8_core_auth/industrysector/`
+
+### Issue: Import shows errors for all rows
+
+**Solution:**
+- Check CSV encoding (must be UTF-8)
+- Ensure column headers match exactly: `keyword,industry,sector,volume,difficulty,country,is_active`
+- Remove any extra columns or spaces in headers
+- Verify there are no special characters causing parsing issues
+
+### Issue: Duplicate keyword error
+
+**Solution:**
+- Keywords are unique per `(keyword, industry, sector)` combination
+- If importing a keyword that already exists, it will be updated (not duplicated)
+- Use `skip_unchanged = True` to avoid unnecessary updates
+
+### Issue: Delete confirmation page has no "Delete" button
+
+**Solution:** ✅ **FIXED** - Custom bulk delete action now includes proper delete button on confirmation page
+
+---
+
+## Permissions
+
+| Action | Permission Required |
+|--------|-------------------|
+| View | Staff users |
+| Add | Superuser |
+| Edit | Superuser |
+| Delete | Superuser or Developer |
+| Import | Superuser |
+| Export | Staff users |
+
+---
+
+## Technical Details
+
+### Model Location
+- **Model:** `backend/igny8_core/auth/models.py` - `SeedKeyword`
+- **Admin:** `backend/igny8_core/auth/admin.py` - `SeedKeywordAdmin`
+- **Resource:** `backend/igny8_core/auth/admin.py` - `SeedKeywordResource`
+
+### Database Table
+- **Table name:** `igny8_seed_keywords`
+- **Unique constraint:** `(keyword, industry, sector)`
+- **Indexes:**
+ - `keyword`
+ - `industry, sector`
+ - `industry, sector, is_active`
+ - `country`
+
+### API Access (Read-Only)
+- **Endpoint:** `/api/v1/auth/seed-keywords/`
+- **ViewSet:** `SeedKeywordViewSet` (ReadOnlyModelViewSet)
+- **Filters:** industry, sector, country, is_active
+
+---
+
+## Related Documentation
+
+- [Django Admin Guide](../../docs/90-REFERENCE/DJANGO-ADMIN-ACCESS-GUIDE.md)
+- [Models Reference](../../docs/90-REFERENCE/MODELS.md)
+- [Planner Module](../../docs/10-MODULES/PLANNER.md)
+
+---
+
+**Last Updated:** January 11, 2026
+**Maintainer:** IGNY8 Team
diff --git a/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/final-model-schemas.md b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/final-model-schemas.md
new file mode 100644
index 00000000..1ff6d2f7
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/90-REFERENCE/final-model-schemas.md
@@ -0,0 +1,314 @@
+# Final Model Schemas - Clean State
+
+## Overview
+
+This document defines the simplified, clean architecture for AI configuration and billing models.
+
+**Total Models**: 5 (down from 7)
+- IntegrationProvider (API keys)
+- AIModelConfig (model definitions + pricing)
+- AISettings (system defaults + account overrides) - *renamed from GlobalIntegrationSettings*
+- AccountSettings (generic key-value store)
+- CreditCostConfig (operation-level pricing)
+
+**Models Removed**:
+- IntegrationSettings (merged into AISettings/AccountSettings)
+- CreditCostConfig.tokens_per_credit (moved to AIModelConfig)
+
+---
+
+## 1. IntegrationProvider (API Keys Only)
+
+Centralized storage for ALL external service API keys.
+
+| Field | Type | Required | Notes |
+|-------|------|----------|-------|
+| `provider_id` | CharField(50) PK | Yes | openai, runware, stripe, paypal, resend |
+| `display_name` | CharField(100) | Yes | Human-readable name |
+| `provider_type` | CharField(20) | Yes | ai / payment / email / storage |
+| `api_key` | CharField(500) | No | Primary API key |
+| `api_secret` | CharField(500) | No | Secondary secret (Stripe, PayPal) |
+| `webhook_secret` | CharField(500) | No | Webhook signing secret |
+| `api_endpoint` | URLField | No | Custom endpoint (optional) |
+| `config` | JSONField | No | Provider-specific config |
+| `is_active` | BooleanField | Yes | Enable/disable provider |
+| `is_sandbox` | BooleanField | Yes | Test mode flag |
+| `updated_by` | FK(User) | No | Audit trail |
+| `created_at` | DateTime | Auto | |
+| `updated_at` | DateTime | Auto | |
+
+**Seeded Providers**:
+- `openai` - AI (text + DALL-E)
+- `runware` - AI (images)
+- `anthropic` - AI (future)
+- `stripe` - Payment
+- `paypal` - Payment
+- `resend` - Email
+
+---
+
+## 2. AIModelConfig (Single Source of Truth for Models)
+
+All AI models (text + image) with pricing and credit configuration.
+
+| Field | Type | Required | Notes |
+|-------|------|----------|-------|
+| `id` | AutoField PK | Auto | |
+| `model_name` | CharField(100) | Yes | gpt-5.1, dall-e-3, runware:97@1 |
+| `model_type` | CharField(20) | Yes | text / image |
+| `provider` | CharField(50) | Yes | Links to IntegrationProvider |
+| `display_name` | CharField(200) | Yes | Human-readable |
+| `is_default` | BooleanField | Yes | One default per type |
+| `is_active` | BooleanField | Yes | Enable/disable |
+| `cost_per_1k_input` | DecimalField | No | Provider cost (USD) - text models |
+| `cost_per_1k_output` | DecimalField | No | Provider cost (USD) - text models |
+| `tokens_per_credit` | IntegerField | No | Text: tokens per 1 credit (e.g., 1000) |
+| `credits_per_image` | IntegerField | No | Image: credits per image (e.g., 1, 5, 15) |
+| `quality_tier` | CharField(20) | No | basic / quality / premium |
+| `max_tokens` | IntegerField | No | Model token limit |
+| `context_window` | IntegerField | No | Model context size |
+| `capabilities` | JSONField | No | vision, function_calling, etc. |
+| `created_at` | DateTime | Auto | |
+| `updated_at` | DateTime | Auto | |
+
+**Credit Configuration Examples**:
+
+| Model | Type | tokens_per_credit | credits_per_image | quality_tier |
+|-------|------|-------------------|-------------------|--------------|
+| gpt-5.1 | text | 1000 | - | - |
+| gpt-4o-mini | text | 10000 | - | - |
+| runware:97@1 | image | - | 1 | basic |
+| dall-e-3 | image | - | 5 | quality |
+| google:4@2 | image | - | 15 | premium |
+
+---
+
+## 3. AISettings (Renamed from GlobalIntegrationSettings)
+
+System-wide AI defaults. Singleton (pk=1).
+
+| Field | Type | Required | Default | Notes |
+|-------|------|----------|---------|-------|
+| `id` | AutoField PK | Auto | 1 | Singleton |
+| `temperature` | FloatField | Yes | 0.7 | AI temperature (0.0-2.0) |
+| `max_tokens` | IntegerField | Yes | 8192 | Max response tokens |
+| `image_style` | CharField(30) | Yes | photorealistic | Default image style |
+| `image_quality` | CharField(20) | Yes | standard | standard / hd |
+| `max_images_per_article` | IntegerField | Yes | 4 | Max in-article images |
+| `image_size` | CharField(20) | Yes | 1024x1024 | Default image dimensions |
+| `updated_by` | FK(User) | No | | Audit trail |
+| `updated_at` | DateTime | Auto | | |
+
+**Removed Fields** (now elsewhere):
+- All `*_api_key` fields → IntegrationProvider
+- All `*_model` fields → AIModelConfig.is_default
+- `default_text_provider` → AIModelConfig.is_default where model_type='text'
+- `default_image_service` → AIModelConfig.is_default where model_type='image'
+
+**Image Style Choices**:
+- `photorealistic` - Ultra realistic photography
+- `illustration` - Digital illustration
+- `3d_render` - Computer generated 3D
+- `minimal_flat` - Minimal / Flat Design
+- `artistic` - Artistic / Painterly
+- `cartoon` - Cartoon / Stylized
+
+---
+
+## 4. AccountSettings (Per-Account Overrides)
+
+Generic key-value store for account-specific settings.
+
+| Field | Type | Required | Notes |
+|-------|------|----------|-------|
+| `id` | AutoField PK | Auto | |
+| `account` | FK(Account) | Yes | |
+| `key` | CharField(100) | Yes | Setting key |
+| `value` | JSONField | Yes | Setting value |
+| `created_at` | DateTime | Auto | |
+| `updated_at` | DateTime | Auto | |
+
+**Unique Constraint**: `(account, key)`
+
+**AI-Related Keys** (override AISettings defaults):
+
+| Key | Type | Example | Notes |
+|-----|------|---------|-------|
+| `ai.temperature` | float | 0.7 | Override system default |
+| `ai.max_tokens` | int | 8192 | Override system default |
+| `ai.image_style` | string | "photorealistic" | Override system default |
+| `ai.image_quality` | string | "hd" | Override system default |
+| `ai.max_images` | int | 6 | Override system default |
+| `ai.image_quality_tier` | string | "quality" | User's preferred tier |
+
+---
+
+## 5. CreditCostConfig (Operation-Level Pricing)
+
+Fixed credit costs per operation type.
+
+| Field | Type | Required | Notes |
+|-------|------|----------|-------|
+| `operation_type` | CharField(50) PK | Yes | Unique operation ID |
+| `display_name` | CharField(100) | Yes | Human-readable |
+| `base_credits` | IntegerField | Yes | Fixed credits per operation |
+| `is_active` | BooleanField | Yes | Enable/disable |
+| `description` | TextField | No | Admin notes |
+
+**Removed**: `tokens_per_credit` (now in AIModelConfig)
+
+---
+
+## Frontend Settings Structure
+
+### Content Generation Settings Tab
+
+```
+┌─────────────────────────────────────────────────────────────┐
+│ Content Generation Settings │
+├─────────────────────────────────────────────────────────────┤
+│ │
+│ AI Parameters │
+│ ┌─────────────────────────────────────────────────────┐ │
+│ │ Temperature [=====○====] 0.7 │ │
+│ │ More focused ←→ More creative │ │
+│ │ │ │
+│ │ Max Tokens [8192 ▼] │ │
+│ │ Response length limit │ │
+│ └─────────────────────────────────────────────────────┘ │
+│ │
+│ Image Generation │
+│ ┌─────────────────────────────────────────────────────┐ │
+│ │ Image Quality │ │
+│ │ ○ Basic (1 credit/image) - Fast, simple │ │
+│ │ ● Quality (5 credits/image) - Balanced │ │
+│ │ ○ Premium (15 credits/image) - Best quality │ │
+│ │ │ │
+│ │ Image Style [Photorealistic ▼] │ │
+│ │ │ │
+│ │ Images per Article [4 ▼] (max 8) │ │
+│ └─────────────────────────────────────────────────────┘ │
+│ │
+│ [Save Settings] │
+└─────────────────────────────────────────────────────────────┘
+```
+
+### Frontend API Response
+
+```
+GET /api/v1/accounts/settings/ai/
+
+Response:
+{
+ "content_generation": {
+ "temperature": 0.7,
+ "max_tokens": 8192
+ },
+ "image_generation": {
+ "quality_tiers": [
+ {"tier": "basic", "credits": 1, "label": "Basic", "description": "Fast, simple images"},
+ {"tier": "quality", "credits": 5, "label": "Quality", "description": "Balanced quality"},
+ {"tier": "premium", "credits": 15, "label": "Premium", "description": "Best quality"}
+ ],
+ "selected_tier": "quality",
+ "styles": [
+ {"value": "photorealistic", "label": "Photorealistic"},
+ {"value": "illustration", "label": "Illustration"},
+ {"value": "3d_render", "label": "3D Render"},
+ {"value": "minimal_flat", "label": "Minimal / Flat"},
+ {"value": "artistic", "label": "Artistic"},
+ {"value": "cartoon", "label": "Cartoon"}
+ ],
+ "selected_style": "photorealistic",
+ "max_images": 4,
+ "max_allowed": 8
+ }
+}
+```
+
+### Save Settings Request
+
+```
+PUT /api/v1/accounts/settings/ai/
+
+Request:
+{
+ "temperature": 0.8,
+ "max_tokens": 4096,
+ "image_quality_tier": "premium",
+ "image_style": "illustration",
+ "max_images": 6
+}
+```
+
+---
+
+## Data Flow
+
+```
+┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
+│ IntegrationProv. │ │ AIModelConfig │ │ AISettings │
+│ │ │ │ │ (Singleton) │
+│ - API keys │◄────│ - Model list │ │ │
+│ - Provider info │ │ - Pricing │ │ - Defaults │
+└──────────────────┘ │ - Credits config │ │ - temperature │
+ │ - quality_tier │ │ - max_tokens │
+ └────────┬─────────┘ │ - image_style │
+ │ └────────┬─────────┘
+ │ │
+ ▼ ▼
+ ┌──────────────────────────────────────────┐
+ │ AccountSettings │
+ │ │
+ │ Account-specific overrides: │
+ │ - ai.temperature = 0.8 │
+ │ - ai.image_quality_tier = "premium" │
+ │ - ai.image_style = "illustration" │
+ └──────────────────────────────────────────┘
+ │
+ ▼
+ ┌──────────────────────────────────────────┐
+ │ Frontend Settings UI │
+ │ │
+ │ GET /api/v1/accounts/settings/ai/ │
+ │ - Merges AISettings + AccountSettings │
+ │ - Returns effective values for account │
+ └──────────────────────────────────────────┘
+```
+
+---
+
+## Migration Summary
+
+| From | To | Action |
+|------|----|--------|
+| GlobalIntegrationSettings.*_api_key | IntegrationProvider | Already done |
+| GlobalIntegrationSettings.*_model | AIModelConfig.is_default | Already done |
+| GlobalIntegrationSettings (remaining) | AISettings (rename) | Phase 3 |
+| IntegrationSettings | AccountSettings | Phase 3 - delete model |
+| CreditCostConfig.tokens_per_credit | AIModelConfig.tokens_per_credit | Already done |
+
+---
+
+## Phase 3 Implementation Steps
+
+1. **Rename Model**: GlobalIntegrationSettings → AISettings
+2. **Remove Fields**: All `*_api_key`, `*_model` fields from AISettings
+3. **Create API Endpoint**: `/api/v1/accounts/settings/ai/`
+4. **Update Frontend**: Load from new endpoint, use quality_tier picker
+5. **Delete Model**: IntegrationSettings (after migrating any data)
+6. **Cleanup**: Remove deprecated choices/constants
+
+---
+
+## Files to Modify (Phase 3)
+
+| File | Change |
+|------|--------|
+| `modules/system/global_settings_models.py` | Rename class, remove deprecated fields |
+| `modules/system/admin.py` | Update admin for AISettings |
+| `modules/system/views.py` | New AI settings API endpoint |
+| `modules/system/serializers.py` | AISettingsSerializer |
+| `settings.py` | Update admin sidebar |
+| `ai/ai_core.py` | Use AISettings instead of GlobalIntegrationSettings |
+| Frontend | New settings component with quality tier picker |
diff --git a/v2/Live Docs on Server/igny8-app-docs/INDEX.md b/v2/Live Docs on Server/igny8-app-docs/INDEX.md
new file mode 100644
index 00000000..750050b6
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/INDEX.md
@@ -0,0 +1,277 @@
+# IGNY8 Technical Documentation
+
+**Version:** 1.8.4
+**Last Updated:** January 20, 2026
+**Purpose:** Complete technical reference for the IGNY8 AI content platform
+
+---
+
+## Quick Navigation
+
+| I want to... | Go to |
+|--------------|-------|
+| Understand system architecture | [00-SYSTEM/ARCHITECTURE.md](00-SYSTEM/ARCHITECTURE.md) |
+| See repository structure | [00-SYSTEM/REPO-STRUCTURE.md](00-SYSTEM/REPO-STRUCTURE.md) |
+| Read executive summary | [00-SYSTEM/IGNY8-APP.md](00-SYSTEM/IGNY8-APP.md) |
+| Work with a specific module | [10-MODULES/](#modules) |
+| Find an API endpoint | [20-API/ENDPOINTS.md](20-API/ENDPOINTS.md) |
+| **Use UI components** | [30-FRONTEND/COMPONENT-SYSTEM.md](30-FRONTEND/COMPONENT-SYSTEM.md) |
+| **Check design tokens** | [30-FRONTEND/DESIGN-TOKENS.md](30-FRONTEND/DESIGN-TOKENS.md) |
+| **Read design guide** | [30-FRONTEND/DESIGN-GUIDE.md](30-FRONTEND/DESIGN-GUIDE.md) |
+| Understand frontend structure | [30-FRONTEND/PAGES.md](30-FRONTEND/PAGES.md) |
+| Trace a workflow end-to-end | [40-WORKFLOWS/](#workflows) |
+| **Automation & Publishing Scheduling** | [40-WORKFLOWS/AUTOMATION-AND-PUBLISHING-SCHEDULING.md](40-WORKFLOWS/AUTOMATION-AND-PUBLISHING-SCHEDULING.md) |
+| **Manage WordPress plugin** | [60-PLUGINS/WORDPRESS-INTEGRATION.md](60-PLUGINS/WORDPRESS-INTEGRATION.md) |
+| **Release plugin update** | [60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md](60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md) |
+| Look up model fields | [90-REFERENCE/MODELS.md](90-REFERENCE/MODELS.md) |
+| **Billing & Credits (Complete)** | [10-MODULES/BILLING-PAYMENTS-COMPLETE.md](10-MODULES/BILLING-PAYMENTS-COMPLETE.md) |
+| **Payment gateways (Stripe/PayPal/Bank)** | [90-REFERENCE/PAYMENT-SYSTEM.md](90-REFERENCE/PAYMENT-SYSTEM.md) |
+| See prelaunch checklist | [plans/LAUNCH-VERIFICATION-CHECKLIST.md](plans/LAUNCH-VERIFICATION-CHECKLIST.md) |
+| **Understand publishing flow** | [50-DEPLOYMENT/WORDPRESS-INTEGRATION-FLOW.md](50-DEPLOYMENT/WORDPRESS-INTEGRATION-FLOW.md) |
+| **AI model architecture (v1.4.0)** | [plans/4th-jan-refactor/final-model-schemas.md](plans/4th-jan-refactor/final-model-schemas.md) |
+
+---
+
+## 00-SYSTEM - Architecture & Core
+
+| Document | Purpose |
+|----------|---------|
+| [ARCHITECTURE.md](00-SYSTEM/ARCHITECTURE.md) | Tech stack, deployment, system design |
+| [REPO-STRUCTURE.md](00-SYSTEM/REPO-STRUCTURE.md) | Repository layout and directory trees |
+| [AUTH-FLOWS.md](00-SYSTEM/AUTH-FLOWS.md) | Authentication, JWT, sessions, roles |
+| [TENANCY.md](00-SYSTEM/TENANCY.md) | Multi-tenant architecture, Account/Site/Sector |
+| [IGNY8-APP.md](00-SYSTEM/IGNY8-APP.md) | Executive summary (non-technical) |
+
+---
+
+## 10-MODULES - Feature Modules {#modules}
+
+| Module | Status | Description | Document |
+|--------|--------|-------------|----------|
+| **Planner** | ✅ Active | Keywords → Clusters → Ideas | [PLANNER.md](10-MODULES/PLANNER.md) |
+| **Writer** | ✅ Active | Tasks → Content → Images | [WRITER.md](10-MODULES/WRITER.md) |
+| **Automation** | ✅ Active | 7-stage automated pipeline | [AUTOMATION.md](10-MODULES/AUTOMATION.md) |
+| **Billing** | ✅ Active | Two-pool credits, plans, payments | [BILLING-PAYMENTS-COMPLETE.md](10-MODULES/BILLING-PAYMENTS-COMPLETE.md) |
+| **Integrations** | ✅ Active | WordPress sync, webhooks | [INTEGRATIONS.md](10-MODULES/INTEGRATIONS.md) |
+| **Notifications** | ✅ Active | Real-time notifications for AI tasks | [NOTIFICATIONS.md](10-MODULES/NOTIFICATIONS.md) |
+| **System** | ✅ Active | Settings, prompts, AI config | [SYSTEM-SETTINGS.md](10-MODULES/SYSTEM-SETTINGS.md) |
+| **Publisher** | ✅ Active | Content calendar, scheduled publishing | [PUBLISHER.md](10-MODULES/PUBLISHER.md) |
+| **Linker** | ⏸️ Inactive | Internal linking (disabled by default) | [LINKER.md](10-MODULES/LINKER.md) |
+| **Optimizer** | ⏸️ Inactive | Content optimization (disabled by default) | [OPTIMIZER.md](10-MODULES/OPTIMIZER.md) |
+
+---
+
+## 20-API - REST API Reference
+
+| Document | Purpose |
+|----------|---------|
+| [ENDPOINTS.md](20-API/ENDPOINTS.md) | Complete endpoint list with methods and handlers |
+| [SCHEMAS.md](20-API/SCHEMAS.md) | Request/response examples |
+
+---
+
+## 30-FRONTEND - React Application
+
+| Document | Purpose |
+|----------|---------|
+| [COMPONENT-SYSTEM.md](30-FRONTEND/COMPONENT-SYSTEM.md) | **UI components reference** (Button, InputField, etc.) |
+| [DESIGN-GUIDE.md](30-FRONTEND/DESIGN-GUIDE.md) | **Design system guide** (colors, rules) |
+| [DESIGN-TOKENS.md](30-FRONTEND/DESIGN-TOKENS.md) | **Design tokens** (CSS variables, color scales) |
+| [PAGE-AUDIT.md](30-FRONTEND/PAGE-AUDIT.md) | Page-by-page function audit (in progress) |
+| [PAGES.md](30-FRONTEND/PAGES.md) | All pages and routes |
+| [PAGE-REQUIREMENTS.md](30-FRONTEND/PAGE-REQUIREMENTS.md) | Site/sector selector requirements |
+| [STORES.md](30-FRONTEND/STORES.md) | Zustand state management |
+
+### Current Page Structure (v1.8.3)
+
+```
+/ → Dashboard (Home.tsx)
+├── AUTH
+│ /signin → Sign In (SignIn.tsx)
+│ /signup → Sign Up (SignUp.tsx)
+│ /signup/pk → Legacy redirect to Sign Up
+│ /forgot-password → Forgot Password (ForgotPassword.tsx)
+│ /reset-password → Reset Password (ResetPassword.tsx)
+│ /verify-email → Verify Email (VerifyEmail.tsx)
+│ /unsubscribe → Unsubscribe (Unsubscribe.tsx)
+│ /payment → Payment (Payment.tsx)
+├── LEGAL
+│ /terms → Terms (Terms.tsx)
+│ /privacy → Privacy (Privacy.tsx)
+├── SETUP
+│ /setup/wizard → Onboarding Wizard (SetupWizard.tsx)
+│ /keywords-library → Keywords Library (IndustriesSectorsKeywords.tsx)
+├── SITES
+│ /sites → Sites List (List.tsx)
+│ /sites/:id → Site Dashboard (Dashboard.tsx)
+│ /sites/:id/pages → Page Manager (PageManager.tsx)
+│ /sites/:id/content → Site Content (Content.tsx)
+│ /sites/:id/content/structure → Content Structure (ContentStructure.tsx)
+│ /sites/:id/settings → Site Settings (Settings.tsx)
+│ /sites/:id/sync → Sync Dashboard (SyncDashboard.tsx)
+│ /sites/:id/deploy → Deployment Panel (DeploymentPanel.tsx)
+│ /sites/:id/posts/:postId → Post Editor (PostEditor.tsx)
+├── WORKFLOW
+│ /planner/keywords → Planner Keywords (Keywords.tsx)
+│ /planner/clusters → Planner Clusters (Clusters.tsx)
+│ /planner/clusters/:id → Cluster Detail (ClusterDetail.tsx)
+│ /planner/ideas → Planner Ideas (Ideas.tsx)
+│ /writer/tasks → Writer Tasks (Tasks.tsx)
+│ /writer/content → Writer Content (Content.tsx)
+│ /writer/content/:id → Content View (ContentView.tsx)
+│ /writer/images → Writer Images (Images.tsx)
+│ /writer/review → Review Queue (Review.tsx)
+│ /writer/approved → Approved (Approved.tsx)
+│ /automation/overview → Automation Runs (AutomationOverview.tsx)
+│ /automation/runs/:runId → Run Detail (AutomationRunDetail.tsx)
+│ /automation/run → Automation Run (AutomationPage.tsx)
+├── PUBLISHER
+│ /publisher/content-calendar → Content Calendar (ContentCalendar.tsx)
+├── OPTIONAL MODULES
+│ /linker/content → Linker Content (ContentList.tsx)
+│ /optimizer/content → Optimizer Content (ContentSelector.tsx)
+│ /optimizer/analyze/:id → Optimization Preview (AnalysisPreview.tsx)
+├── THINKER (ADMIN)
+│ /thinker/prompts → Prompts (Prompts.tsx)
+│ /thinker/author-profiles → Author Profiles (AuthorProfiles.tsx)
+│ /thinker/profile → Thinker Profile (Profile.tsx)
+│ /thinker/strategies → Strategies (Strategies.tsx)
+│ /thinker/image-testing → Image Testing (ImageTesting.tsx)
+├── ACCOUNT
+│ /account/notifications → Notifications (NotificationsPage.tsx)
+│ /account/settings → Account Settings (AccountSettingsPage.tsx)
+│ /account/settings/profile → Profile Tab
+│ /account/settings/team → Team Tab
+│ /account/plans → Plans & Billing (PlansAndBillingPage.tsx)
+│ /account/plans/upgrade → Upgrade Tab
+│ /account/plans/history → History Tab
+│ /account/usage → Usage Dashboard (UsageDashboardPage.tsx)
+│ /account/content-settings → Content Settings (ContentSettingsPage.tsx)
+├── SETTINGS
+│ /settings → General Settings (General.tsx)
+│ /settings/users → Users (Users.tsx)
+│ /settings/subscriptions → Subscriptions (Subscriptions.tsx)
+│ /settings/system → System Settings (System.tsx)
+│ /settings/account → Account Settings (Account.tsx)
+│ /settings/plans → Plans (Plans.tsx)
+│ /settings/industries → Industries (Industries.tsx)
+│ /settings/integration → Integration (Integration.tsx) [Admin]
+│ /settings/publishing → Publishing (Publishing.tsx)
+│ /settings/sites → Sites Settings (Sites.tsx)
+├── REFERENCE
+│ /reference/seed-keywords → Seed Keywords (SeedKeywords.tsx)
+│ /reference/industries → Industries (Industries.tsx)
+├── HELP
+│ /help → Help Center (Help.tsx)
+└── INTERNAL
+ /ui-elements → UI Elements (UIElements.tsx)
+ /components → Components (Components.tsx)
+```
+
+**Removed in v1.8.0:**
+- `/automation/settings` - Merged into Site Settings → Automation tab
+- `/publisher/settings` - Merged into Site Settings → Automation tab
+- `/sites/:id/settings` AI Settings tab - Merged into Automation tab
+
+**Removed in v1.4.0:**
+- `/settings/ai` - AI Settings page merged into Site Settings AI tab
+
+---
+
+## 40-WORKFLOWS - Cross-Module Flows {#workflows}
+
+| Document | Purpose |
+|----------|---------|
+| [CONTENT-PIPELINE.md](40-WORKFLOWS/CONTENT-PIPELINE.md) | Keyword → Published article flow |
+| [CREDIT-SYSTEM.md](40-WORKFLOWS/CREDIT-SYSTEM.md) | When and how credits are used |
+
+---
+
+## 60-PLUGINS - Plugin Distribution & Management
+
+| Document | Purpose |
+|----------|---------|
+| [INDEX.md](60-PLUGINS/INDEX.md) | Plugin management overview |
+| [WORDPRESS-INTEGRATION.md](60-PLUGINS/WORDPRESS-INTEGRATION.md) | Complete WordPress integration guide (app-side) |
+| [PLUGIN-UPDATE-WORKFLOW.md](60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md) | How to release updates, verification checklist |
+
+**Key Points:**
+- Plugin source: `/plugins/wordpress/source/igny8-wp-bridge/`
+- Distribution: `/plugins/wordpress/dist/`
+- Django app: `/backend/igny8_core/plugins/`
+- API domain: `api.igny8.com` (not app.igny8.com)
+
+---
+
+## 90-REFERENCE - Quick Lookup
+
+| Document | Purpose |
+|----------|---------|
+| [MODELS.md](90-REFERENCE/MODELS.md) | All database models and fields |
+| [AI-FUNCTIONS.md](90-REFERENCE/AI-FUNCTIONS.md) | AI engine capabilities and costs |
+| [PAYMENT-SYSTEM.md](90-REFERENCE/PAYMENT-SYSTEM.md) | Payment gateways (Stripe, PayPal, Bank Transfer) |
+| [TROUBLESHOOTING.md](90-REFERENCE/TROUBLESHOOTING.md) | Common issues and fixes |
+
+---
+
+## Root Files
+
+| File | Purpose |
+|------|---------|
+| [/CHANGELOG.md](/CHANGELOG.md) | Version history and changes |
+| [/IGNY8-APP.md](/IGNY8-APP.md) | Platform overview (non-technical) |
+| [/PRE-LAUNCH-AUDIT.md](/PRE-LAUNCH-AUDIT.md) | Known issues and improvement roadmap |
+
+---
+
+## Module → File Quick Reference
+
+| Module | Backend Path | Frontend Path |
+|--------|--------------|---------------|
+| Dashboard | N/A | `frontend/src/pages/Dashboard/` |
+| Setup | N/A | `frontend/src/pages/Setup/` |
+| Planner | `backend/igny8_core/modules/planner/` | `frontend/src/pages/Planner/` |
+| Writer | `backend/igny8_core/modules/writer/` | `frontend/src/pages/Writer/` |
+| Billing | `backend/igny8_core/modules/billing/` + `business/billing/` | `frontend/src/pages/account/` |
+| Automation | `backend/igny8_core/business/automation/` | `frontend/src/pages/Automation/` |
+| Integrations | `backend/igny8_core/modules/integration/` + `business/integration/` | `frontend/src/pages/Settings/` |
+| System | `backend/igny8_core/modules/system/` | `frontend/src/pages/Settings/` |
+| Linker | `backend/igny8_core/modules/linker/` | `frontend/src/pages/Linker/` |
+| Optimizer | `backend/igny8_core/modules/optimizer/` + `business/optimization/` | `frontend/src/pages/Optimizer/` |
+| Publisher | `backend/igny8_core/modules/publisher/` + `business/publishing/` | N/A (backend only) |
+| Auth | `backend/igny8_core/auth/` | `frontend/src/pages/AuthPages/` |
+| AI Engine | `backend/igny8_core/ai/` | N/A |
+| Thinker | `backend/igny8_core/modules/thinker/` | `frontend/src/pages/Thinker/` |
+| Sites | `backend/igny8_core/modules/sites/` | `frontend/src/pages/Sites/` |
+| Help | N/A | `frontend/src/pages/Help/` |
+| Account | `backend/igny8_core/modules/accounts/` | `frontend/src/pages/account/` |
+
+---
+
+## API Base Paths
+
+| Module | Base URL |
+|--------|----------|
+| Auth | `/api/v1/auth/` |
+| Planner | `/api/v1/planner/` |
+| Writer | `/api/v1/writer/` |
+| Billing | `/api/v1/billing/` |
+| Integration | `/api/v1/integration/` |
+| System | `/api/v1/system/` |
+| Linker | `/api/v1/linker/` |
+| Optimizer | `/api/v1/optimizer/` |
+| Publisher | `/api/v1/publisher/` |
+
+---
+
+## Tech Stack Summary
+
+| Layer | Technology |
+|-------|------------|
+| Backend | Django 5.x, Django REST Framework, PostgreSQL 15+ |
+| Frontend | React 19, TypeScript, Vite, TailwindCSS |
+| State | Zustand |
+| Async | Celery + Redis |
+| AI | OpenAI (GPT-4, GPT-4 Turbo), DALL-E 3, Runware |
+| Auth | JWT + Redis Sessions |
+| Deployment | Docker, Docker Compose, Caddy |
diff --git a/v2/Live Docs on Server/igny8-app-docs/audits/BILLING-SYSTEM-AUDIT-20260120.md b/v2/Live Docs on Server/igny8-app-docs/audits/BILLING-SYSTEM-AUDIT-20260120.md
new file mode 100644
index 00000000..f17b5fc5
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/audits/BILLING-SYSTEM-AUDIT-20260120.md
@@ -0,0 +1,484 @@
+# IGNY8 Billing System Comprehensive Audit
+
+**Date:** January 20, 2026
+**Status:** CRITICAL - Multiple issues identified
+**Reviewer:** System Audit
+
+---
+
+## Executive Summary
+
+The billing system has **fundamental architectural flaws** that cause incorrect behavior across multiple payment methods, credit management, and account activation flows. This audit identifies all issues and provides a detailed analysis of the current implementation.
+
+---
+
+## Table of Contents
+
+1. [Critical Issues](#1-critical-issues)
+2. [Account Status & Activation Flow](#2-account-status--activation-flow)
+3. [Credit System Analysis](#3-credit-system-analysis)
+4. [Invoice Management](#4-invoice-management)
+5. [Payment Method Flows](#5-payment-method-flows)
+6. [Subscription Renewal Flow](#6-subscription-renewal-flow)
+7. [Credit Package Purchases](#7-credit-package-purchases)
+8. [Data Model Issues](#8-data-model-issues)
+9. [Missing Features](#9-missing-features)
+10. [Recommended Fixes](#10-recommended-fixes)
+
+---
+
+## 1. Critical Issues
+
+### Issue #1: Credit Package Approval Adds WRONG Credits (CRITICAL)
+**Location:** `AdminBillingViewSet.approve_payment()` and `BillingViewSet.approve_payment()`
+
+**Current Behavior:**
+- When admin approves a credit package payment, the code adds `subscription.plan.included_credits` (e.g., 200 credits from the plan)
+- It should add the `credit_package.credits` from the purchased package (e.g., 500 credits)
+
+**Evidence:**
+```
+User bought 500-credit package → Admin approved → System added 200 credits (plan credits)
+```
+
+**Root Cause:** Both approval methods look for subscription/plan credits instead of checking if the invoice is for a credit package purchase via `invoice.metadata.credit_package_id`.
+
+---
+
+### Issue #2: Invoice Types Not Differentiated (CRITICAL)
+**Problem:** No clear distinction between:
+- Subscription invoices (for plan activation/renewal)
+- Credit package invoices (for additional credit purchases)
+
+**Impact:**
+- Frontend checks `hasPendingInvoice` which includes BOTH types
+- Creating a credit package invoice should NOT affect account status
+- Creating a credit package invoice should NOT block other purchases
+
+---
+
+### Issue #3: Credits Have No Validity/Expiration (CRITICAL)
+**Current State:** Credits are a simple integer counter on Account model:
+```python
+credits = models.IntegerField(default=0)
+```
+
+**Missing:**
+- No expiration date for credits
+- No validity period tracking (1 month as business rule)
+- No automatic reset mechanism
+- Purchased credits vs subscription credits not tracked separately
+
+**Impact:** Users can accumulate credits indefinitely, no monthly reset logic.
+
+---
+
+### Issue #4: Subscription Renewal Does NOT Reset Credits Correctly (CRITICAL)
+**Current Behavior:**
+- Stripe webhook `_handle_invoice_paid()` calls `CreditService.reset_credits_for_renewal()` ✓
+- Manual payment approval uses `CreditService.add_credits()` instead of reset ✗
+
+**Problem with add_credits:**
+- If user had 50 credits remaining
+- Plan gives 200 credits monthly
+- `add_credits(200)` → User now has 250 credits
+- Should be: Reset to 200 credits
+
+---
+
+### Issue #5: No Invoice Expiration/Cancellation Mechanism
+**Current State:**
+- Pending invoices remain pending indefinitely
+- No automatic void/cancellation after timeout (e.g., 24-48 hours)
+- User cannot cancel/void their own pending credit package invoices
+- No cleanup task for stale invoices
+
+---
+
+## 2. Account Status & Activation Flow
+
+### Status Values
+
+| Status | Description | When Set |
+|--------|-------------|----------|
+| `active` | Account fully operational | After successful payment or trial activation |
+| `trial` | Free trial period | On signup with free plan |
+| `pending_payment` | Awaiting first payment | After signup with paid plan, before payment |
+| `suspended` | Manually suspended | Admin action |
+| `cancelled` | Subscription cancelled | After cancellation |
+
+### Current Flow Problems
+
+#### New User with Paid Plan (Bank Transfer):
+1. User signs up selecting paid plan with bank transfer → `status = pending_payment` ✓
+2. Invoice created → Invoice `status = pending` ✓
+3. User submits bank transfer confirmation → Payment `status = pending_approval` ✓
+4. Admin approves payment → Account `status = active` ✓
+5. **BUG:** Credits added = plan credits (not credit package credits if that's what was purchased)
+
+#### Existing Active User Buying Credits (Bank Transfer):
+1. User has `status = active`
+2. User creates credit package invoice → Invoice created with `status = pending`
+3. **BUG:** Frontend incorrectly interprets this as "account has pending invoice"
+4. **BUG:** Some UI elements get disabled unnecessarily
+5. Admin approves → **BUG:** Wrong credits added (plan credits instead of package credits)
+
+---
+
+## 3. Credit System Analysis
+
+### Current Data Model
+
+**Account.credits** (integer)
+- Single counter for all credits
+- No distinction between:
+ - Plan/subscription credits
+ - Purchased credit packages
+ - Bonus/promotional credits
+- No expiration tracking
+
+**CreditTransaction** (history log)
+- Records additions and deductions
+- Transaction types: `purchase`, `subscription`, `refund`, `deduction`, `adjustment`
+- Has `balance_after` field for audit trail
+
+**CreditUsageLog** (detailed usage)
+- Per-operation usage tracking
+- Links to site, operation type, model used
+- Used for analytics and billing reports
+
+### Credit Flow Issues
+
+| Scenario | Expected Behavior | Current Behavior | Status |
+|----------|-------------------|------------------|--------|
+| New subscription | Reset credits to plan amount | Add credits to existing | ❌ BUG |
+| Subscription renewal (Stripe) | Reset credits to plan amount | Reset credits | ✓ OK |
+| Subscription renewal (Manual) | Reset credits to plan amount | Add credits | ❌ BUG |
+| Credit package purchase | Add package credits | Add plan credits | ❌ BUG |
+| Monthly reset | Reset subscription credits, keep purchased | No reset logic | ❌ MISSING |
+
+### Credit Validity Rules (Business Requirement - NOT IMPLEMENTED)
+
+Per business rules, credits should have a **1-month validity period**:
+- Subscription credits reset monthly on billing cycle
+- Purchased credits have 1-month validity from purchase date
+- Expired credits should be voided
+
+**Current Implementation:** None - credits never expire or reset.
+
+---
+
+## 4. Invoice Management
+
+### Invoice Types (Implicit, Not Enforced)
+
+| Type | Identifier | Purpose |
+|------|-----------|---------|
+| Subscription | `invoice.subscription IS NOT NULL` | Plan activation/renewal |
+| Credit Package | `invoice.metadata.credit_package_id EXISTS` | Additional credit purchase |
+| Custom | Neither | Admin-created invoices |
+
+### Invoice Status Flow
+
+```
+draft → pending → paid/void/uncollectible
+```
+
+### Issues
+
+1. **No Expiration:** Invoices stay pending forever
+2. **No User Cancellation:** Users cannot cancel their own credit package invoices
+3. **No Automatic Cleanup:** No task to void stale invoices
+4. **No Type Enforcement:** Invoice type determined by checking multiple fields
+
+### Recommended Invoice Statuses
+
+| Status | Description | Auto-Transition |
+|--------|-------------|-----------------|
+| `draft` | Created, not sent | → pending when finalized |
+| `pending` | Awaiting payment | → void after 48h (credit packages) |
+| `paid` | Payment received | Terminal |
+| `void` | Cancelled/expired | Terminal |
+| `uncollectible` | Cannot be collected | Terminal |
+
+---
+
+## 5. Payment Method Flows
+
+### Supported Payment Methods
+
+| Method | Countries | Auto-Approval | Account Activation |
+|--------|-----------|---------------|-------------------|
+| Stripe (Card) | All except PK | Yes | Immediate |
+| PayPal | All except PK | Yes | Immediate |
+| Bank Transfer | PK only | No (Manual) | After admin approval |
+
+### Stripe Flow (Working ✓)
+1. User initiates checkout → Stripe session created
+2. User completes payment on Stripe
+3. Webhook `checkout.session.completed` → Account activated, credits added
+4. Webhook `invoice.paid` (renewal) → Credits reset
+
+### PayPal Flow (Working ✓)
+1. User initiates checkout → PayPal order created
+2. User approves on PayPal
+3. Payment captured → Account activated, credits added
+
+### Bank Transfer Flow (BUGGY ❌)
+1. User initiates → Invoice created, account status may change incorrectly
+2. User submits confirmation → Payment created with `pending_approval`
+3. Admin approves → **WRONG CREDITS ADDED**
+4. User rejection flow exists but no automatic expiration
+
+---
+
+## 6. Subscription Renewal Flow
+
+### Automatic (Stripe/PayPal)
+- Stripe handles automatic billing
+- Webhook `invoice.paid` triggers renewal
+- `reset_credits_for_renewal()` correctly resets credits ✓
+
+### Manual (Bank Transfer)
+1. Task `process_subscription_renewals` creates renewal invoice
+2. Subscription status → `pending_renewal`
+3. Grace period (7 days) starts
+4. User pays manually
+5. **BUG:** Admin approval uses `add_credits()` instead of `reset_credits_for_renewal()`
+6. Task `check_expired_renewals` expires after grace period ✓
+
+---
+
+## 7. Credit Package Purchases
+
+### Current Flow
+
+1. User selects package
+2. For Stripe/PayPal: Redirect to checkout
+3. For Bank Transfer: Create invoice → Show payment form
+
+### Issues
+
+| Step | Issue | Severity |
+|------|-------|----------|
+| Invoice Creation | Uses `InvoiceService.create_credit_package_invoice()` | OK |
+| Invoice stores `credit_package_id` in metadata | OK | OK |
+| Approval reads `subscription.plan.included_credits` | **WRONG** | CRITICAL |
+| Should read `invoice.metadata.credit_package_id` → get package → add `package.credits` | Missing | CRITICAL |
+
+### Stripe Credit Purchase (Partially Working)
+- Webhook handler `_handle_credit_purchase()` correctly reads metadata
+- Uses `CreditService.add_credits()` with correct amount ✓
+
+### Manual Credit Purchase (BROKEN)
+- `approve_payment()` does NOT check if invoice is credit package
+- Adds plan credits instead of package credits
+- Completely wrong behavior
+
+---
+
+## 8. Data Model Issues
+
+### Missing Fields
+
+**Invoice Model:**
+- `invoice_type` enum: `subscription`, `credit_package`, `custom`
+- `expires_at` datetime for auto-void
+- `credit_package_id` FK (instead of in metadata)
+
+**Account Model:**
+- `subscription_credits` (monthly reset)
+- `purchased_credits` (expire after 1 month)
+- `credits_valid_until` datetime
+
+**CreditTransaction:**
+- `expires_at` datetime
+- `source_type`: `subscription`, `purchase`, `bonus`
+
+### Proposed Schema Changes
+
+```
+Account:
+ + subscription_credits: int (resets monthly)
+ + purchased_credits: int (separate pool)
+ + credits_last_reset: datetime
+
+Invoice:
+ + invoice_type: enum('subscription', 'credit_package', 'custom')
+ + expires_at: datetime (nullable)
+
+CreditPurchase: (NEW MODEL)
+ - account: FK
+ - credit_package: FK
+ - credits: int
+ - purchase_date: datetime
+ - expires_at: datetime
+ - credits_remaining: int
+ - status: enum('active', 'expired', 'used')
+```
+
+---
+
+## 9. Missing Features
+
+### Invoice Management
+- [ ] User can cancel own pending credit package invoices
+- [ ] Auto-void invoices after 24-48 hours
+- [ ] Invoice expiration emails
+- [ ] Invoice reminder emails (before expiration)
+
+### Credit Management
+- [ ] Credit expiration tracking
+- [ ] Monthly credit reset task
+- [ ] Separate subscription vs purchased credits
+- [ ] Credit validity period configuration
+- [ ] Low credit warnings before operations
+
+### Payment Management
+- [ ] Payment retry for failed payments
+- [ ] Automatic payment reminder emails
+- [ ] Payment receipt PDFs
+- [ ] Refund processing
+
+### Admin Features
+- [ ] Bulk invoice void
+- [ ] Credit adjustment with reason
+- [ ] Payment history export
+- [ ] Revenue reports
+
+---
+
+## 10. Recommended Fixes
+
+### Priority 1: Critical (Immediate Fix Required)
+
+#### Fix 1.1: Credit Package Approval Logic
+**File:** `billing_views.py` - `approve_payment()` method
+
+**Change:** Before adding credits, check if invoice has `credit_package_id` in metadata:
+```
+IF invoice.metadata.credit_package_id EXISTS:
+ package = CreditPackage.get(invoice.metadata.credit_package_id)
+ credits_to_add = package.credits
+ELSE:
+ credits_to_add = subscription.plan.included_credits
+```
+
+#### Fix 1.2: Manual Renewal Should Reset Credits
+**File:** `billing_views.py` - `approve_payment()` method
+
+**Change:** For subscription renewals, use `reset_credits_for_renewal()` instead of `add_credits()`.
+
+#### Fix 1.3: Separate Invoice Type Checking in Frontend
+**File:** `PlansAndBillingPage.tsx`
+
+**Already Fixed:** `hasPendingSubscriptionInvoice` and `hasPendingCreditInvoice` now separate.
+
+### Priority 2: High (Fix Within 1 Week)
+
+#### Fix 2.1: Add Invoice Expiration
+- Add `expires_at` field to Invoice model
+- Set expiration on creation (48 hours for credit packages)
+- Create Celery task to void expired invoices
+- Send reminder email 24 hours before expiration
+
+#### Fix 2.2: User Invoice Cancellation
+- Add API endpoint for user to cancel own pending credit package invoices
+- Add "Cancel" button in frontend invoice list
+- Set invoice status to `void` on cancellation
+
+### Priority 3: Medium (Fix Within 1 Month)
+
+#### Fix 3.1: Credit Expiration System
+- Add credit validity tracking
+- Create monthly reset task for subscription credits
+- Track purchased credits separately with expiration
+
+#### Fix 3.2: Invoice Type Field
+- Add `invoice_type` enum field
+- Migrate existing invoices based on metadata
+- Update all queries to use type field
+
+### Priority 4: Low (Future Enhancement)
+
+- Payment retry automation
+- Revenue reporting
+- Credit pool separation
+- Advanced analytics
+
+---
+
+## Appendix A: Current Code Locations
+
+| Component | File Path |
+|-----------|-----------|
+| Account Model | `auth/models.py` |
+| Plan Model | `auth/models.py` |
+| Subscription Model | `auth/models.py` |
+| Invoice Model | `business/billing/models.py` |
+| Payment Model | `business/billing/models.py` |
+| CreditPackage Model | `business/billing/models.py` |
+| CreditTransaction Model | `business/billing/models.py` |
+| CreditService | `business/billing/services/credit_service.py` |
+| InvoiceService | `business/billing/services/invoice_service.py` |
+| PaymentService | `business/billing/services/payment_service.py` |
+| Admin Approval (v1) | `business/billing/billing_views.py` |
+| Admin Approval (v2) | `modules/billing/views.py` |
+| Stripe Webhooks | `business/billing/views/stripe_views.py` |
+| PayPal Webhooks | `business/billing/views/paypal_views.py` |
+| Renewal Tasks | `business/billing/tasks/subscription_renewal.py` |
+
+---
+
+## Appendix B: Test Scenarios Required
+
+| Scenario | Current Result | Expected Result |
+|----------|---------------|-----------------|
+| PK user buys 500 credit package via bank transfer | Gets 200 credits (plan) | Gets 500 credits |
+| Active user creates credit invoice | Account blocked | Account stays active |
+| Subscription renewal (manual) | Credits added | Credits reset |
+| Invoice unpaid after 48 hours | Stays pending | Auto-void |
+| User wants to cancel own invoice | No option | Can cancel |
+| Credits unused for 1 month | Stay forever | Should expire |
+
+---
+
+## Appendix C: Affected User Flows
+
+### Flow 1: New PK User Subscription
+```
+Signup → Select Plan → Bank Transfer → Submit Confirmation → Wait for Approval → Account Active
+```
+**Issues:** None if subscription only
+
+### Flow 2: Active PK User Buys Credits
+```
+Go to Credits → Select Package → Bank Transfer → Invoice Created → Submit Confirmation → Wait → WRONG CREDITS ADDED
+```
+**Issues:**
+- Invoice creation may show incorrect UI states
+- Wrong credits added on approval
+
+### Flow 3: Active Non-PK User Buys Credits
+```
+Go to Credits → Select Package → Stripe Checkout → Payment → Credits Added
+```
+**Issues:** None - Stripe handler works correctly
+
+### Flow 4: Subscription Renewal (Manual)
+```
+Renewal Date → Invoice Created → User Pays → Admin Approves → CREDITS ADDED (not reset)
+```
+**Issues:** Should reset credits, not add
+
+---
+
+**End of Audit Report**
+
+**Next Steps:**
+1. Review this audit with team
+2. Prioritize fixes based on business impact
+3. Implement Priority 1 fixes immediately
+4. Create automated tests for all scenarios
+5. Schedule remaining fixes
+
diff --git a/v2/Live Docs on Server/igny8-app-docs/audits/IGNY8-Frontend-Component-Audit.md b/v2/Live Docs on Server/igny8-app-docs/audits/IGNY8-Frontend-Component-Audit.md
new file mode 100644
index 00000000..481e1b4b
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/audits/IGNY8-Frontend-Component-Audit.md
@@ -0,0 +1,907 @@
+# IGNY8 Frontend Component Audit & TailAdmin Migration Plan
+
+> **Generated:** 2026-03-15
+> **Scope:** `frontend/src/` — 483 TypeScript/TSX files
+> **Base Template:** TailAdmin Free React v1.8.4 (Tailwind CSS 4, React 19)
+
+---
+
+## 1. Executive Summary
+
+### Total Component Count
+
+| Category | Count |
+|----------|-------|
+| **Total .ts/.tsx files** | 483 |
+| **UI primitive components** (`components/ui/`) | 52 files → ~40 unique components |
+| **Common/shared components** (`components/common/`) | 51 files |
+| **Page files** (`pages/`) | 68 files |
+| **Feature components** (dashboard, billing, automation, etc.) | 80 files |
+| **Form components** (`components/form/`) | 25 files |
+| **Header components** | 6 files |
+| **Stores** (Zustand) | 11 files |
+| **Services/API** | 8 files (5,626 LOC) |
+| **Templates** | 5 files |
+| **Config files** | 24 files |
+| **Hooks** | 9 files |
+| **Utils** | 14 files |
+| **Context providers** | 5 files |
+| **Layout/shell** | 5 files |
+| **Marketing site** | 22 files |
+
+### Origin Breakdown
+
+| Origin | Count | Percentage |
+|--------|-------|------------|
+| **Custom** (IGNY8-specific) | ~340 | ~70% |
+| **TailAdmin-original** (unchanged) | ~25 | ~5% |
+| **TailAdmin-modified** (customized) | ~20 | ~4% |
+| **TailAdmin-derived** (structural inheritance) | ~15 | ~3% |
+| **TailAdmin demo** (static examples) | ~10 | ~2% |
+| **Third-party** | ~5 | ~1% |
+| **Infrastructure** (config, types, barrel exports) | ~68 | ~14% |
+
+### Key Findings
+
+1. **Package name confirms TailAdmin base**: `package.json` → `"name": "tailadmin-react"`, version `1.8.4`
+2. **Core shell is TailAdmin**: Layout, sidebar, header, dark mode, backdrop all follow TailAdmin Free patterns
+3. **Design system is heavily customized**: Tailwind v4 CSS-first config with `color-mix()` computed palettes, 6 base hex tokens only
+4. **Config-driven table system**: 10 pages use `TablePageTemplate` with declarative column/filter/action configs — the most mature pattern
+5. **Massive API monolith**: `api.ts` is 3,056 lines containing 90+ functions
+6. **Three-way route divergence**: Routes defined independently in `App.tsx`, `AppSidebar.tsx`, and `routes.config.ts`
+7. **Significant duplication**: Settings forms (6 pages), billing pages (3 directories), filter boilerplate (8 pages), manual tables (4+ pages)
+8. **MUI contamination**: One component (`BulkWordPressPublish` in `BulkWordPressPublish/`) uses `@mui/material` — inconsistent with rest of codebase
+9. **No `cn()` utility**: TailAdmin's `cn()` pattern not used; `clsx` + `twMerge` called separately
+10. **Style-locked components**: 7 files have `🔒 STYLE LOCKED` headers (Button, IconButton, Badge, Table, WordPressPublish components)
+
+---
+
+## 2. App Shell & Layout
+
+### Layout Structure
+
+```
+
+ ← dark mode (class strategy)
+ ← credit/page metric badges
+ ← toast notifications
+
+ ← page title/badge context
+
+
+ ← JWT auth guard
+ ← sidebar expand/collapse state
+
+ ← flex shell (sidebar + main)
+ ← left nav (290px / 90px)
+ ← mobile overlay
+ ← sticky top bar
+ ← page content
+```
+
+**Origin:** `AppLayout`, `AppSidebar`, `AppHeader`, `Backdrop` — **TailAdmin-modified**. Core structure from TailAdmin Free but heavily extended with Zustand stores, credit metrics, module system, and page context.
+
+### Sidebar Configuration
+
+| Aspect | Implementation |
+|--------|---------------|
+| **Nav structure** | **Hardcoded** in `AppSidebar.tsx` via `useMemo` arrays |
+| **Sections** | Dashboard (standalone), SETUP (Setup Wizard, Sites, Keywords Library, Thinker), WORKFLOW (Planner, Writer, Publisher, Automation) |
+| **Collapsible groups** | Yes — TailAdmin pattern with `ChevronDownIcon` rotation, animated height |
+| **Module gating** | `useModuleStore().isModuleEnabled()` (API-driven) |
+| **Admin filtering** | User role check for admin-only items |
+| **Config-driven?** | No — `routes.config.ts` exists but is **not used** by sidebar |
+| **TailAdmin patterns** | `menu-item` / `menu-item-active` / `menu-item-inactive` CSS utility classes, 90px→290px hover expansion, `no-scrollbar` |
+
+### Header Structure
+
+- Sticky header with `z-99999`
+- Mobile: hamburger toggle + logo
+- Desktop: page title with colored badge (from `PageContext`), sidebar toggle
+- Right side: `HeaderMetrics` (credit badges), route-conditional site/sector selectors (3 variants based on URL), search (⌘K), `ThemeToggleButton`, `NotificationDropdown`, `UserDropdown`
+- **Origin:** TailAdmin-modified — dropdown patterns and responsive layout from TailAdmin, but metric badges, page context, and site selectors are custom
+
+### Routing
+
+**Three independent route definitions exist (maintenance risk):**
+
+| Source | Purpose | Route Count | Synchronized? |
+|--------|---------|-------------|---------------|
+| `App.tsx` | Actual React Router routes | ~100+ | Source of truth |
+| `AppSidebar.tsx` | Sidebar navigation items | ~25 | Subset of App.tsx |
+| `routes.config.ts` | Breadcrumb metadata | ~15 | Partial, stale |
+
+- All page components (except auth) are **lazy-loaded** via `React.lazy()`
+- `ProtectedRoute` wraps all authenticated routes
+- `AdminRoute` wraps Thinker/Integration routes
+- `` handles legacy route redirects
+
+---
+
+## 3. Design System Status
+
+### Color System
+
+**Architecture:** 6 base hex tokens → `color-mix()` generates full palettes → Tailwind `@theme` consumes them
+
+| Token | Value | Palette Generated |
+|-------|-------|-------------------|
+| `--color-primary` | `#1c86d1` | `brand-25` → `brand-950` |
+| `--color-success` | `#3fcd9f` | `success-25` → `success-950` |
+| `--color-warning` | `#f87f4c` | `warning-25` → `warning-950` |
+| `--color-danger` | `#ff656f` | `error-25` → `error-950` |
+| `--color-info` | `#18b2c4` | `info-25` → `info-950` |
+| `--color-gray-base` | `#243249` | `gray-25` → `gray-950` + `gray-dark` |
+
+**All default Tailwind color palettes are disabled** (`--color-red-*: initial`, etc.). Only the above semantic palettes exist.
+
+Additional derived tokens: `--navy`, `--surface`, `--panel`, `--text`, `--text-dim`, `--stroke`, gradients.
+
+**Module color mapping** in `colors.config.ts`: Every module stage (keywords, clusters, ideas, tasks, content, images, review, approved, published) maps to `bg`, `bgLight`, `text`, `border`, `gradient`, and `cssVar` tokens.
+
+### Typography
+
+| Property | Value |
+|----------|-------|
+| **Font family** | `Outfit` (Google Fonts), `ui-monospace` for code |
+| **Title sizes** | `title-2xl` (72px) → `title-sm` (30px) |
+| **Body sizes** | `theme-xl` (20px), `theme-sm` (14px), `theme-xs` (12px) |
+| **CMS fonts** | Separate system — `Inter` for published content |
+
+### Spacing
+
+Standard Tailwind spacing scale with custom additions:
+- Border radius: `xs` (2px) → `4xl` (20px)
+- Shadows: `theme-xs` → `theme-xl`, plus `datepicker`, `focus-ring`, `tooltip`
+- Z-index: 6 tiers from `z-index-1` to `z-index-999999`
+
+### Dark Mode
+
+| Aspect | Implementation |
+|--------|---------------|
+| **Strategy** | Tailwind `class` strategy — `.dark` on `` |
+| **Storage** | `localStorage` key `"theme"` |
+| **Toggle** | `ThemeContext` → `toggleTheme()` |
+| **Default** | Light |
+| **CSS** | `@custom-variant dark (&:is(.dark *))` in design-system.css |
+| **Override vars** | Surface, panel, text, stroke, shadow overrides in `.dark` block |
+
+### Responsive Approach
+
+| Breakpoint | Value | Usage |
+|------------|-------|-------|
+| `2xsm` | 375px | Mobile-small |
+| `xsm` | 425px | Mobile |
+| `sm` | 640px | Small tablet |
+| **`md`** | **768px** | **Mobile detection** (SidebarContext) |
+| **`lg`** | **1024px** | **Primary:** sidebar show/hide, header layout |
+| **`xl`** | **1280px** | Flex layout trigger |
+| `2xl` | 1536px | Wide desktop |
+| `3xl` | 2000px | Ultra-wide |
+
+---
+
+## 4. Component Inventory
+
+### 4.1 UI Primitives (`components/ui/`)
+
+| Path | Component | Purpose | Origin | Key UI Info |
+|------|-----------|---------|--------|-------------|
+| `ui/button/Button.tsx` | `Button` | Multi-variant button (primary/secondary/outline/ghost/gradient) × 5 tones × 6 sizes | custom | 🔒 STYLE LOCKED. `twMerge` + `clsx` |
+| `ui/button/IconButton.tsx` | `IconButton` | Icon-only button with tone/variant/shape system | custom | 🔒 STYLE LOCKED |
+| `ui/button/ButtonWithTooltip.tsx` | `ButtonWithTooltip` | Wraps Button + Tooltip for disabled state hint | custom | |
+| `ui/card/Card.tsx` | `Card` + 7 sub-components | Card container system (surface/panel/frosted/borderless/gradient variants) | custom | Uses `--color-panel` CSS var |
+| `ui/modal/index.tsx` | `Modal` | Portal-based modal with backdrop blur, ESC, scroll lock | tailadmin-derived | `z-99999` convention |
+| `ui/table/index.tsx` | `Table` + 4 sub-components | Unstyled table primitives | custom | 🔒 STYLE LOCKED |
+| `ui/tabs/Tabs.tsx` | `Tabs`, `TabList`, `Tab`, `TabPanel` | Segmented control/tabs with render-prop state | tailadmin-derived | `shadow-theme-xs` token |
+| `ui/badge/Badge.tsx` | `Badge` | 4 variants × 12 tones × 3 sizes with backward-compat | custom | 🔒 STYLE LOCKED |
+| `ui/alert/Alert.tsx` | `Alert` | Inline notification banner with variant icons | tailadmin-derived | SVG icons match TailAdmin |
+| `ui/alert/AlertModal.tsx` | `AlertModal` | Centered modal alert with decorative icons | custom | |
+| `ui/accordion/Accordion.tsx` | `Accordion`, `AccordionItem` | Collapsible with animated height | custom | |
+| `ui/breadcrumb/Breadcrumb.tsx` | `Breadcrumb` | Navigation breadcrumb from items array | tailadmin-derived | Chevron SVG matches TailAdmin |
+| `ui/dropdown/Dropdown.tsx` | `Dropdown` | Portal-based positioned dropdown with edge detection | custom | Major rewrite from TailAdmin |
+| `ui/dropdown/DropdownItem.tsx` | `DropdownItem` | Menu item (button or link) | tailadmin-derived | |
+| `ui/spinner/Spinner.tsx` | `Spinner` | CSS border-based loading spinner | custom | |
+| `ui/pagination/Pagination.tsx` | `Pagination` | Full pagination with ellipsis | tailadmin-derived | Arrow SVGs match TailAdmin |
+| `ui/pagination/CompactPagination.tsx` | `CompactPagination` | Compact pagination + page size selector | custom | |
+| `ui/progress/ProgressBar.tsx` | `ProgressBar` | Horizontal progress bar | custom | |
+| `ui/tooltip/Tooltip.tsx` | `Tooltip` | Portal-based tooltip with directional arrow | custom | |
+| `ui/tooltip/EnhancedTooltip.tsx` | `EnhancedTooltip` | Rich-content tooltip with delay | custom | |
+| `ui/tooltip/CalendarItemTooltip.tsx` | `CalendarItemTooltip` | Calendar event tooltip | custom | Business-specific |
+| `ui/toast/Toast.tsx` | `ToastItem` | Individual toast notification (5s auto-dismiss) | custom | `animate-slide-in-right` |
+| `ui/toast/ToastContainer.tsx` | `ToastProvider`, `useToast` | Context-based toast system | custom | Portal, fixed top-right |
+| `ui/ribbon/Ribbon.tsx` | `Ribbon` | Decorative ribbon overlay | tailadmin-derived | Corner variant matches TailAdmin |
+| `ui/list/List.tsx` | `List` + 5 sub-components | Multi-variant list with checkbox/radio items | tailadmin-derived | Extended with checkbox/radio |
+| `ui/button-group/ButtonGroup.tsx` | `ButtonGroup`, `ButtonGroupItem` | Grouped button strip | tailadmin-derived | `shadow-theme-xs` |
+| `ui/dataview/DataView.tsx` | `DataView` + 3 sub-components | Data display container with header/toolbar/empty | custom | SaaS-specific |
+| `ui/pricing-table/PricingTable.tsx` | `PricingTable` (3 variants) | Full pricing table with toggle, discount calc | tailadmin-derived | Extended with dynamic pricing |
+| `ui/pricing-table/index.tsx` | `PricingTable` (named export) | Alternate SaaS-specific pricing table | custom | **Duplicate** of above |
+| `ui/avatar/Avatar.tsx` | `Avatar` | User avatar with status dot | tailadmin-derived | |
+| `ui/videos/*.tsx` | Video aspect ratio components | Hardcoded YouTube embeds | tailadmin-demo | **Bug**: SixteenIsToNine uses 4:3 |
+| `ui/images/*.tsx` | Image grid components | Hardcoded demo image grids | tailadmin-demo | Static — cleanup candidates |
+
+### 4.2 Common Components (`components/common/`)
+
+| Path | Component | Purpose | Origin |
+|------|-----------|---------|--------|
+| `common/PageBreadCrumb.tsx` | `PageBreadcrumb` | Simple Home > Page breadcrumb | tailadmin-original |
+| `common/ComponentCard.tsx` | `ComponentCard` | Generic card wrapper with title/description | tailadmin-modified |
+| `common/GridShape.tsx` | `GridShape` | Decorative SVG background shapes | tailadmin-original |
+| `common/ThemeTogglerTwo.tsx` | `ThemeTogglerTwo` | Floating round theme toggle button | tailadmin-original |
+| `common/PageMeta.tsx` | `PageMeta` | `` and ` ` via react-helmet | tailadmin-original |
+| `common/ScrollToTop.tsx` | `ScrollToTop` | Auto-scroll to top on route change | tailadmin-original |
+| `common/ChartTab.tsx` | `ChartTab` | Chart time period segmented control | tailadmin-original |
+| `common/ThemeToggleButton.tsx` | `ThemeToggleButton` | Theme toggle using IconButton | tailadmin-modified |
+| `common/SiteSelector.tsx` | `SiteAndSectorSelector` | Combined site + sector dropdown | custom |
+| `common/SingleSiteSelector.tsx` | `SingleSiteSelector` | Site-only dropdown | custom |
+| `common/SiteWithAllSitesSelector.tsx` | `SiteWithAllSitesSelector` | Site dropdown with "All Sites" | custom |
+| `common/SiteAndSectorSelector.tsx` | `SiteAndSectorSelector` | Combined site + sector (dual-mode) | custom |
+| `common/SectorSelector.tsx` | `SectorSelector` | Standalone sector dropdown | custom |
+| `common/SiteInfoBar.tsx` | `SiteInfoBar` | Horizontal site info bar with badges | custom |
+| `common/SiteCard.tsx` | `SiteCard` | Site card with status toggle and actions | custom |
+| `common/FormModal.tsx` | `FormModal` | Generic modal with auto-generated form | custom |
+| `common/ProgressModal.tsx` | `ProgressModal` | Multi-step AI progress modal | custom |
+| `common/ConfirmDialog.tsx` | `ConfirmDialog` | Generic confirmation modal | custom |
+| `common/ContentViewerModal.tsx` | `ContentViewerModal` | Article preview modal | custom |
+| `common/ErrorDetailsModal.tsx` | `ErrorDetailsModal` | Publishing error detail modal | custom |
+| `common/BulkStatusUpdateModal.tsx` | `BulkStatusUpdateModal` | Bulk status change modal | custom |
+| `common/BulkScheduleModal.tsx` | `BulkScheduleModal` | Bulk scheduling modal | custom |
+| `common/BulkSchedulePreviewModal.tsx` | `BulkSchedulePreviewModal` | Schedule preview before confirm | custom |
+| `common/BulkExportModal.tsx` | `BulkExportModal` | Bulk export modal | custom |
+| `common/BulkPublishingModal.tsx` | `BulkPublishingModal` | Bulk publishing queue modal | custom |
+| `common/PublishingProgressModal.tsx` | `PublishingProgressModal` | Single-content publishing progress | custom |
+| `common/PublishLimitModal.tsx` | `PublishLimitModal` | Publish limit warning | custom |
+| `common/ImageQueueModal.tsx` | `ImageQueueModal` | Image generation queue | custom |
+| `common/ScheduleContentModal.tsx` | `ScheduleContentModal` | Schedule single content | custom |
+| `common/SearchModal.tsx` | `SearchModal` | Global search (⌘K) | custom |
+| `common/SingleRecordStatusUpdateModal.tsx` | `SingleRecordStatusUpdateModal` | Single record status change | custom |
+| `common/ColumnSelector.tsx` | `ColumnSelector` | Table column visibility toggle | custom |
+| `common/ViewToggle.tsx` | `ViewToggle` | List/grid view toggle | custom |
+| `common/ToggleTableRow.tsx` | `ToggleTableRow` | Expandable table row | custom |
+| `common/HTMLContentRenderer.tsx` | `HTMLContentRenderer` | Safe HTML/JSON content renderer | custom |
+| `common/ContentImageCell.tsx` | `ContentImageCell` | Table cell with image status | custom |
+| `common/ImageResultCard.tsx` | `ImageResultCard` | AI image result display | custom |
+| `common/ImageGenerationCard.tsx` | `ImageGenerationCard` | Image generation test form | custom |
+| `common/ImageServiceCard.tsx` | `ImageServiceCard` | Image service provider card | custom |
+| `common/IntegrationCard.tsx` | `IntegrationCard` | API integration toggle card | custom |
+| `common/ValidationCard.tsx` | `ValidationCard` | Validation status card | custom |
+| `common/WorkflowInsights.tsx` | `WorkflowInsights` | Collapsible insights notifications | custom |
+| `common/PageHeader.tsx` | `PageHeader` | Page header (sets PageContext) | custom |
+| `common/PageTransition.tsx` | `PageTransition` | Route transition animation | custom |
+| `common/PageLoader.tsx` | `PageLoader` | Global loading indicator | custom |
+| `common/SuspenseLoader.tsx` | `SuspenseLoader` | Suspense fallback spinner | custom |
+| `common/ErrorBoundary.tsx` | `ErrorBoundary` | Top-level error boundary | custom |
+| `common/PageErrorBoundary.tsx` | `PageErrorBoundary` | Per-page error boundary | custom |
+| `common/GlobalErrorDisplay.tsx` | `GlobalErrorDisplay` | Global error overlay | custom |
+| `common/LoadingStateMonitor.tsx` | `LoadingStateMonitor` | Stuck-loading detector (10s timeout) | custom |
+| `common/ModuleGuard.tsx` | `ModuleGuard` | **DEPRECATED** — pass-through | custom |
+| `common/DebugSiteSelector.tsx` | `DebugSiteSelector` | Debug site selector | custom |
+
+### 4.3 Form Components (`components/form/`)
+
+| Path | Component | Purpose | Origin |
+|------|-----------|---------|--------|
+| `form/input/InputField.tsx` | `InputField` | Text input with states | tailadmin-modified |
+| `form/input/TextArea.tsx` | `TextArea` | Textarea with states | tailadmin-modified |
+| `form/input/Checkbox.tsx` | `Checkbox` | Custom checkbox with SVG | tailadmin-modified |
+| `form/input/Radio.tsx` | `Radio` | Custom radio button | tailadmin-original |
+| `form/input/RadioSm.tsx` | `RadioSm` | Small radio variant | tailadmin-original |
+| `form/input/FileInput.tsx` | `FileInput` | File input with pseudo-styling | tailadmin-original |
+| `form/switch/Switch.tsx` | `Switch` | Toggle switch | tailadmin-modified |
+| `form/group-input/PhoneInput.tsx` | `PhoneInput` | Phone with country code | tailadmin-original |
+| `form/Form.tsx` | `Form` | Simple form wrapper | tailadmin-original |
+| `form/Label.tsx` | `Label` | Label primitive | tailadmin-original |
+| `form/Select.tsx` | `Select` | Native `` styled | tailadmin-original |
+| `form/SelectDropdown.tsx` | `SelectDropdown` | Custom dropdown select | custom |
+| `form/MultiSelect.tsx` | `MultiSelect` | Multi-select with chips | tailadmin-modified |
+| `form/FormFieldRenderer.tsx` | `FormFieldRenderer` | Dynamic field renderer from config | custom |
+| `form/date-picker.tsx` | `DatePicker` | flatpickr-based date picker | third-party |
+| `form/form-elements/*.tsx` | 9 demo components | Form element showcase pages | tailadmin-original |
+
+### 4.4 Header Components (`components/header/`)
+
+| Path | Component | Purpose | Origin |
+|------|-----------|---------|--------|
+| `header/Header.tsx` | `Header` | Main header with search, theme, dropdowns | tailadmin-modified |
+| `header/SiteSwitcher.tsx` | `SiteSwitcher` | Site switch dropdown | custom |
+| `header/HeaderMetrics.tsx` | `HeaderMetrics` | Credit/page metric badges | custom |
+| `header/NotificationDropdown.tsx` | `NotificationDropdown` | Notification dropdown with API sync | custom |
+| `header/NotificationDropdownNew.tsx` | `NotificationDropdownNew` | Alternate notification dropdown (older?) | custom |
+| `header/UserDropdown.tsx` | `UserDropdown` | User profile menu | tailadmin-modified |
+
+### 4.5 Feature Components
+
+#### Dashboard (`components/dashboard/`) — 22 components, ALL custom
+
+| Component | Purpose |
+|-----------|---------|
+| `EnhancedMetricCard` | KPI card with accent border, trend, tooltip |
+| `WorkflowPipeline` / `WorkflowPipelineWidget` | Visual 7-stage pipeline |
+| `NeedsAttentionBar` | Collapsible alert bar |
+| `StandardizedModuleWidget` | Module pipeline stats |
+| `WorkflowCompletionWidget` | Time-filtered workflow stats |
+| `AIOperationsWidget` | AI operation statistics |
+| `RecentActivityWidget` | Last 5 activities |
+| `CreditsUsageWidget` / `CreditBalanceWidget` / `CreditAvailabilityWidget` | Credit displays |
+| `AutomationStatusWidget` | Automation run status |
+| `SitesOverviewWidget` | Site list with status |
+| `UsageChartWidget` | Usage chart with date range |
+| `KeywordLibraryStatsWidget` | Keyword library stats |
+| `AccountInfoWidget` | Account billing info |
+| `SiteConfigWidget` | Site setup checklist |
+| `QuickActionsWidget` | 8-step workflow guide |
+| `ContentVelocityWidget` | Content production rates |
+| `OperationsCostsWidget` | AI operation costs |
+| `ThreeWidgetFooter` / `StandardThreeWidgetFooter` | 3-column footer layouts |
+
+#### Billing (`components/billing/`) — 17 components, ALL custom
+
+Key components: `BillingBalancePanel`, `BillingUsagePanel`, `CreditInsightsCharts`, `PayInvoiceModal`, `InsufficientCreditsModal`, `PendingPaymentBanner`, `PendingPaymentView`, `PaymentHistory`, `UsageLimitsPanel`, `CreditCostBreakdownPanel`, `CreditCostsPanel`
+
+#### Automation (`components/Automation/`) — 20 components, ALL custom
+
+Top-level: `ConfigModal`, `CurrentProcessingCard`/V2, `GlobalProgressBar`, `RunHistory`, `StageCard`, `ActivityLog`
+
+DetailView: `RunSummaryCard`, `StageAccordion`, `InsightsPanel`, `EfficiencyMetrics`, `CreditBreakdownChart`, `PredictiveCostAnalysis`, `ProductionSummary`, `EnhancedRunHistory`, `MeaningfulRunHistory`, `PipelineOverviewCard`, `AttentionItemsAlert`, `RunStatisticsSummary`
+
+#### Sites (`components/sites/`) — 11 components, ALL custom
+
+Key: `SiteSetupChecklist`, `SiteProgressWidget`, `WordPressIntegrationCard`/`Form`/`Modal`, `TemplateLibrary`, `TemplateCustomizer`, `StyleEditor`, `LayoutSelector`/`Preview`, `SiteTypeBadge`
+
+#### WordPress Publish (`components/WordPressPublish/`) — 4 components, ALL custom STYLE LOCKED
+
+`WordPressPublish`, `BulkWordPressPublish`, `ContentActionsMenu`
+
+#### Other Feature Components — ALL custom
+
+| Directory | Components |
+|-----------|-----------|
+| `onboarding/` | `OnboardingWizard`, `WorkflowGuide`, Steps 1-5 (7 files) |
+| `keywords-library/` | `SectorCardsGrid`, `SectorMetricCard`, `SmartSuggestions`, `BulkAddConfirmation` |
+| `tasks/` | `KanbanBoard` (tailadmin-modified), `TaskList` (tailadmin-modified), `RelationshipMap` |
+| `content/` | `ContentFilter`, `SourceBadge`, `SyncStatusBadge` |
+| `linker/` | `LinkResults` |
+| `optimizer/` | `OptimizationScores`, `ScoreComparison` |
+| `integration/` | `IntegrationStatus`, `PlatformSelector`, `SiteIntegrationsSection` |
+| `publishing/` | `PublishingRules` |
+| `auth/` | `AdminRoute`, `ProtectedRoute`, `SignInForm`, `SignUpFormUnified` |
+| `navigation/` | `ModuleNavigationTabs` |
+| `UserProfile/` | `UserAddressCard`, `UserInfoCard`, `UserMetaCard` (tailadmin-original) |
+
+---
+
+## 5. Shared Components — Usage Patterns
+
+### Most-Used Shared Components
+
+| Component | Estimated Usage Count | Notes |
+|-----------|----------------------|-------|
+| `Button` | 50+ pages | Universal — primary UI action element |
+| `Modal` | 30+ components | All modals in codebase |
+| `Badge` | 25+ pages | Status/label badges |
+| `Card` | 20+ widgets | Dashboard widgets, cards |
+| `InputField` | 15+ forms | All text inputs |
+| `SelectDropdown` | 12+ forms | Custom dropdown selects |
+| `Dropdown`/`DropdownItem` | 10+ menus | Header, site selectors, actions |
+| `Tooltip` / `EnhancedTooltip` | 10+ | Pipeline, metrics, help text |
+| `CompactPagination` | 10 pages | All TablePageTemplate pages |
+| `Alert` | 8+ pages | Inline notifications |
+| `Switch` | 6+ | Settings toggles |
+| `Spinner` | 5+ | Loading states |
+| `Accordion` | 4+ | Automation details, settings |
+
+### Duplicate Patterns Found
+
+| Pattern | Instances | Details |
+|---------|-----------|---------|
+| **Site selector variants** | 4 | `SiteSelector`, `SingleSiteSelector`, `SiteWithAllSitesSelector`, `SiteAndSectorSelector` — could be 1 component with props |
+| **Notification dropdown** | 2 | `NotificationDropdown` + `NotificationDropdownNew` — one is likely stale |
+| **Pricing table** | 2 | `PricingTable.tsx` (default) + `index.tsx` (named) — overlapping implementations |
+| **Theme toggle** | 2 | `ThemeTogglerTwo` (floating) + `ThemeToggleButton` (header icon) |
+| **BulkWordPressPublish** | 2 | `WordPressPublish/BulkWordPressPublish.tsx` (custom UI) + `BulkWordPressPublish/BulkWordPressPublish.tsx` (**MUI-based** — different library!) |
+| **Error boundary** | 2 | `ErrorBoundary` (top-level) + `PageErrorBoundary` (per-page) — similar patterns |
+| **Three-widget footer** | 2 | `ThreeWidgetFooter` + `StandardThreeWidgetFooter` |
+| **Date formatting** | 2 | `dateUtils.ts` + `date.ts` — overlapping functions (`formatDateTime` exists in both) |
+
+### Inconsistencies
+
+| Issue | Details |
+|-------|---------|
+| **Icon library mixing** | `PaymentGatewaySelector.tsx` uses `lucide-react` instead of `../../icons`; `BulkWordPressPublish/` uses `@mui/icons-material` |
+| **Import path inconsistency** | `PaymentGatewaySelector.tsx` uses `@/` alias; rest of codebase uses relative paths |
+| **Inline buttons** | `PageErrorBoundary`, `ErrorBoundary` use raw `` instead of shared `Button` component |
+| **Inline table styling** | Sites Dashboard, Automation pages have inline table implementations instead of using `Table` primitives |
+| **Settings form patterns** | No shared settings form template — each settings page builds its own form layout |
+
+---
+
+## 6. Page-by-Page Breakdown
+
+### Template Distribution
+
+| Template | Pages Using It |
+|----------|---------------|
+| **`TablePageTemplate`** (config-driven) | Keywords, Clusters, Ideas, Tasks, Content, Review, Approved, Images, Sites/List, Setup/IndustriesSectorsKeywords |
+| **`ContentViewTemplate`** | ContentView (single article detail) |
+| **`DashboardTemplate`** (structure, not widely used) | Available but most dashboard pages are custom |
+| **`FormPageTemplate`** (settings layout) | Available but not widely adopted |
+| **Custom layouts** | ~50 pages |
+| **TailAdmin demo/reference** | UIElements, Components |
+| **Placeholder/stub** | 5 pages |
+
+### Planner Module (4 pages)
+
+| Page | Template | Notes |
+|------|----------|-------|
+| Keywords | `TablePageTemplate` | Config-driven via `keywords.config.tsx`. Auto-cluster, import/export. |
+| Clusters | `TablePageTemplate` | Config-driven via `clusters.config.tsx`. Auto-generate ideas. |
+| ClusterDetail | Custom | Tabbed detail view (keywords, ideas, stats). Manual table. |
+| Ideas | `TablePageTemplate` | Config-driven via `ideas.config.tsx`. Bulk queue to writer. |
+
+### Writer Module (6 pages)
+
+| Page | Template | Notes |
+|------|----------|-------|
+| Tasks | `TablePageTemplate` | Config-driven. Auto-generate content/images. Has Kanban/List toggles. |
+| Content | `TablePageTemplate` | Config-driven. Inline editing disabled. |
+| Review | `TablePageTemplate` | Config-driven. Content review workflow. |
+| Approved | `TablePageTemplate` | Config-driven. Scheduling, publishing. |
+| Images | `TablePageTemplate` | Config-driven. Dynamic in-article image columns. |
+| ContentView | `ContentViewTemplate` | Single article detail with scheduling, image management. |
+
+### Publisher Module (2 pages)
+
+| Page | Template | Notes |
+|------|----------|-------|
+| ContentCalendar | Custom | FullCalendar integration with month/week/list views. Custom scheduling modals. |
+| PublishSettings | Custom | Multi-tab settings (general, frequency, scheduling). Inline form. |
+
+### Sites Module (11 pages)
+
+| Page | Template | Notes |
+|------|----------|-------|
+| List | `TablePageTemplate` | Sites management list. |
+| Dashboard | Custom | Multi-section dashboard with widget grid. Manual tables. |
+| Settings | Custom | Tab-based site settings. Inline forms. |
+| Content | Custom | Site content management with source filtering. |
+| ContentStructure | Custom | Content structure config. |
+| PostEditor | Custom | Post editing interface. |
+| PageManager | Custom | Site page management. |
+| SyncDashboard | Custom | WordPress sync status. |
+| PublishingQueue | Custom | Publishing queue with status tracking. |
+| AIAutomationSettings | Custom | Per-site automation config. |
+| DeploymentPanel | Custom | **Deprecated** placeholder. |
+
+### Automation Module (4 pages)
+
+| Page | Template | Notes |
+|------|----------|-------|
+| AutomationPage | Custom | Main automation view with config, processing, history. |
+| AutomationOverview | Custom | Multi-site overview with eligibility status. |
+| AutomationRunDetail | Custom | Detailed run breakdown with stage accordion. |
+| PipelineSettings | Custom | Pipeline stage configuration form. |
+
+### Thinker Module (5 pages)
+
+| Page | Template | Notes |
+|------|----------|-------|
+| Prompts | Custom | Prompt library with CRUD and categories. |
+| AuthorProfiles | Custom | Author voice profiles with CRUD. |
+| Strategies | Custom | Content strategy management. |
+| Profile | Custom | User profile view (TailAdmin-original layout). |
+| ImageTesting | Custom | Image generation testing interface. |
+
+### Other Modules
+
+| Module | Page | Template | Notes |
+|--------|------|----------|-------|
+| Optimizer | ContentSelector | Custom | Content selection for optimization. |
+| Optimizer | AnalysisPreview | Custom | Optimization results preview. |
+| Linker | ContentList | Custom | Internal linking content list. |
+| Setup | SetupWizard | Custom | Multi-step onboarding wizard. |
+| Help | Help | Custom | Help center page. |
+| Reference | Industries, SeedKeywords | Custom | Read-only reference data. |
+
+### Settings (12 pages) — High duplication risk
+
+| Page | Notes |
+|------|-------|
+| General | Inline form layout |
+| Publishing | Tab-based publishing config |
+| Integration | Integration CRUD |
+| Plans | Plan display (duplicated in account/) |
+| Subscriptions | Subscription management (duplicated) |
+| CreditsAndBilling | Billing info (duplicated) |
+| Industries | Industry selection |
+| Account | Account settings (duplicated in account/) |
+| Sites | Sites management |
+| Users | User management (admin) |
+| System | System admin dashboard |
+| WordPressIntegrationDebug | Debug tool |
+
+### Account (7 pages) — Supersedes Settings billing
+
+| Page | Notes |
+|------|-------|
+| AccountSettingsPage | Account settings + profile |
+| ContentSettingsPage | Content generation settings |
+| NotificationsPage | Notification preferences |
+| PlansAndBillingPage | Plan + billing unified view |
+| PurchaseCreditsPage | Credit purchase flow |
+| UsageDashboardPage | Usage overview |
+| UsageAnalyticsPage | Detailed usage analytics |
+
+### Auth Pages (7 pages)
+
+| Page | Origin | Notes |
+|------|--------|-------|
+| AuthPageLayout | tailadmin-modified | Split-screen auth layout |
+| SignIn | tailadmin-modified | Custom logic, TailAdmin layout |
+| SignUp | tailadmin-modified | Custom with inline pricing |
+| ForgotPassword | tailadmin-modified | TailAdmin layout |
+| ResetPassword | tailadmin-modified | TailAdmin layout |
+| VerifyEmail | custom | Email verification flow |
+| Unsubscribe | custom | Email unsubscribe |
+
+### Demo/Reference Pages
+
+| Page | Origin | Notes |
+|------|--------|-------|
+| UIElements | tailadmin-original | 737 lines — TailAdmin component showcase |
+| Components | tailadmin-original | 680 lines — TailAdmin demo page |
+| NotFound | tailadmin-original | 404 page with grid shapes |
+
+---
+
+## 7. Stores & API Layer
+
+### Zustand Stores (11 stores, 1,802 LOC)
+
+| Store | State Managed | LOC | Persistence | API Calls |
+|-------|--------------|-----|-------------|-----------|
+| `authStore` | User, tokens, auth state | 540 | localStorage (`auth-storage`) | 5 endpoints (raw `fetch`) |
+| `siteStore` | Active site | 140 | localStorage (`site-storage`) | `GET /v1/auth/sites/` |
+| `sectorStore` | Active sector, sector list | 168 | localStorage (`sector-storage`) | `GET /v1/auth/sites/{id}/sectors/` |
+| `plannerStore` | Keywords, clusters | 110 | None | 2 endpoints (stubs for CUD) |
+| `billingStore` | Balance, usage, limits | 82 | None | 3 billing endpoints |
+| `notificationStore` | Notifications, unread count | 336 | None (in-memory) | 5 notification endpoints |
+| `onboardingStore` | Guide state | 102 | localStorage (`onboarding-storage`) | 3 user-setting endpoints |
+| `settingsStore` | Account/module settings | 195 | localStorage (`settings-storage` v4) | 6 settings endpoints |
+| `moduleStore` | Module enablement | 56 | None | 1 endpoint |
+| `columnVisibilityStore` | Column visibility per page | 53 | Direct localStorage | None |
+| `pageSizeStore` | Global page size | 20 | localStorage (`igny8-page-size`) | None |
+
+### API Service Layer (8 files, 5,626 LOC)
+
+| File | LOC | Organization | Endpoints |
+|------|-----|-------------|-----------|
+| **`api.ts`** | **3,056** | **Monolithic** — 90+ functions | 75+ endpoints across planner, writer, sites, sectors, settings, billing, keywords-library |
+| `billing.api.ts` | 1,507 | Well-organized (sectioned) | 50+ billing/payment/subscription endpoints |
+| `automationService.ts` | 438 | Well-organized | 19 automation endpoints |
+| `unifiedSettings.api.ts` | 207 | Well-organized | 2 unified settings endpoints |
+| `integration.api.ts` | 158 | Well-organized | 7 integration endpoints |
+| `notifications.api.ts` | 142 | Well-organized | 5 notification endpoints |
+| `optimizer.api.ts` | 86 | Well-organized | 3 optimizer endpoints |
+| `linker.api.ts` | 32 | Well-organized | 2 linker endpoints |
+
+**Auth pattern:** All APIs use JWT Bearer tokens via `fetchAPI()`. Token sourced from Zustand → localStorage fallback. Auto-refresh on 401. Force-logout on refresh failure.
+
+**`api.ts` should be split** — it contains planner, writer, sites, sectors, settings, billing, and keywords-library endpoints in a single file. The other service files demonstrate the correct pattern.
+
+### API Directory (`api/`)
+
+| File | Exports | Purpose |
+|------|---------|---------|
+| `optimizer.api.ts` | `optimizerApi` | Optimize, batch optimize, analyze |
+| `linker.api.ts` | `linkerApi` | Process, batch process internal links |
+
+---
+
+## 8. Styling Audit
+
+### Tailwind Configuration
+
+| Aspect | Details |
+|--------|---------|
+| **Version** | Tailwind CSS 4 (CSS-first config via `@theme` blocks) |
+| **Config file** | No `tailwind.config.js` — all in `design-system.css` `@theme` |
+| **PostCSS** | `@tailwindcss/postcss` plugin only |
+| **Dark mode** | `@custom-variant dark (&:is(.dark *))` |
+| **Default palettes** | **All disabled** (`--color-red-*: initial`, etc.) |
+| **Custom palettes** | 6 semantic scales via `color-mix()` |
+| **Font** | `Outfit` (Google Fonts) |
+| **Breakpoints** | Standard + `2xsm`(375), `xsm`(425), `3xl`(2000) |
+
+### CSS Files
+
+| File | Lines | Purpose |
+|------|-------|---------|
+| `styles/design-system.css` | 1,006 | Master design system — tokens, `@theme`, base, utilities, components |
+| `marketing/styles/marketing.css` | 210 | Marketing site — re-imports design-system + own `@theme` |
+| `components/shared/blocks/blocks.css` | 125 | CMS block component styles |
+| `components/shared/layouts/layouts.css` | 80 | CMS layout scaffolding |
+
+### Custom CSS Utilities
+
+| Category | Classes | Purpose |
+|----------|---------|---------|
+| Sidebar nav | `menu-item`, `menu-item-active`, `menu-item-inactive`, `menu-item-icon-*`, `menu-dropdown-*` | TailAdmin sidebar styling via `@utility` |
+| Tables | `igny8-table-*`, `igny8-data-row`, `igny8-skeleton-row` | Compact table styling, loading transitions |
+| Header | `igny8-header-metric*` | Header metric badges |
+| Filters | `igny8-filter-bar` | Filter bar layout |
+| Selects | `igny8-select-styled` | Native select custom chevron |
+| Keywords | `keywords-library-sector-*` | Keyword sector cards |
+| Misc | `no-scrollbar`, `chat-height`, `inbox-height` | Utility classes |
+| Animations | `animate-slide-in-right` | Toast slide-in |
+
+### CMS Theme System (`styles/cms/`)
+
+Separate TypeScript-based theme system for CMS-published content (not admin UI):
+- `colors.ts` — Color scheme definitions (blue, purple, green)
+- `typography.ts` — Typography presets (modern, classic, editorial, minimal, tech)
+- `components.ts` — Component style defaults (buttons, cards, inputs)
+- `presets.ts` — Complete theme presets (modern, classic, minimal, bold, elegant, tech)
+
+### Style Issues Found
+
+| Issue | Severity | Details |
+|-------|----------|---------|
+| Marketing CSS hex conflict | Medium | `marketing.css` has hardcoded hex color scales that conflict with `design-system.css` `color-mix()` values |
+| Hardcoded hex in blocks.css/layouts.css | Low | CMS CSS uses raw hex instead of CSS variables |
+| Dual `@custom-variant dark` | Low | Declared in both design-system.css and marketing.css (redundant) |
+| 30 `!important` usages | Low | For ApexCharts/jVectorMap overrides — acceptable |
+| 4 commented-out palettes | Low | Development artifacts in design-system.css `:root` |
+
+---
+
+## 9. Duplication & Inconsistency Report
+
+### Critical Duplications
+
+| # | Pattern | Locations | Impact |
+|----|---------|-----------|--------|
+| 1 | **Settings form layout** | 6+ Settings pages + 7 Account pages (13 total, partially overlapping) | No shared `FormPageTemplate` adoption. Each page builds its own form layout. |
+| 2 | **Billing/Credits pages** | `Settings/CreditsAndBilling` + `Billing/` (3 pages) + `account/PlansAndBillingPage` + `account/PurchaseCreditsPage` + `account/UsageDashboardPage` | 7+ pages covering similar billing/credit ground |
+| 3 | **API monolith** | `api.ts` (3,056 LOC) | 90+ functions in one file. Other service files demonstrate the pattern to follow. |
+| 4 | **Site selector components** | 4 components (`SiteSelector`, `SingleSiteSelector`, `SiteWithAllSitesSelector`, `SiteAndSectorSelector`) | Could be unified into 1 component with mode prop |
+| 5 | **Manual tables** | Sites/Dashboard, Automation pages, Billing pages, Thinker pages | Should use `Table` primitives or `TablePageTemplate` |
+| 6 | **Filter boilerplate** | 8 table pages each have ~50-100 lines of cascading filter state | Now handled by `TablePageTemplate` — older pages not migrated |
+| 7 | **Three-way route config** | `App.tsx` + `AppSidebar.tsx` + `routes.config.ts` | Navigation/routing defined in 3 places independently |
+| 8 | **Date formatting** | `dateUtils.ts` + `date.ts` | Overlapping `formatDateTime` functions |
+| 9 | **BulkWordPressPublish** | `WordPressPublish/` (custom UI) + `BulkWordPressPublish/` (MUI) | Two implementations using different UI libraries |
+| 10 | **Notification dropdown** | `NotificationDropdown` + `NotificationDropdownNew` | One appears stale |
+
+### Inconsistent UI Patterns
+
+| Pattern | Expected | Actual |
+|---------|----------|--------|
+| Icon library | `../../icons` (custom SVG) | `lucide-react` in `PaymentGatewaySelector`, `@mui/icons-material` in `BulkWordPressPublish/` |
+| Component library | Custom `ui/` | MUI (`@mui/material`) in `BulkWordPressPublish/` |
+| Import paths | Relative (`../../`) | `@/` alias in `PaymentGatewaySelector` |
+| Button usage | `` component | Raw `` in error boundaries |
+| Table implementation | `Table` primitives or `TablePageTemplate` | Inline `` in 4+ pages |
+| Form layout | Should use `FormPageTemplate` | Each settings page custom |
+| Tab component | `` from `ui/tabs/` | Inline tab implementations in 3+ pages |
+
+### Components That Should Be Shared But Aren't
+
+| Pattern | Pages Implementing It | Proposed Shared Component |
+|---------|----------------------|--------------------------|
+| Settings form page with sections + save bar | 13 settings/account pages | Adopt `FormPageTemplate` universally |
+| Status badge (content status) | 10+ pages | Already exists as `Badge` but inline styling still found |
+| Metric summary cards (4-up grid) | Dashboard, Billing, Automation | `MetricCardGrid` component |
+| Confirm + Execute pattern (modal → API → toast) | 20+ actions across pages | `useConfirmAction` hook |
+| Pagination + page size | Manual in 4+ pages | Already handled by `TablePageTemplate` — migrate remaining |
+
+---
+
+## 10. TailAdmin Pro Migration Plan
+
+### TailAdmin Pro Components That Would Replace Existing
+
+| TailAdmin Pro Component | Replaces Current | Priority |
+|------------------------|------------------|----------|
+| **Layout shell** (Sidebar, Header, Footer) | `layout/AppSidebar.tsx`, `layout/AppHeader.tsx`, `layout/Backdrop.tsx`, `layout/AppLayout.tsx` | Phase 1 |
+| **Button** (all variants) | `ui/button/Button.tsx` (🔒 STYLE LOCKED — needs careful migration) | Phase 1 |
+| **Modal/Dialog** | `ui/modal/index.tsx` | Phase 1 |
+| **Form inputs** (Input, TextArea, Select, Checkbox, Radio, Switch, FileInput) | All `form/input/` + `form/switch/` + `form/Select.tsx` | Phase 2 |
+| **Table** | `ui/table/index.tsx` (🔒 STYLE LOCKED) | Phase 2 |
+| **Badge** | `ui/badge/Badge.tsx` (🔒 STYLE LOCKED) | Phase 2 |
+| **Tabs** | `ui/tabs/Tabs.tsx` | Phase 2 |
+| **Alert** | `ui/alert/Alert.tsx` | Phase 2 |
+| **Breadcrumb** | `ui/breadcrumb/Breadcrumb.tsx` | Phase 3 |
+| **Dropdown** | `ui/dropdown/Dropdown.tsx` (custom portal — evaluate if Pro is better) | Phase 3 |
+| **Pagination** | `ui/pagination/Pagination.tsx` | Phase 3 |
+| **Avatar** | `ui/avatar/Avatar.tsx` | Phase 3 |
+| **Tooltip** | `ui/tooltip/Tooltip.tsx` (custom portal — may keep) | Phase 3 |
+| **Toast/Notification** | `ui/toast/ToastContainer.tsx` (custom system — evaluate) | Phase 3 |
+| **Progress Bar** | `ui/progress/ProgressBar.tsx` | Phase 3 |
+| **Accordion** | `ui/accordion/Accordion.tsx` | Phase 3 |
+| **Ribbon** | `ui/ribbon/Ribbon.tsx` | Phase 3 |
+| **List** | `ui/list/List.tsx` | Phase 3 |
+| **ButtonGroup** | `ui/button-group/ButtonGroup.tsx` | Phase 3 |
+| **Pricing Table** | `ui/pricing-table/PricingTable.tsx` + `index.tsx` | Phase 3 |
+| **Card** | `ui/card/Card.tsx` (custom system — evaluate) | Phase 3 |
+| **Spinner** | `ui/spinner/Spinner.tsx` | Phase 3 |
+| **Date Picker** | `form/date-picker.tsx` (flatpickr — Pro may include) | Phase 3 |
+| **Auth pages** | `AuthPages/SignIn.tsx`, `SignUp.tsx`, etc. | Phase 4 |
+| **Profile pages** | `UserProfile/*.tsx` | Phase 4 |
+| **DataView** | `ui/dataview/DataView.tsx` (custom SaaS — may not exist in Pro) | Evaluate |
+| **Video/Image demos** | `ui/videos/`, `ui/images/` | Delete — use Pro examples |
+
+### Custom Components That MUST Be Kept
+
+These contain IGNY8-specific business logic and have no TailAdmin Pro equivalent:
+
+| Category | Components | Reason |
+|----------|-----------|--------|
+| **All 5 templates** | `TablePageTemplate`, `ContentViewTemplate`, `DashboardTemplate`, `FormPageTemplate`, `SystemPageTemplate` | Core IGNY8 page architecture — config-driven |
+| **All page configs** | 12 config files in `config/pages/` | Business-specific table/filter/action definitions |
+| **All config snippets** | `columns.snippets.ts`, `filters.snippets.ts`, `actions.snippets.ts` | Reusable table config pieces |
+| **All stores** | 11 Zustand stores | Application state management |
+| **All services/API** | 8 service files | Backend API integration |
+| **All hooks** | 9 custom hooks (except `useModal`) | Business logic hooks |
+| **All utils** | 14 utility files | Business helpers |
+| **Dashboard widgets** | 22 components | IGNY8 dashboard-specific |
+| **Billing components** | 17 components | Billing/payment business logic |
+| **Automation components** | 20 components | Automation pipeline UI |
+| **WordPress integration** | 15+ components across sites/, WordPressPublish/ | CMS integration |
+| **Onboarding wizard** | 7 components | IGNY8 setup flow |
+| **Content management** | ContentFilter, SourceBadge, SyncStatusBadge | Content workflow-specific |
+| **Keywords library** | 4 components | Keyword management UI |
+| **Module navigation** | ModuleNavigationTabs | IGNY8 module system |
+| **Header metrics** | HeaderMetrics, HeaderMetricsContext | Credit display system |
+| **Page context system** | PageContext, PageHeader, PageLoader | IGNY8 page metadata |
+| **Search modal** | SearchModal (⌘K) | App-wide search |
+| **Site selectors** | 4 site/sector selector variants | Multi-site architecture |
+| **All bulk action modals** | 8+ modal components | Workflow-specific bulk operations |
+| **Colors config** | `colors.config.ts` | Module color mapping system |
+| **CMS theme system** | `styles/cms/*.ts` | Published content theming |
+| **Icons** | `icons/index.ts`, `icons/lazy.ts` | Custom icon registry (may need to merge with Pro icons) |
+
+### Migration Order (Least Risk First)
+
+#### Phase 1: Layout Shell (Highest Impact, Moderate Risk)
+
+1. **Install TailAdmin Pro** alongside existing code
+2. **Map design tokens**: Extract IGNY8's 6 base colors + `color-mix()` system → TailAdmin Pro Tailwind config
+3. **Migrate layout components**: Replace `AppLayout`, `AppSidebar`, `AppHeader`, `Backdrop` with Pro equivalents. Preserve:
+ - Module-gated sidebar items
+ - Credit metric badges in header
+ - Site/sector selectors
+ - Page context system
+4. **Migrate auth pages**: SignIn, SignUp, ForgotPassword, ResetPassword — closest to TailAdmin originals
+5. **Delete demo files**: `UIElements.tsx`, `Components.tsx`, `ui/videos/`, `ui/images/`
+
+#### Phase 2: Core UI Primitives (High Impact, Higher Risk)
+
+1. **Button** → Pro Button. Must preserve: tone/variant/size matrix, gradient variant, `🔒 STYLE LOCKED` contract. Create adapter if Pro API differs.
+2. **Table** → Pro Table. Must work with `TablePageTemplate` config system.
+3. **Form inputs** → Pro inputs. Must preserve: error/success/disabled states, `twMerge`+`clsx` composition.
+4. **Badge** → Pro Badge. Must preserve: 12 tones, 4 variants, backward-compat `color` prop.
+5. **Modal** → Pro Modal. Must preserve: portal rendering, ESC/backdrop close, scroll lock.
+6. **Tabs** → Pro Tabs.
+
+#### Phase 3: Secondary UI Components (Lower Impact, Low Risk)
+
+Breadcrumb, Dropdown, Pagination, Avatar, Tooltip, Toast, ProgressBar, Accordion, Ribbon, List, ButtonGroup, PricingTable, Card, Spinner, DatePicker.
+
+Each is a drop-in replacement with prop mapping. Can be done component-by-component.
+
+#### Phase 4: Page Templates & Cleanup
+
+1. **Unify route definitions**: Consolidate `App.tsx`, `AppSidebar.tsx`, `routes.config.ts` into a single config
+2. **Migrate manual tables**: Convert 4+ pages with inline tables to `TablePageTemplate`
+3. **Consolidate settings pages**: Adopt `FormPageTemplate` across all settings/account pages
+4. **Clean up billing duplication**: Merge Settings billing + Billing pages + Account pages
+5. **Split `api.ts`**: Break into `planner.api.ts`, `writer.api.ts`, `sites.api.ts`, `settings.api.ts`, `keywords-library.api.ts`
+6. **Consolidate site selectors**: Unify 4 variants into 1 configurable component
+7. **Remove stale components**: `ModuleGuard` (deprecated), `NotificationDropdownNew` (likely stale), `BulkWordPressPublish/` (MUI version)
+8. **Merge date utils**: Consolidate `dateUtils.ts` + `date.ts`
+9. **Fix MUI contamination**: Replace `@mui/material` usage in `BulkWordPressPublish/` with custom UI components
+
+### Color Scheme Extraction for TailAdmin Pro Config
+
+```
+Primary: #1c86d1 → brand-* scale (via color-mix)
+Success: #3fcd9f → success-* scale
+Warning: #f87f4c → warning-* scale
+Danger: #ff656f → error-* scale
+Info: #18b2c4 → info-* scale
+Gray Base: #243249 → gray-* scale
+
+Font: Outfit (Google Fonts)
+Dark mode: class strategy on
+```
+
+These 6 hex values + the `color-mix()` derivation system are the **only** color configuration needed in TailAdmin Pro's theme config. All other colors are computed.
+
+### Estimated Scope Per Section
+
+| Phase | Components Affected | Files to Modify | Risk Level |
+|-------|-------------------|-----------------|------------|
+| Phase 1: Layout Shell | 10 | ~20 | ⚠️ Moderate — touches every page via layout |
+| Phase 2: Core Primitives | 15 | ~80 (imports update) | ⚠️ High — Button/Table/Badge used everywhere |
+| Phase 3: Secondary UI | 15 | ~30 | ✅ Low — isolated replacements |
+| Phase 4: Cleanup | 30+ | ~50 | ⚠️ Moderate — structural changes |
+| **Total** | **~70 UI components** | **~180 files** | |
+
+### Pre-Migration Checklist
+
+- [ ] Obtain TailAdmin Pro React bundle
+- [ ] Verify TailAdmin Pro supports Tailwind CSS 4 (CSS-first config)
+- [ ] Map Pro component API to current component prop interfaces
+- [ ] Create component adapter layer for breaking changes
+- [ ] Set up visual regression testing (screenshots before/after)
+- [ ] Document all `🔒 STYLE LOCKED` components — these need extra care
+- [ ] Back up current `design-system.css` and all 6 hex tokens
+- [ ] Plan for icon merging (current custom SVGs + Pro icons)
+- [ ] Audit `@theme` block compatibility between current CSS and Pro CSS
+- [ ] Remove `@mui/material` dependency before migration starts
+
+---
+
+## Appendix A: Third-Party Dependencies (UI-Related)
+
+| Package | Version | Used By | Notes |
+|---------|---------|---------|-------|
+| `react` | ^19.0.0 | All | Core framework |
+| `react-dom` | ^19.0.0 | All | DOM rendering |
+| `react-router-dom` | ^7.9.5 | Routing, Link | v7 — latest |
+| `zustand` | ^5.0.8 | 11 stores | State management |
+| `tailwind-merge` | ^3.0.1 | Button, IconButton | Class dedup |
+| `clsx` | ^2.1.1 | 10+ components | Conditional classes |
+| `apexcharts` / `react-apexcharts` | ^4.1.0 / ^1.7.0 | Charts | Dashboard widgets |
+| `@fullcalendar/*` | ^6.1.15 | ContentCalendar | Calendar view |
+| `flatpickr` | ^4.6.13 | DatePicker | Date picker |
+| `react-dropzone` | ^14.3.5 | DropZone | File upload |
+| `react-dnd` / `react-dnd-html5-backend` | ^16.0.1 | KanbanBoard | Drag-and-drop |
+| `swiper` | ^11.2.3 | Marketing site | Carousel |
+| `@react-jvectormap/*` | ^1.0.4 / ^1.1.2 | Map widgets | Vector maps |
+| `react-helmet-async` | ^2.0.5 | PageMeta/SEO | Head management |
+| `lucide-react` | ^0.554.0 | PaymentGatewaySelector only | **Should not be used** — use `icons/` |
+| `@heroicons/react` | ^2.2.0 | Icons (via icons/) | SVG icon source |
+
+## Appendix B: File Count by Directory
+
+| Directory | .tsx/.ts Files |
+|-----------|---------------|
+| `components/ui/` | 52 |
+| `components/common/` | 51 |
+| `components/dashboard/` | 22 |
+| `components/Automation/` | 20 |
+| `components/billing/` | 17 |
+| `components/form/` | 25 |
+| `components/sites/` | 11 |
+| `components/onboarding/` | 7 |
+| `components/header/` | 6 |
+| `components/WordPressPublish/` | 4 |
+| `components/auth/` | 4 |
+| `components/tasks/` | 4 |
+| `components/keywords-library/` | 5 |
+| `components/content/` | 4 |
+| `components/integration/` | 3 |
+| `components/optimizer/` | 2 |
+| `components/shared/` | 22 |
+| `components/UserProfile/` | 3 |
+| `components/navigation/` | 1 |
+| `components/publishing/` | 1 |
+| `components/linker/` | 1 |
+| `components/BulkWordPressPublish/` | 1 |
+| `pages/` | 68 |
+| `store/` | 11 |
+| `services/` | 6 |
+| `api/` | 2 |
+| `config/` | 24 |
+| `templates/` | 5 |
+| `hooks/` | 9 |
+| `utils/` | 14 |
+| `context/` | 5 |
+| `layout/` | 5 |
+| `icons/` | 2 |
+| `styles/` | 5 |
+| `marketing/` | 22 |
+| `constants/` | 1 |
+| `types/` | 1 |
+| Other (main.tsx, App.tsx, etc.) | 4 |
+| **Total** | **483** |
diff --git a/v2/Live Docs on Server/igny8-app-docs/audits/INTEGRATION-SECURITY-AUDIT-2026-01-13.md b/v2/Live Docs on Server/igny8-app-docs/audits/INTEGRATION-SECURITY-AUDIT-2026-01-13.md
new file mode 100644
index 00000000..efe6ab24
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/audits/INTEGRATION-SECURITY-AUDIT-2026-01-13.md
@@ -0,0 +1,596 @@
+# IGNY8 ↔ WordPress Integration Complete Security Audit
+
+**Audit Date:** 2026-01-13
+**Auditor:** System Audit (Documentation Calibrated)
+**Scope:** Backend (Django) + WordPress Plugin + Documentation Review
+**Status:** COMPLETE - CALIBRATED WITH DOCUMENTATION
+
+---
+
+## EXECUTIVE SUMMARY
+
+This comprehensive audit examined the IGNY8 backend and WordPress plugin integration system, cross-referencing against all existing documentation. The audit identified **17 security vulnerabilities** (3 critical, 5 high, 6 medium, 3 low), **6 unused/redundant database fields**, **2 major data duplication issues**, and several **documentation vs. implementation gaps**.
+
+**Key Findings:**
+- API keys stored in plain text (no encryption) despite documentation claims
+- Public endpoints expose sensitive configuration data
+- Timing attack vulnerability in Bearer token validation
+- Documentation states "credentials encrypted at rest" but encryption NOT implemented
+- Several fields documented but never used
+- Missing scheduled publishing task from Celery Beat (documented but not configured)
+
+---
+
+## PART 1: DOCUMENTATION VS IMPLEMENTATION GAPS
+
+### 1.1 Critical Discrepancies Found
+
+| Documentation Claim | Reality | Impact |
+|---------------------|---------|--------|
+| "API keys encrypted at rest" (INTEGRATIONS.md) | Plain text CharField in database | **CRITICAL** - False security assumption |
+| "Webhook signature verification" (INTEGRATIONS.md) | No signature verification implemented | **HIGH** - Anyone with key can spoof webhooks |
+| "Rate limiting on webhook endpoint" (INTEGRATIONS.md) | Webhooks explicitly disable throttling (`NoThrottle`) | **HIGH** - DoS possible |
+| "auto_publish_enabled triggers WordPress push" | Automation Stage 7 sets status but does NOT trigger WP push | **MEDIUM** - Manual publish required |
+| "Scheduled auto-publish task active" | Task exists but NOT in Celery Beat schedule | **MEDIUM** - Content sits unpublished |
+| SiteIntegration.api_key field (INTEGRATIONS.md line 97) | API key stored in Site.wp_api_key, NOT SiteIntegration | Documentation outdated |
+| "credentials_json stores WordPress credentials" | credentials_json is empty for WordPress; Site.wp_api_key is source of truth | Documentation outdated |
+
+### 1.2 Documentation Accuracy Summary
+
+| Document | Accuracy | Issues Found |
+|----------|----------|--------------|
+| WORDPRESS-INTEGRATION-FLOW.md | 90% | Accurate on auth, slight gaps on scheduling |
+| WORDPRESS-INTEGRATION.md | 85% | Missing encryption truth, good on plugin distribution |
+| PUBLISHER.md | 95% | Accurate on models and flows |
+| INTEGRATIONS.md | 70% | Contains outdated field references, false encryption claim |
+| SCHEDULED-CONTENT-PUBLISHING.md | 95% | Accurate on Celery tasks, correctly notes site_status vs status |
+| CONTENT-PIPELINE.md | 90% | Accurate on stages, slight gap on Stage 8 auto-publish |
+
+---
+
+## PART 2: SYSTEM ARCHITECTURE (VERIFIED)
+
+### 2.1 Actual Data Flow (Verified Against Code)
+
+```
+IGNY8 Backend WordPress Plugin
+┌──────────────────────┐ ┌──────────────────────┐
+│ Site Model │ │ wp_options │
+│ ├─ wp_api_key ◄──────┼────────────────┼─► igny8_api_key │
+│ │ (SINGLE SOURCE) │ │ igny8_site_id │
+│ ├─ domain │ │ igny8_integration_id│
+│ └─ wp_url (LEGACY) │ │ │
+│ │ │ Post Meta │
+│ SiteIntegration │ │ ├─ _igny8_content_id │
+│ ├─ config_json │ │ ├─ _igny8_task_id │
+│ │ (site_url only) │ │ └─ _igny8_last_synced│
+│ ├─ credentials_json │ │ │
+│ │ (EMPTY for WP!) │ │ │
+│ └─ sync_status │ │ │
+│ │ │ │
+│ Content Model │ │ │
+│ ├─ external_id ◄─────┼────────────────┼─► post_id │
+│ ├─ external_url │ │ │
+│ ├─ status (editorial)│ │ │
+│ └─ site_status │ │ │
+│ (publishing) │ │ │
+└──────────────────────┘ └──────────────────────┘
+```
+
+### 2.2 Authentication Flow (Verified)
+
+**IGNY8 → WordPress:**
+```python
+# publisher_service.py (line 136, 144)
+destination_config = {
+ 'api_key': site.wp_api_key, # FROM SITE MODEL
+ 'site_url': site.domain or site.wp_url # Fallback to legacy
+}
+
+# wordpress_adapter.py
+headers = {
+ 'X-IGNY8-API-KEY': api_key, # Primary method
+ 'Content-Type': 'application/json'
+}
+```
+
+**WordPress → IGNY8:**
+```php
+// Plugin: check_permission() method
+$stored_api_key = get_option('igny8_api_key');
+$header_api_key = $request->get_header('x-igny8-api-key');
+
+// CORRECT: hash_equals for X-IGNY8-API-KEY
+if (hash_equals($stored_api_key, $header_api_key)) return true;
+
+// VULNERABLE: strpos for Bearer token
+if (strpos($auth_header, 'Bearer ' . $stored_api_key) !== false) return true;
+```
+
+### 2.3 API Key Generation (Verified)
+
+```
+POST /api/v1/integration/integrations/generate-api-key/
+Body: { "site_id": 123 }
+
+Key Format: igny8_site_{site_id}_{timestamp_ms}_{random_10_chars}
+Example: igny8_site_123_1736780400000_a7b9c3d2e1
+
+Storage: Site.wp_api_key (CharField, plain text, max 255)
+Recovery: NOT POSSIBLE - shown once on generation
+Revocation: Sets Site.wp_api_key = None
+```
+
+---
+
+## PART 3: CONTENT STATUS SYSTEM (DOCUMENTED CORRECTLY)
+
+### 3.1 Two-Status Architecture
+
+The documentation correctly describes the dual-status system:
+
+| Field | Purpose | Values |
+|-------|---------|--------|
+| `Content.status` | Editorial workflow | draft → review → approved → (published - legacy) |
+| `Content.site_status` | WordPress publishing | not_published → scheduled → publishing → published / failed |
+
+### 3.2 Publishing Flow Paths
+
+**Path 1: Manual Publish (Working)**
+```
+User clicks "Publish" → ContentViewSet.publish_to_wordpress
+ → Celery task: publish_content_to_wordpress
+ → WordPress API call
+ → Update external_id, external_url, site_status='published'
+```
+
+**Path 2: Scheduled Publish (Partially Working)**
+```
+schedule_approved_content (hourly)
+ → Find approved content with site_status='not_published'
+ → Assign scheduled_publish_at
+ → Set site_status='scheduled'
+
+process_scheduled_publications (every 5 min)
+ → Find content where scheduled_publish_at <= now
+ → Queue publish_content_to_wordpress task
+ → WordPress API call
+```
+
+**Path 3: Automation Stage 7 (NOT TRIGGERING WP PUSH)**
+```
+Automation Stage 7:
+ → Content.status = 'published' (legacy status change)
+ → NO site_status change
+ → NO WordPress API call queued
+ → Content sits with site_status='not_published'
+```
+
+**GAP IDENTIFIED:** Automation Stage 7 does NOT call publishing scheduler or queue WordPress task.
+
+---
+
+## PART 4: SECURITY VULNERABILITIES (VERIFIED)
+
+### 4.1 CRITICAL ISSUES
+
+#### CRITICAL-1: API Keys Stored in Plain Text
+
+**Location:** Backend - `Site.wp_api_key` field (auth/models.py line 491)
+**Documentation Claim:** "Credentials encrypted at rest" (INTEGRATIONS.md line 345)
+**Reality:** CharField stores plain text - NO encryption
+
+**Evidence:**
+```python
+# auth/models.py
+wp_api_key = models.CharField(max_length=255, blank=True, null=True,
+ help_text="API key for WordPress integration via IGNY8 WP Bridge plugin")
+```
+
+**Impact:** Database compromise exposes ALL WordPress API keys
+**Risk Score:** 9/10
+
+---
+
+#### CRITICAL-2: Timing Attack in Bearer Token Validation
+
+**Location:** Plugin - `class-igny8-rest-api.php:140`
+**Impact:** API key can be guessed character-by-character
+
+**Vulnerable Code:**
+```php
+// Uses strpos (VULNERABLE)
+if (strpos($auth_header, 'Bearer ' . $stored_api_key) !== false)
+
+// Should use hash_equals (SAFE)
+if (hash_equals($stored_api_key, substr($auth_header, 7)))
+```
+
+**Risk Score:** 8/10
+
+---
+
+#### CRITICAL-3: Diagnostic Logging Exposes Sensitive Data
+
+**Location:** Plugin - `class-igny8-rest-api.php:533-565`
+**Impact:** Full request bodies logged including all content
+
+**Evidence:**
+```php
+error_log('========== RAW REQUEST BODY ==========');
+error_log($raw_body);
+error_log('========== PARSED JSON DATA ==========');
+error_log(print_r($content_data, true));
+```
+
+**Risk Score:** 8/10
+
+---
+
+### 4.2 HIGH SEVERITY ISSUES
+
+#### HIGH-1: Public Endpoints Expose Configuration
+
+**Verified Endpoints:**
+| Endpoint | Permission | Data Exposed |
+|----------|------------|--------------|
+| `/wp-json/igny8/v1/status` | `__return_true` (PUBLIC) | has_api_key, connected, versions |
+| `/wp-json/igny8/v1/site-metadata/` | `__return_true` (PUBLIC) | post_types, taxonomies, counts |
+
+**Note:** Documentation (WORDPRESS-INTEGRATION-FLOW.md line 86-91) does NOT flag these as security issues.
+
+---
+
+#### HIGH-2: Permission Architecture Inconsistency
+
+**Location:** `test_connection_collection` endpoint
+**Permission:** `AllowAny` (then checks auth manually inside view)
+
+**Documentation:** Does not mention this inconsistency.
+
+---
+
+#### HIGH-3: No Webhook Signature Verification
+
+**Documentation Claim:** "Optional signature verification" (INTEGRATIONS.md line 349)
+**Reality:** Only API key validation, NO HMAC signature verification
+
+**Code Evidence (webhooks.py):**
+```python
+api_key = request.headers.get('X-IGNY8-API-KEY')
+if not stored_api_key or stored_api_key != api_key:
+ return error_response('Invalid API key', ...)
+# NO signature validation
+```
+
+---
+
+#### HIGH-4: Webhooks Disable Rate Limiting
+
+**Documentation Claim:** "Rate limiting on webhook endpoint" (INTEGRATIONS.md line 351)
+**Reality:** Webhooks explicitly use `NoThrottle` class
+
+---
+
+#### HIGH-5: Encryption Falls Back Silently
+
+**Location:** Plugin - `functions.php:31-48`
+**Impact:** Admin unaware if encryption fails
+
+---
+
+### 4.3 MEDIUM SEVERITY ISSUES
+
+1. **SSRF Risk in Connection Testing** - No IP validation
+2. **credentials_json Exposed in Serializer** - All fields returned
+3. **Flexible ID Lookup Enables Enumeration** - `/post-status/{id}` accepts both IDs
+4. **Excessive API Request Logging** - Keys in logs
+5. **WordPress URL Not Validated** - No HTTPS enforcement
+6. **API Key Partially Visible** - `/verify-key` shows 15-char prefix
+
+### 4.4 LOW SEVERITY ISSUES
+
+1. Version disclosure in multiple endpoints
+2. No CORS headers defined on plugin endpoints
+3. Webhook logs stored long-term (500 entries)
+
+---
+
+## PART 5: REST API ENDPOINTS INVENTORY (VERIFIED)
+
+### 5.1 Backend Endpoints (Verified Against urls.py)
+
+| Endpoint | Method | Permission | Documentation |
+|----------|--------|------------|---------------|
+| `/api/v1/integration/integrations/` | CRUD | IsAuthenticatedAndActive + IsEditorOrAbove | Correct |
+| `/api/v1/integration/integrations/test-connection/` (collection) | POST | **AllowAny** | NOT documented as AllowAny |
+| `/api/v1/integration/integrations/{id}/test-connection/` | POST | Authenticated | Correct |
+| `/api/v1/integration/integrations/generate-api-key/` | POST | Authenticated | Correct |
+| `/api/v1/integration/integrations/revoke-api-key/` | POST | Authenticated | Correct |
+| `/api/v1/integration/webhooks/wordpress/status/` | POST | AllowAny (header auth) | Correct |
+| `/api/v1/integration/webhooks/wordpress/metadata/` | POST | AllowAny (header auth) | Correct |
+| `/api/v1/publisher/publish/` | POST | Authenticated | Correct |
+| `/api/v1/writer/content/{id}/publish_to_wordpress/` | POST | Authenticated | Correct |
+| `/api/v1/writer/content/{id}/schedule/` | POST | Authenticated | Correct (v1.3.2) |
+| `/api/v1/writer/content/{id}/unschedule/` | POST | Authenticated | Correct (v1.3.2) |
+
+### 5.2 Plugin Endpoints (Verified Against class-igny8-rest-api.php)
+
+| Endpoint | Method | Permission | Documentation Match |
+|----------|--------|------------|---------------------|
+| `/wp-json/igny8/v1/status` | GET | **PUBLIC** | Not flagged as security issue |
+| `/wp-json/igny8/v1/site-metadata/` | GET | **PUBLIC** (internal check) | Not flagged |
+| `/wp-json/igny8/v1/verify-key` | GET | check_permission | Correct |
+| `/wp-json/igny8/v1/publish` | POST | check_permission | Correct |
+| `/wp-json/igny8/v1/post-by-content-id/{id}` | GET | check_permission | Correct |
+| `/wp-json/igny8/v1/post-by-task-id/{id}` | GET | check_permission | Correct |
+| `/wp-json/igny8/v1/post-status/{id}` | GET | check_permission | Correct |
+| `/wp-json/igny8/v1/event` | POST | verify_webhook_secret | Correct |
+
+---
+
+## PART 6: DATA STORAGE ANALYSIS (VERIFIED)
+
+### 6.1 Site Model Fields (auth/models.py)
+
+| Field | Documentation Status | Actual Usage | Action |
+|-------|---------------------|--------------|--------|
+| `wp_api_key` | Documented as primary | ACTIVE - single source of truth | KEEP + ENCRYPT |
+| `domain` | Documented | ACTIVE - WordPress URL | KEEP |
+| `wp_url` | Documented as "deprecated" | LEGACY - fallback in publisher_service | EVALUATE for removal |
+| `wp_username` | Documented as "deprecated" | **ZERO USAGE** in codebase | **REMOVE** |
+| `wp_app_password` | Documented as "deprecated" | **ZERO USAGE** in codebase | **REMOVE** |
+
+### 6.2 SiteIntegration Model Fields
+
+| Field | Documentation Status | Actual Usage | Action |
+|-------|---------------------|--------------|--------|
+| `site` | Documented | ACTIVE | KEEP |
+| `platform` | Documented | ACTIVE ('wordpress') | KEEP |
+| `config_json` | Documented as storing URL | ACTIVE (site_url only) | KEEP |
+| `credentials_json` | Documented as storing creds | **EMPTY** for WordPress | Documentation outdated |
+| `sync_status` | Documented | ACTIVE | KEEP |
+
+**Documentation Gap:** INTEGRATIONS.md line 97-98 shows `api_key` and `username` as SiteIntegration fields, but WordPress actually uses Site.wp_api_key.
+
+### 6.3 Content Model Fields
+
+| Field | Documentation Status | Actual Usage | Action |
+|-------|---------------------|--------------|--------|
+| `status` | Correctly documented as editorial | ACTIVE | KEEP |
+| `site_status` | Correctly documented as publishing | ACTIVE | KEEP |
+| `external_id` | Documented | ACTIVE - WordPress post ID | KEEP |
+| `external_url` | Documented | ACTIVE - WordPress URL | KEEP |
+| `external_type` | Not documented | **NEVER USED** | **REMOVE** |
+| `external_metadata` | Not documented | Only set to {} | **REMOVE** |
+| `sync_status` (on Content) | Not documented | **NEVER USED** | **REMOVE** |
+
+### 6.4 ContentTaxonomy Model Fields
+
+| Field | Documentation Status | Actual Usage | Action |
+|-------|---------------------|--------------|--------|
+| `external_id` | Documented | ACTIVE | KEEP |
+| `external_taxonomy` | Documented | ACTIVE | KEEP |
+| `sync_status` | Not documented | **NEVER USED** | **REMOVE** |
+
+---
+
+## PART 7: CELERY TASKS STATUS (VERIFIED)
+
+### 7.1 Scheduled Tasks (celery.py Beat Schedule)
+
+| Task | Schedule | Documentation | Status |
+|------|----------|---------------|--------|
+| `schedule_approved_content` | Every hour | Documented (SCHEDULED-CONTENT-PUBLISHING.md) | **ACTIVE** |
+| `process_scheduled_publications` | Every 5 min | Documented | **ACTIVE** |
+| `publish_content_to_wordpress` | On-demand | Documented | **ACTIVE** |
+
+### 7.2 Missing Tasks (Documented but NOT Scheduled)
+
+**`process_pending_wordpress_publications`** - WORDPRESS-INTEGRATION-FLOW.md mentions this task exists but notes:
+> "CURRENT STATUS: This task is NOT in Celery Beat schedule!"
+
+This matches the documentation correctly.
+
+---
+
+## PART 8: PLUGIN DISTRIBUTION SYSTEM (VERIFIED)
+
+### 8.1 Plugin Models (Correctly Documented)
+
+| Model | Documentation | Implementation | Match |
+|-------|---------------|----------------|-------|
+| `Plugin` | WORDPRESS-INTEGRATION.md | plugins/models.py | ✅ |
+| `PluginVersion` | Documented with all fields | Matches implementation | ✅ |
+| `PluginInstallation` | Documented | Matches implementation | ✅ |
+| `PluginDownload` | Documented | Matches implementation | ✅ |
+
+### 8.2 Plugin API Endpoints (Correctly Documented)
+
+| Endpoint | Documentation | Implementation |
+|----------|---------------|----------------|
+| `/api/plugins/{slug}/download/` | INDEX.md line 24 | ✅ Working |
+| `/api/plugins/{slug}/check-update/` | INDEX.md line 25 | ✅ Working |
+| `/api/plugins/{slug}/info/` | INDEX.md line 26 | ✅ Working |
+| `/api/plugins/{slug}/register/` | INDEX.md line 27 | ✅ Working |
+| `/api/plugins/{slug}/health-check/` | INDEX.md line 28 | ✅ Working |
+
+---
+
+## PART 9: UNUSED/DEAD CODE INVENTORY
+
+### 9.1 Fields to Remove (Verified Zero Usage)
+
+| Model | Field | Evidence |
+|-------|-------|----------|
+| Site | `wp_username` | `grep -r "wp_username" --include="*.py"` = 0 results |
+| Site | `wp_app_password` | `grep -r "wp_app_password" --include="*.py"` = 0 results |
+| Content | `external_type` | Never read in codebase |
+| Content | `external_metadata` | Only set to {} in publisher_service.py |
+| Content | `sync_status` | SiteIntegration.sync_status used instead |
+| ContentTaxonomy | `sync_status` | Never read or written |
+
+### 9.2 Redundant Code Paths
+
+1. **Duplicate Connection Testing** - Two endpoints with same logic
+2. **Duplicate API Key Validation** - Same validation in 4+ files
+3. **Dead Admin Bulk Actions** - `bulk_trigger_sync()`, `bulk_test_connection()` have TODO comments
+
+### 9.3 Plugin Unused Options
+
+| Option | Status |
+|--------|--------|
+| `igny8_access_token` | Redundant with igny8_api_key |
+| `igny8_access_token_issued` | Referenced but not used in auth |
+
+---
+
+## PART 10: DATA DUPLICATION ISSUES
+
+### 10.1 API Key Duplication
+
+| Location | Field | Role |
+|----------|-------|------|
+| Django Site model | `wp_api_key` | **PRIMARY** (single source of truth) |
+| Django SiteIntegration | `credentials_json` | EMPTY for WordPress |
+| WordPress | `igny8_api_key` | COPY (must match primary) |
+| WordPress | `igny8_access_token` | REDUNDANT (should remove) |
+
+**Risk:** Documentation mentions credentials_json but WordPress doesn't use it.
+
+### 10.2 URL Duplication
+
+| Location | Field | Role |
+|----------|-------|------|
+| Site.domain | Primary | ACTIVE |
+| Site.wp_url | Legacy | Fallback only |
+| SiteIntegration.config_json['site_url'] | Configuration | ACTIVE |
+
+---
+
+## PART 11: RECOMMENDATIONS
+
+### Immediate Actions (Critical)
+
+| Priority | Issue | Action | Documentation Update |
+|----------|-------|--------|---------------------|
+| 1 | Plain text API keys | Implement field encryption | Update INTEGRATIONS.md |
+| 2 | Timing attack (strpos) | Use hash_equals everywhere | Update plugin docs |
+| 3 | Diagnostic logging | Remove or conditional | Update plugin docs |
+| 4 | Public endpoints | Secure /status and /site-metadata | Update WORDPRESS-INTEGRATION-FLOW.md |
+
+### Short-term Actions (High)
+
+| Priority | Issue | Action | Documentation Update |
+|----------|-------|--------|---------------------|
+| 5 | Permission inconsistency | Fix test_connection_collection | Update ENDPOINTS.md |
+| 6 | No webhook signatures | Implement HMAC verification | Update INTEGRATIONS.md |
+| 7 | No rate limiting | Enable throttling on webhooks | Update INTEGRATIONS.md |
+| 8 | API key in response | Remove from verify-key | N/A |
+
+### Documentation Updates Required
+
+| Document | Updates Needed |
+|----------|----------------|
+| INTEGRATIONS.md | Remove "encrypted at rest" claim, fix field references |
+| WORDPRESS-INTEGRATION-FLOW.md | Flag public endpoints as security concern |
+| ENDPOINTS.md | Note AllowAny on test-connection collection |
+
+### Cleanup Actions
+
+| Action | Fields to Remove | Migration Required |
+|--------|------------------|-------------------|
+| Remove from Site | wp_username, wp_app_password | Yes |
+| Remove from Content | external_type, external_metadata, sync_status | Yes |
+| Remove from ContentTaxonomy | sync_status | Yes |
+| Remove from Plugin | igny8_access_token option | Plugin update |
+
+---
+
+## PART 12: PUBLISHING WORKFLOW SUMMARY
+
+### What's Working
+
+| Flow | Status | Notes |
+|------|--------|-------|
+| Manual publish button | ✅ Working | ContentViewSet.publish_to_wordpress |
+| Scheduled publishing | ✅ Working | Celery Beat tasks active |
+| Plugin distribution | ✅ Working | Auto-update mechanism functional |
+| Webhook status sync | ✅ Working | WordPress → IGNY8 updates |
+
+### What's NOT Working
+
+| Flow | Status | Issue |
+|------|--------|-------|
+| Automation Stage 7 → WP | ❌ Broken | Sets status but no WP push |
+| Content update sync | ❌ Missing | No republish capability |
+| WordPress → IGNY8 import | ❌ Missing | No pull sync feature |
+
+### Documented But Not Implemented
+
+| Feature | Documentation Reference | Status |
+|---------|------------------------|--------|
+| Webhook signature verification | INTEGRATIONS.md line 349 | NOT implemented |
+| Webhook rate limiting | INTEGRATIONS.md line 351 | NOT implemented |
+| Credential encryption | INTEGRATIONS.md line 345 | NOT implemented |
+
+---
+
+## APPENDIX A: FILES AUDITED
+
+### Backend Files
+- `backend/igny8_core/auth/models.py` - Site model, wp_api_key
+- `backend/igny8_core/business/integration/models.py` - SiteIntegration, SyncEvent
+- `backend/igny8_core/business/publishing/models.py` - PublishingRecord
+- `backend/igny8_core/business/content/models.py` - Content, external fields
+- `backend/igny8_core/modules/integration/views.py` - API endpoints
+- `backend/igny8_core/modules/integration/webhooks.py` - Webhook handlers
+- `backend/igny8_core/business/publishing/services/publisher_service.py`
+- `backend/igny8_core/business/publishing/services/adapters/wordpress_adapter.py`
+- `backend/igny8_core/tasks/publishing_scheduler.py` - Celery tasks
+- `backend/igny8_core/tasks/wordpress_publishing.py` - Publishing task
+- `backend/igny8_core/celery.py` - Beat schedule
+
+### Plugin Files
+- `plugins/wordpress/source/igny8-wp-bridge/includes/class-igny8-rest-api.php`
+- `plugins/wordpress/source/igny8-wp-bridge/includes/class-igny8-api.php`
+- `plugins/wordpress/source/igny8-wp-bridge/includes/class-igny8-webhooks.php`
+- `plugins/wordpress/source/igny8-wp-bridge/includes/functions.php`
+
+### Documentation Files Reviewed
+- `docs/60-PLUGINS/WORDPRESS-INTEGRATION.md`
+- `docs/60-PLUGINS/INDEX.md`
+- `docs/60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md`
+- `docs/50-DEPLOYMENT/WORDPRESS-INTEGRATION-FLOW.md`
+- `docs/10-MODULES/PUBLISHER.md`
+- `docs/10-MODULES/INTEGRATIONS.md`
+- `docs/40-WORKFLOWS/CONTENT-PIPELINE.md`
+- `docs/40-WORKFLOWS/SCHEDULED-CONTENT-PUBLISHING.md`
+- `docs/00-SYSTEM/ARCHITECTURE.md`
+- `docs/20-API/ENDPOINTS.md`
+
+---
+
+## APPENDIX B: VULNERABILITY SEVERITY MATRIX
+
+| ID | Title | CVSS | Documentation Claim | Reality |
+|----|-------|------|---------------------|---------|
+| CRITICAL-1 | Plain text API keys | 9.0 | "Encrypted at rest" | Plain text CharField |
+| CRITICAL-2 | Timing attack | 8.0 | Not mentioned | strpos vulnerability |
+| CRITICAL-3 | Diagnostic logging | 8.0 | Not mentioned | Full request bodies logged |
+| HIGH-1 | Public endpoints | 7.0 | Not flagged | Information disclosure |
+| HIGH-2 | Permission inconsistency | 6.5 | Not documented | AllowAny misuse |
+| HIGH-3 | No webhook signatures | 6.0 | "Optional" | Not implemented at all |
+| HIGH-4 | No rate limiting | 5.5 | "Rate limiting enabled" | NoThrottle class used |
+| HIGH-5 | Silent encryption fail | 6.0 | Not mentioned | Falls back to plain text |
+
+---
+
+**End of Calibrated Audit Report**
+
+**Next Steps:**
+1. Review findings with development team
+2. Prioritize critical security fixes
+3. Update documentation to match reality
+4. Create migration plan for field removal
+5. Implement encryption before production
diff --git a/v2/Live Docs on Server/igny8-app-docs/audits/pages-audit.md b/v2/Live Docs on Server/igny8-app-docs/audits/pages-audit.md
new file mode 100644
index 00000000..99376dea
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/audits/pages-audit.md
@@ -0,0 +1,1139 @@
+# Pages Audit — Complete Inventory
+
+> Generated from comprehensive file-by-file review of `frontend/src/pages/`
+
+---
+
+## Legend
+
+| Field | Description |
+|---|---|
+| **Component** | Export name |
+| **Purpose** | One-line description |
+| **Origin** | `tailadmin-original` · `tailadmin-modified` · `custom` · `placeholder` |
+| **UI Patterns** | Layout/interaction patterns used |
+| **Shared Components** | Imports from `components/` |
+| **Local Sub-components** | Page-specific child components (in `components/` subdirs) |
+| **Pattern Duplication** | Repeated code that could be extracted |
+| **Template** | Which template system is used (if any) |
+
+---
+
+## 1. Dashboard
+
+### Dashboard/Home.tsx (~300 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Home` |
+| **Purpose** | Main dashboard with workflow pipeline, quick actions, analytics widgets, and site overview |
+| **Origin** | `custom` |
+| **UI Patterns** | Widget grid layout (3-col responsive), floating action button, site filter, AI period filter |
+| **Shared Components** | `PageMeta`, `WorkflowGuide`, `Button`, `usePageContext` |
+| **Local Sub-components** | `NeedsAttentionBar`, `WorkflowPipelineWidget`, `QuickActionsWidget`, `AIOperationsWidget`, `RecentActivityWidget`, `ContentVelocityWidget`, `AutomationStatusWidget`, `SitesOverviewWidget`, `CreditsUsageWidget`, `AccountInfoWidget`, `KeywordLibraryStatsWidget` (all from `components/dashboard/`) |
+| **Pattern Duplication** | None — all widgets properly extracted |
+| **Template** | None (custom widget grid) |
+
+---
+
+## 2. Planner
+
+### Planner/Keywords.tsx (~800 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Keywords` |
+| **Purpose** | Keyword management table with CRUD, filters, bulk actions, import/export, auto-clustering |
+| **Origin** | `custom` |
+| **UI Patterns** | Config-driven table, cascading filters from backend, debounced search, volume range dropdown with refs, header metrics from API totals, bulk action with progress modal |
+| **Shared Components** | `PageHeader`, `StandardThreeWidgetFooter`, `FormModal`, `ProgressModal`, `useProgressModal`, `useToast`, `useSiteStore`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | `useKeywordsImportExport` hook (from `components/keywords-library/`) |
+| **Pattern Duplication** | Cascading filter pattern repeated in Clusters/Ideas; header metrics calculation repeated in all Planner pages; volume range dropdown is inline (not extracted) |
+| **Template** | `TablePageTemplate` + `createKeywordsPageConfig()` |
+
+### Planner/Clusters.tsx (~700 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Clusters` |
+| **Purpose** | Cluster management table with CRUD, filters, bulk idea generation |
+| **Origin** | `custom` |
+| **UI Patterns** | Config-driven table, cascading filters, header metrics from API totals, StandardThreeWidgetFooter |
+| **Shared Components** | `PageHeader`, `StandardThreeWidgetFooter`, `FormModal`, `ProgressModal`, `useToast`, `useSiteStore`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Near-identical to Keywords.tsx — cascading filter loading, header metrics pattern, footer widget pattern |
+| **Template** | `TablePageTemplate` + `createClustersPageConfig()` |
+
+### Planner/ClusterDetail.tsx (~280 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `ClusterDetail` |
+| **Purpose** | Detail view for single cluster with tabs (articles, pages, products, taxonomy) |
+| **Origin** | `custom` |
+| **UI Patterns** | Param-driven detail view, inline tab implementation (Button-based with border-bottom), tabbed content types, breadcrumb back navigation |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `Badge`, `useToast` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Custom inline tab implementation — does NOT use a shared Tab component; duplicates tab pattern seen in Sites/Settings |
+| **Template** | None (custom detail view) |
+
+### Planner/Ideas.tsx (~700 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Ideas` |
+| **Purpose** | Content ideas management with queue-to-writer bulk action |
+| **Origin** | `custom` |
+| **UI Patterns** | Config-driven table, cascading filters, header metrics, bulk queue action with progress modal |
+| **Shared Components** | `PageHeader`, `StandardThreeWidgetFooter`, `FormModal`, `ProgressModal`, `useToast`, `useSiteStore`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Near-identical to Keywords/Clusters — same cascading filter + header metrics + footer pattern. **Bug**: `sectors` prop passed twice in pageConfig creation |
+| **Template** | `TablePageTemplate` + `createIdeasPageConfig()` |
+
+---
+
+## 3. Writer
+
+### Writer/Content.tsx (~550 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Content` (Writer) |
+| **Purpose** | Content drafts table (status='draft') with generate image prompts, optimize, send to optimizer, view on WordPress actions |
+| **Origin** | `custom` |
+| **UI Patterns** | Config-driven table, locked status filter, per-row AI actions, inline optimization via `optimizerApi` |
+| **Shared Components** | `PageHeader`, `StandardThreeWidgetFooter`, `FormModal`, `ProgressModal`, `useToast`, `useSiteStore`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Same table page pattern as Planner pages |
+| **Template** | `TablePageTemplate` + `createContentPageConfig()` |
+
+### Writer/Tasks.tsx (~500+ lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Tasks` |
+| **Purpose** | Writing tasks management with content generation and image generation bulk actions |
+| **Origin** | `custom` |
+| **UI Patterns** | Config-driven table, per-row content generation, bulk image generation |
+| **Shared Components** | `PageHeader`, `StandardThreeWidgetFooter`, `FormModal`, `ProgressModal`, `useToast`, `useSiteStore`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Same table page pattern as Planner/Writer pages |
+| **Template** | `TablePageTemplate` + `createTasksPageConfig()` |
+
+### Writer/Review.tsx (~500 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Review` |
+| **Purpose** | Content review queue (status='review') with approve single/bulk actions |
+| **Origin** | `custom` |
+| **UI Patterns** | Config-driven table, approval workflow, event-based refresh |
+| **Shared Components** | `PageHeader`, `StandardThreeWidgetFooter`, `FormModal`, `ProgressModal`, `useToast`, `useSiteStore`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Same table pattern. **Note**: Uses different event name (`'site-changed'` vs `'siteChanged'` used elsewhere) |
+| **Template** | `TablePageTemplate` + `createReviewPageConfig()` |
+
+### Writer/Approved.tsx (~550+ lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Approved` |
+| **Purpose** | Approved content ready for publishing with extensive publishing workflow (single/bulk publish, schedule, reschedule) |
+| **Origin** | `custom` |
+| **UI Patterns** | Config-driven table, multi-modal publishing workflow, schedule management |
+| **Shared Components** | `PageHeader`, `StandardThreeWidgetFooter`, `FormModal`, `ProgressModal`, `useToast`, `useSiteStore`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | `PublishingProgressModal`, `BulkPublishingModal`, `PublishLimitModal`, `ScheduleContentModal`, `BulkScheduleModal`, `BulkSchedulePreviewModal`, `ErrorDetailsModal` (from `components/publishing/`, `components/BulkWordPressPublish/`) |
+| **Pattern Duplication** | Base table pattern same; extensive modal system is specific to this page |
+| **Template** | `TablePageTemplate` + `createApprovedPageConfig()` |
+
+### Writer/Images.tsx (~550+ lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Images` |
+| **Purpose** | Image management grouped by content (one row per content) with image generation queue |
+| **Origin** | `custom` |
+| **UI Patterns** | Config-driven table, **client-side** filtering/sorting/pagination (not server-side), image generation queue flow, settings pre-fetch |
+| **Shared Components** | `PageHeader`, `StandardThreeWidgetFooter`, `FormModal`, `useToast`, `useSiteStore`, `useSectorStore` |
+| **Local Sub-components** | `ImageQueueModal`, `SingleRecordStatusUpdateModal` (from `components/`) |
+| **Pattern Duplication** | Client-side filtering is an anomaly vs. other table pages that use server-side; base table pattern same |
+| **Template** | `TablePageTemplate` + `createImagesPageConfig()` |
+
+### Writer/ContentView.tsx (~67 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `ContentView` |
+| **Purpose** | Individual content detail view (thin wrapper loading content by ID) |
+| **Origin** | `custom` |
+| **UI Patterns** | Param-driven detail view, loading state, error handling |
+| **Shared Components** | None directly (delegates to template) |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | `ContentViewTemplate` |
+
+---
+
+## 4. Publisher
+
+### Publisher/ContentCalendar.tsx (~550+ lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `ContentCalendar` |
+| **Purpose** | Content scheduling with calendar and list views, drag-drop reordering and date assignment |
+| **Origin** | `custom` |
+| **UI Patterns** | Dual view (calendar grid + list), drag-drop (list reorder + calendar date drop), complex derived state via useMemo, ButtonGroup view toggle |
+| **Shared Components** | `PageMeta`, `PageHeader`, `ComponentCard`, `Card`, `Button`, `IconButton`, `ButtonGroup`, `CalendarItemTooltip`, `ScheduleContentModal` |
+| **Local Sub-components** | None (inline calendar grid rendering) |
+| **Pattern Duplication** | Calendar rendering is fully inline (~200+ lines); shares `ScheduleContentModal` with Approved.tsx |
+| **Template** | None (fully custom) |
+
+### Publisher/PublishSettings.tsx (~500 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `PublishSettings` |
+| **Purpose** | Publishing automation, limits, and schedule configuration (3-card form layout) |
+| **Origin** | `custom` |
+| **UI Patterns** | 3-card form layout (Automation, Limits, Schedule), toggle switches, inline form validation |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `IconButton`, `Label`, `InputField`, `Switch` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Settings form pattern similar to Sites/Settings and account/ContentSettingsPage |
+| **Template** | None (custom form layout) |
+
+---
+
+## 5. Sites
+
+### Sites/List.tsx (~550+ lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SitesList` |
+| **Purpose** | Sites list with table/grid toggle, site CRUD, activation, deletion |
+| **Origin** | `custom` |
+| **UI Patterns** | Dual view (table + grid cards), ViewToggle, client-side filtering, inline deletion/toggle, WorkflowGuide |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `Badge`, `Alert`, `Switch`, `InputField`, `Select`, `ViewToggle`, `WorkflowGuide`, `ConfirmDialog`, `SiteTypeBadge` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Table view uses `TablePageTemplate`; grid view is custom inline cards |
+| **Template** | `TablePageTemplate` (table view only) + custom grid view |
+
+### Sites/Dashboard.tsx (~500 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SiteDashboard` |
+| **Purpose** | Individual site dashboard with setup checklist, quick actions, analytics |
+| **Origin** | `custom` |
+| **UI Patterns** | Widget layout, setup checklist, quick action cards, stat widgets |
+| **Shared Components** | `PageMeta`, `PageHeader`, `ComponentCard`, `SiteInfoBar`, `Card`, `Button` |
+| **Local Sub-components** | `SiteSetupChecklist`, `SiteConfigWidget`, `OperationsCostsWidget`, `CreditAvailabilityWidget` (from `components/sites/`) |
+| **Pattern Duplication** | Widget grid similar to Dashboard/Home but site-specific |
+| **Template** | None (custom widget layout) |
+
+### Sites/Settings.tsx (~1000+ lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SiteSettings` |
+| **Purpose** | Site settings with tabs (General, Automation, Integrations) — massive form |
+| **Origin** | `custom` |
+| **UI Patterns** | Tabbed form, SEO settings, industry/sector selection, AI settings, WordPress integration form |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `InputField`, `Select`, `SelectDropdown`, `Checkbox`, `Radio`, `TextArea`, `Switch`, `SiteInfoBar` |
+| **Local Sub-components** | `AIAutomationSettings`, `WordPressIntegrationForm` (from `components/integration/`, `components/sites/`) |
+| **Pattern Duplication** | Custom inline tab implementation (duplicates pattern in ClusterDetail); very large file that could be split into tab sub-components |
+| **Template** | None (custom tabbed form) |
+
+### Sites/Content.tsx (~500 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SiteContent` |
+| **Purpose** | Site-specific content manager with manual table and custom filters |
+| **Origin** | `custom` |
+| **UI Patterns** | Manual table (not TablePageTemplate), custom filter cards, manual pagination |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `InputField`, `Select`, `SiteInfoBar` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Manual table implementation duplicates what `TablePageTemplate` provides; manual pagination duplicates template pagination |
+| **Template** | None (custom manual table) |
+
+### Sites/ContentStructure.tsx (416 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `ContentStructure` |
+| **Purpose** | Content organized by clusters with keyword table and content list |
+| **Origin** | `custom` |
+| **UI Patterns** | Cluster selector dropdown, keyword table, content list, inline tables |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `Badge`, `Select`, `SiteInfoBar` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Manual inline tables duplicate TablePageTemplate capabilities |
+| **Template** | None (custom cluster-based view) |
+
+### Sites/PostEditor.tsx (672 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `PostEditor` |
+| **Purpose** | Full-featured post editor with SEO metadata, taxonomy, and content validation tabs |
+| **Origin** | `custom` |
+| **UI Patterns** | Tabbed editor (content, taxonomy, validation), form inputs, rich content editing |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, form components, `SiteInfoBar` |
+| **Local Sub-components** | Content validation feature inline |
+| **Pattern Duplication** | Tab implementation likely duplicates other inline tab patterns |
+| **Template** | None (custom post editor) |
+
+### Sites/PageManager.tsx (395 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `PageManager` |
+| **Purpose** | Drag-drop page reordering and management |
+| **Origin** | `custom` |
+| **UI Patterns** | Drag-and-drop with `react-dnd` + `HTML5Backend`, sortable list |
+| **Shared Components** | `PageMeta`, `PageHeader`, `DndProvider`, `useDrag`, `useDrop` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Only page using `react-dnd` directly |
+| **Template** | None (custom drag-drop interface) |
+
+### Sites/SyncDashboard.tsx (460 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SyncDashboard` |
+| **Purpose** | WordPress sync health dashboard with sync status, mismatches, and logs |
+| **Origin** | `custom` |
+| **UI Patterns** | Status cards, sync action buttons, mismatch list, log viewer |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `Badge` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | None (custom dashboard) |
+
+### Sites/PublishingQueue.tsx (441 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `PublishingQueue` |
+| **Purpose** | Scheduled content queue with list/calendar view (site-specific) |
+| **Origin** | `custom` |
+| **UI Patterns** | Dual view (list + calendar), similar to ContentCalendar but site-scoped |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Duplicates much of `Publisher/ContentCalendar.tsx` but scoped to a single site |
+| **Template** | None (custom queue view) |
+
+### Sites/AIAutomationSettings.tsx (929 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AIAutomationSettings` |
+| **Purpose** | Unified AI & automation settings per site (per SETTINGS-CONSOLIDATION-PLAN) |
+| **Origin** | `custom` |
+| **UI Patterns** | Multi-section settings form, stage configuration, unified settings API |
+| **Shared Components** | `Card`, `Button`, `Switch`, `InputField`, `Label`, `Select` |
+| **Local Sub-components** | Uses `unifiedSettings.api` with `UnifiedSiteSettings`, `StageConfig` types |
+| **Pattern Duplication** | Large settings form pattern similar to Sites/Settings, Publisher/PublishSettings |
+| **Template** | None (custom settings form) |
+
+### Sites/DeploymentPanel.tsx (43 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `DeploymentPanel` |
+| **Purpose** | **DEPRECATED** — Placeholder showing deprecation notice |
+| **Origin** | `custom` (deprecated) |
+| **UI Patterns** | Static notice card |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | None |
+
+---
+
+## 6. Automation
+
+### Automation/AutomationPage.tsx (~1156 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AutomationPage` |
+| **Purpose** | Main automation dashboard — run/pause/config pipeline, live progress tracking, activity log, eligibility checks |
+| **Origin** | `custom` |
+| **UI Patterns** | 7-stage pipeline visualization, live polling progress, server time display, eligibility gating, stage color coding |
+| **Shared Components** | `PageMeta`, `PageHeader`, `ComponentCard`, `DebugSiteSelector`, `Button`, `useToast`, `useSiteStore` |
+| **Local Sub-components** | `ActivityLog`, `CurrentProcessingCardV2`, `GlobalProgressBar` (from `components/Automation/`) |
+| **Pattern Duplication** | None — highly specialized |
+| **Template** | None (custom automation dashboard) |
+
+### Automation/AutomationOverview.tsx (269 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AutomationOverview` |
+| **Purpose** | Production stats dashboard showing actual output metrics and meaningful run history |
+| **Origin** | `custom` |
+| **UI Patterns** | Quick action buttons with badge counts, production summary, run history list |
+| **Shared Components** | `PageMeta`, `PageHeader`, `useToast`, `useSiteStore` |
+| **Local Sub-components** | `MeaningfulRunHistory`, `ProductionSummary` (from `components/Automation/DetailView/`) |
+| **Pattern Duplication** | None |
+| **Template** | None (custom stats dashboard) |
+
+### Automation/AutomationRunDetail.tsx (218 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AutomationRunDetail` |
+| **Purpose** | Detailed view of a single automation run with stage breakdown, charts, and insights |
+| **Origin** | `custom` |
+| **UI Patterns** | Run summary card, 2-col layout (credit chart + stage accordion), insights panel, derived insights from data |
+| **Shared Components** | `PageMeta`, `PageHeader`, `useToast`, `useSiteStore` |
+| **Local Sub-components** | `RunSummaryCard`, `StageAccordion`, `EfficiencyMetrics`, `InsightsPanel`, `CreditBreakdownChart` (from `components/Automation/DetailView/`) |
+| **Pattern Duplication** | None |
+| **Template** | None (custom detail view) |
+
+### Automation/PipelineSettings.tsx (399 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `PipelineSettings` |
+| **Purpose** | Configure 7-stage automation pipeline — per-stage enable/disable, batch sizes, delays |
+| **Origin** | `custom` |
+| **UI Patterns** | Multi-stage form with checkboxes and inputs per stage, save/cancel flow |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `Checkbox`, `Select`, `InputField`, `useToast`, `useSiteStore` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Settings form pattern (similar to PublishSettings, Sites/Settings) |
+| **Template** | None (custom pipeline settings form) |
+
+---
+
+## 7. Thinker
+
+### Thinker/Prompts.tsx (499 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Prompts` |
+| **Purpose** | AI prompt library — manage/edit/reset prompt templates for all AI operations (clustering, ideas, content, images, site structure) |
+| **Origin** | `custom` |
+| **UI Patterns** | Grouped prompt editor cards (Planner, Writer, Image, Site Builder sections), save/reset per prompt, TextArea editors |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Button`, `TextArea`, `useToast` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Repeating card+TextArea+save/reset pattern for each prompt type — could extract a `PromptEditorCard` component |
+| **Template** | None (custom prompt editor layout) |
+
+### Thinker/AuthorProfiles.tsx (160 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AuthorProfiles` |
+| **Purpose** | CRUD for writing style profiles (name, tone, language) |
+| **Origin** | `custom` |
+| **UI Patterns** | Card grid, FormModal for create/edit, confirm-delete, CRUD API calls |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `Badge`, `FormModal`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | FormModal CRUD pattern is clean and reusable |
+| **Template** | None (card grid + FormModal) |
+
+### Thinker/ImageTesting.tsx (28 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `ImageTesting` |
+| **Purpose** | **PLACEHOLDER** — "Coming Soon" for image testing |
+| **Origin** | `placeholder` |
+| **UI Patterns** | Static placeholder card |
+| **Shared Components** | `PageMeta`, `PageHeader`, `ComponentCard` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Same "Coming Soon" pattern as Profile, Strategies |
+| **Template** | None |
+
+### Thinker/Profile.tsx (22 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Profile` |
+| **Purpose** | **PLACEHOLDER** — "Coming Soon" for AI profile settings |
+| **Origin** | `placeholder` |
+| **UI Patterns** | Static placeholder card |
+| **Shared Components** | `PageMeta`, `ComponentCard` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Same "Coming Soon" pattern as ImageTesting, Strategies |
+| **Template** | None |
+
+### Thinker/Strategies.tsx (28 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Strategies` |
+| **Purpose** | **PLACEHOLDER** — "Coming Soon" for content strategies |
+| **Origin** | `placeholder` |
+| **UI Patterns** | Static placeholder card |
+| **Shared Components** | `PageMeta`, `PageHeader`, `ComponentCard` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Same "Coming Soon" pattern as ImageTesting, Profile |
+| **Template** | None |
+
+---
+
+## 8. Optimizer
+
+### Optimizer/ContentSelector.tsx (303 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `OptimizerContentSelector` |
+| **Purpose** | Content list for selecting items to optimize — single/batch optimize with entry point selection |
+| **Origin** | `custom` |
+| **UI Patterns** | Manual table with checkboxes, client-side filtering, batch selection, entry-point dropdown, manual pagination |
+| **Shared Components** | `PageMeta`, `PageHeader`, `ModuleNavigationTabs`, `Button`, `Select`, `Checkbox`, `useToast`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | `ContentFilter`, `SourceBadge`, `OptimizationScores` (from `components/content/`, `components/optimizer/`) |
+| **Pattern Duplication** | Manual table with inline pagination — duplicates TablePageTemplate capability; pagination buttons duplicate pattern seen in Linker, Sites/Content |
+| **Template** | None (custom manual table) |
+
+### Optimizer/AnalysisPreview.tsx (304 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AnalysisPreview` |
+| **Purpose** | Preview optimization scores for a single content item without applying changes |
+| **Origin** | `custom` |
+| **UI Patterns** | Param-driven detail view, score cards, metadata coverage scorecards, recommended actions list |
+| **Shared Components** | `PageMeta`, `PageHeader`, `useToast` |
+| **Local Sub-components** | `OptimizationScores` (from `components/optimizer/`) |
+| **Pattern Duplication** | None |
+| **Template** | None (custom analysis view) |
+
+---
+
+## 9. Linker
+
+### Linker/ContentList.tsx (237 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `LinkerContentList` |
+| **Purpose** | Content list for adding internal links — single/batch link processing |
+| **Origin** | `custom` |
+| **UI Patterns** | Manual table, per-row process button, batch processing, link results display, manual pagination |
+| **Shared Components** | `PageMeta`, `PageHeader`, `ModuleNavigationTabs`, `Button`, `useToast`, `useSectorStore`, `usePageSizeStore`, `usePageLoading` |
+| **Local Sub-components** | `SourceBadge`, `LinkResults` (from `components/content/`, `components/linker/`) |
+| **Pattern Duplication** | Manual table + inline pagination — same pattern as Optimizer/ContentSelector and Sites/Content |
+| **Template** | None (custom manual table) |
+
+---
+
+## 10. Settings (Admin/Legacy)
+
+### Settings/Integration.tsx (~1028 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Integration` |
+| **Purpose** | API integration management (OpenAI, Runware, GSC) — configure keys, test connections, image generation settings |
+| **Origin** | `custom` |
+| **UI Patterns** | Integration cards, validation cards, image generation/result cards, site integrations, FormModal for config |
+| **Shared Components** | `PageMeta`, `IntegrationCard`, `ValidationCard`, `ImageGenerationCard`, `ImageResultCard`, `ImageServiceCard`, `SiteIntegrationsSection`, `Modal`, `FormModal`, `Button`, `Checkbox`, `Label`, `SelectDropdown`, `Alert`, `useToast` |
+| **Local Sub-components** | Inline SVG icon components (OpenAIIcon, RunwareIcon, GSCIcon) |
+| **Pattern Duplication** | Complex integration management — unique |
+| **Template** | None (custom integration management) |
+
+### Settings/Sites.tsx (~638 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Sites` (Settings) |
+| **Purpose** | Admin site management — CRUD sites, manage sectors, toggle active sites |
+| **Origin** | `custom` |
+| **UI Patterns** | SiteCard grid, FormModal for create/edit, sector selector modal, confirm delete |
+| **Shared Components** | `PageMeta`, `SiteCard`, `FormModal`, `ConfirmDialog`, `Button`, `Alert`, `Select`, `Checkbox`, `Badge`, `useToast` |
+| **Local Sub-components** | Inline SiteIcon SVG |
+| **Pattern Duplication** | Overlaps with `Sites/List.tsx` — both manage sites with different UIs |
+| **Template** | None (card grid + modals) |
+
+### Settings/WordPressIntegrationDebug.tsx (~655 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `WordPressIntegrationDebug` |
+| **Purpose** | WordPress integration health debugging — sync events, data validation, API status checks |
+| **Origin** | `custom` |
+| **UI Patterns** | Health status cards, sync event log, data validation table, debug toggle |
+| **Shared Components** | `useSiteStore`, `useToast`, icons |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Overlaps with Sites/SyncDashboard — both show WordPress sync health |
+| **Template** | None (custom debug interface) |
+
+### Settings/CreditsAndBilling.tsx (~238 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `CreditsAndBilling` |
+| **Purpose** | Usage overview with credit balance and transaction history |
+| **Origin** | `custom` |
+| **UI Patterns** | Tab toggle (overview/transactions), metric cards, transaction table |
+| **Shared Components** | `PageMeta`, `ComponentCard`, `EnhancedMetricCard`, `Button`, `Badge`, `useToast` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Duplicates functionality in `account/UsageDashboardPage` and `Billing/Usage` |
+| **Template** | None (custom billing view) |
+
+### Settings/Plans.tsx (~218 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Plans` |
+| **Purpose** | Display available subscription plans using PricingTable component |
+| **Origin** | `custom` |
+| **UI Patterns** | Pricing table display, plan feature extraction, URL-based plan preselection |
+| **Shared Components** | `PageMeta`, `PricingTable1`, `useToast`, `usePageLoading`, `useAuthStore` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Plan display overlaps with `account/PlansAndBillingPage` |
+| **Template** | None (pricing table) |
+
+### Settings/Publishing.tsx (~226 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Publishing` |
+| **Purpose** | Publishing rules, auto-publish, sync settings (TODO: mostly placeholder) |
+| **Origin** | `custom` |
+| **UI Patterns** | Settings form with checkboxes, dropdowns, PublishingRules component |
+| **Shared Components** | `PageMeta`, `Card`, `Button`, `Checkbox`, `Label`, `Input`, `Select`, `PublishingRules`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Overlaps with `Publisher/PublishSettings` |
+| **Template** | None (custom settings form) |
+
+### Settings/General.tsx (109 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `GeneralSettings` |
+| **Purpose** | App preferences (table records per page, default sort) |
+| **Origin** | `custom` |
+| **UI Patterns** | Simple settings form, settingsStore integration |
+| **Shared Components** | `PageMeta`, `ComponentCard`, `Button`, `Label`, `InputField`, `Select`, `useSettingsStore`, `useToast` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | None (ComponentCard form) |
+
+### Settings/Industries.tsx (59 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Industries` (Settings) |
+| **Purpose** | Admin industry template viewer (read-only card grid) |
+| **Origin** | `custom` |
+| **UI Patterns** | Card grid, badge for active status |
+| **Shared Components** | `PageMeta`, `Card`, `Badge`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Overlaps with `Reference/Industries` |
+| **Template** | None (card grid) |
+
+### Settings/Subscriptions.tsx (94 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Subscriptions` |
+| **Purpose** | Admin subscription list (table of account subscriptions) |
+| **Origin** | `custom` |
+| **UI Patterns** | Simple table in Card, status badges |
+| **Shared Components** | `PageMeta`, `Card`, `Badge`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | None (simple table) |
+
+### Settings/Users.tsx (79 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Users` |
+| **Purpose** | Admin user list (table of account users) |
+| **Origin** | `custom` |
+| **UI Patterns** | Simple table in Card, role/status badges |
+| **Shared Components** | `PageMeta`, `Card`, `Badge`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | None (simple table) |
+
+### Settings/Account.tsx (43 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AccountSettings` (Settings) |
+| **Purpose** | **PLACEHOLDER** — "coming soon" for account settings |
+| **Origin** | `placeholder` |
+| **UI Patterns** | Static placeholder |
+| **Shared Components** | `PageMeta`, `Card`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Functionality exists in `account/AccountSettingsPage` |
+| **Template** | None |
+
+### Settings/System.tsx (43 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SystemSettings` |
+| **Purpose** | **PLACEHOLDER** — "coming soon" for system settings |
+| **Origin** | `placeholder` |
+| **UI Patterns** | Static placeholder |
+| **Shared Components** | `PageMeta`, `Card`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | None |
+
+---
+
+## 11. Billing (Legacy)
+
+### Billing/Usage.tsx (170 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Usage` |
+| **Purpose** | Credit usage overview with cost table and transaction history |
+| **Origin** | `custom` |
+| **UI Patterns** | Balance card, cost reference table, transaction list |
+| **Shared Components** | `PageMeta`, `Card`, `Badge`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Duplicates `Settings/CreditsAndBilling` and `account/UsageDashboardPage` |
+| **Template** | None |
+
+### Billing/Credits.tsx (122 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Credits` |
+| **Purpose** | Credit balance display with upgrade CTA |
+| **Origin** | `custom` |
+| **UI Patterns** | Balance cards, link to plans |
+| **Shared Components** | `PageMeta`, `Card`, `Badge`, `Button`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Overlaps with Usage page and account/UsageDashboardPage |
+| **Template** | None |
+
+### Billing/Transactions.tsx (103 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Transactions` |
+| **Purpose** | Credit transaction history table with pagination |
+| **Origin** | `custom` |
+| **UI Patterns** | Table with color-coded badges, pagination |
+| **Shared Components** | `PageMeta`, `Card`, `Badge`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Transaction table duplicated in Settings/CreditsAndBilling and Billing/Usage |
+| **Template** | None |
+
+---
+
+## 12. Account (Current)
+
+### account/PlansAndBillingPage.tsx (~1822 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `PlansAndBillingPage` |
+| **Purpose** | Comprehensive billing dashboard — current plan, credit packages, invoices, payment methods, purchase flow |
+| **Origin** | `custom` |
+| **UI Patterns** | Multi-section dashboard, credit package cards, invoice downloads, payment method cards, purchase modals, portal integration |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Badge`, `Button`, `Label`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | Inline SVG icons, portal-based purchase modal |
+| **Pattern Duplication** | Supersedes `Settings/Plans`, `Settings/CreditsAndBilling`, `Billing/*`; very large file that could be split |
+| **Template** | None (custom multi-section dashboard) |
+
+### account/AccountSettingsPage.tsx (~979 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AccountSettingsPage` |
+| **Purpose** | Account, profile, and team management — single scrollable page with all settings |
+| **Origin** | `custom` |
+| **UI Patterns** | Vertical form sections (Account, Profile, Team), invite/remove team members, change password, modal for invites |
+| **Shared Components** | `PageMeta`, `PageHeader`, `ComponentCard`, `Card`, `Badge`, `Button`, `InputField`, `Select`, `Checkbox`, `Modal`, `useToast`, `useAuthStore`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Supersedes `Settings/Account` placeholder |
+| **Template** | None (custom form sections) |
+
+### account/UsageDashboardPage.tsx (~954 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `UsageDashboardPage` |
+| **Purpose** | Unified analytics dashboard — credit usage charts, operation breakdowns, plan limits, usage trends |
+| **Origin** | `custom` |
+| **UI Patterns** | Charts (react-apexcharts), stat cards, operation breakdown table, period selector, pagination |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Badge`, `Button`, `SelectDropdown`, `Input`, `Pagination`, `useToast` |
+| **Local Sub-components** | None (uses `Chart` from react-apexcharts) |
+| **Pattern Duplication** | Supersedes `Billing/Usage`, `Billing/Credits`, `Settings/CreditsAndBilling`; most comprehensive usage view |
+| **Template** | None (custom analytics dashboard) |
+
+### account/ContentSettingsPage.tsx (~686 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `ContentSettingsPage` |
+| **Purpose** | Content generation, publishing, and image settings — 3-tab settings page |
+| **Origin** | `custom` |
+| **UI Patterns** | Tabbed form (Content, Publishing, Images), image generation settings with provider/model selectors |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `SelectDropdown`, `Label`, `Checkbox`, `TextArea`, `useToast` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Publishing settings overlap with `Publisher/PublishSettings`; image settings overlap with `Settings/Integration` |
+| **Template** | None (tabbed settings form) |
+
+### account/PurchaseCreditsPage.tsx (~429 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `PurchaseCreditsPage` |
+| **Purpose** | Credit package selection and payment flow — choose package, select payment method, purchase |
+| **Origin** | `custom` |
+| **UI Patterns** | Package selection cards, payment method selection, manual payment form, invoice display |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Button`, `InputField`, `TextArea`, `Label` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Purchase flow also exists within `PlansAndBillingPage` |
+| **Template** | None (custom purchase flow) |
+
+### account/NotificationsPage.tsx (~428 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `NotificationsPage` |
+| **Purpose** | Notification center — list, filter, mark read, delete notifications |
+| **Origin** | `custom` |
+| **UI Patterns** | Filterable notification list, severity/type/read filters, bulk mark all read, individual delete |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Button`, `Select`, `useNotificationStore`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | None (custom notification list) |
+
+### account/UsageAnalyticsPage.tsx (~278 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `UsageAnalyticsPage` |
+| **Purpose** | Usage analytics with URL-driven tabs (limits, activity, insights, API) |
+| **Origin** | `custom` |
+| **UI Patterns** | URL-driven tab selection (path-based), period selector, billing panels |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Badge`, `Button`, `useToast` |
+| **Local Sub-components** | `BillingUsagePanel`, `UsageLimitsPanel`, `CreditInsightsCharts` (from `components/billing/`) |
+| **Pattern Duplication** | Overlaps with `UsageDashboardPage` — both show usage analytics with different approaches |
+| **Template** | None (tabbed analytics) |
+
+---
+
+## 13. Setup
+
+### Setup/SetupWizard.tsx (46 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SetupWizard` |
+| **Purpose** | Onboarding setup wizard — thin wrapper delegating to `OnboardingWizard` component |
+| **Origin** | `custom` |
+| **UI Patterns** | Wizard flow, complete/skip callbacks, page context integration |
+| **Shared Components** | `PageMeta`, `OnboardingWizard`, `usePageContext` |
+| **Local Sub-components** | None (all logic in `OnboardingWizard`) |
+| **Pattern Duplication** | None |
+| **Template** | None (delegated to OnboardingWizard) |
+
+### Setup/IndustriesSectorsKeywords.tsx (~1583 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `IndustriesSectorsKeywords` |
+| **Purpose** | Keywords library — browse seed keywords by industry/sector, add to workflow, CSV import, smart suggestions |
+| **Origin** | `custom` |
+| **UI Patterns** | Sector metric grid, smart suggestions, sector card browsing, CSV import modal, bulk add with confirmation, `TablePageTemplate` for keyword table |
+| **Shared Components** | `PageMeta`, `PageHeader`, `WorkflowGuide`, `Badge`, `Button`, `Modal`, `FileInput`, `Label`, `Input`, `Card`, `useToast`, `usePageLoading`, `useSiteStore`, `useSectorStore`, `usePageSizeStore` |
+| **Local Sub-components** | `SectorMetricGrid`, `SmartSuggestions`, `SectorCardsGrid`, `BulkAddConfirmation` (from `components/keywords-library/`) |
+| **Pattern Duplication** | Very large file that mixes browsing, importing, and management; could be split |
+| **Template** | `TablePageTemplate` (for keyword browsing table) |
+
+---
+
+## 14. AuthPages
+
+### AuthPages/SignIn.tsx (17 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SignIn` |
+| **Purpose** | Sign-in page — thin wrapper composing `AuthLayout` + `SignInForm` |
+| **Origin** | `tailadmin-modified` |
+| **UI Patterns** | Auth layout with split-screen |
+| **Shared Components** | `PageMeta`, `AuthLayout`, `SignInForm` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | `AuthLayout` (shared auth template) |
+
+### AuthPages/SignUp.tsx (~120 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SignUp` |
+| **Purpose** | Registration page with plan selection and unified signup form |
+| **Origin** | `tailadmin-modified` |
+| **UI Patterns** | Plan pre-selection from URL, plan cards, auth layout |
+| **Shared Components** | `PageMeta`, `SignUpFormUnified`, `GridShape` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Plan fetching logic duplicated from Settings/Plans |
+| **Template** | Custom layout (inline, not AuthLayout) |
+
+### AuthPages/AuthPageLayout.tsx (87 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `AuthLayout` |
+| **Purpose** | Shared auth page layout — split-screen with branding panel and plan preview |
+| **Origin** | `tailadmin-modified` |
+| **UI Patterns** | Split-screen layout (form left, branding right), responsive collapse, plan preview card, theme toggler |
+| **Shared Components** | `GridShape`, `ThemeTogglerTwo` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None — this IS the shared layout |
+| **Template** | N/A (this is a layout component) |
+
+### AuthPages/ForgotPassword.tsx (177 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `ForgotPassword` |
+| **Purpose** | Request password reset email |
+| **Origin** | `custom` |
+| **UI Patterns** | Centered card form, success state transition, anti-enumeration (always shows success) |
+| **Shared Components** | `PageMeta` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Standalone layout (doesn't use AuthLayout) |
+| **Template** | None (standalone centered form) |
+
+### AuthPages/ResetPassword.tsx (348 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `ResetPassword` |
+| **Purpose** | Password reset form with token from email link |
+| **Origin** | `custom` |
+| **UI Patterns** | Token-validated form, password strength checks, state machine (form/success/error/expired), auto-redirect |
+| **Shared Components** | `PageMeta` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Standalone layout (doesn't use AuthLayout) |
+| **Template** | None (standalone centered form) |
+
+### AuthPages/VerifyEmail.tsx (220 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `VerifyEmail` |
+| **Purpose** | Email verification with token from email link |
+| **Origin** | `custom` |
+| **UI Patterns** | Auto-verify on mount, state machine (verifying/success/error/expired), resend option |
+| **Shared Components** | `PageMeta` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Standalone layout (doesn't use AuthLayout) |
+| **Template** | None (standalone centered form) |
+
+### AuthPages/Unsubscribe.tsx (82 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Unsubscribe` |
+| **Purpose** | Email preferences redirect — auto-redirects to account settings after 5s |
+| **Origin** | `custom` |
+| **UI Patterns** | Informational card with auto-redirect timer, transactional email notice |
+| **Shared Components** | `PageMeta` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Standalone layout |
+| **Template** | None (standalone centered card) |
+
+---
+
+## 15. Help
+
+### Help/Help.tsx (~1306 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Help` |
+| **Purpose** | In-app help documentation — workflow pipeline visualization, Q&A accordions, getting started guide |
+| **Origin** | `custom` |
+| **UI Patterns** | Table of contents, anchor-link scrolling, workflow pipeline visualization, accordion FAQ sections, cards |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Accordion`, `AccordionItem`, `Card`, `Badge` |
+| **Local Sub-components** | `WorkflowPipeline` (inline component), `TableOfContentsItem` interface |
+| **Pattern Duplication** | WorkflowPipeline visualization duplicates Dashboard pipeline widget concept; very large file |
+| **Template** | None (custom documentation page) |
+
+---
+
+## 16. Reference
+
+### Reference/Industries.tsx (185 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Industries` (Reference) |
+| **Purpose** | Reference view of industries with keyword counts and volume stats |
+| **Origin** | `custom` |
+| **UI Patterns** | Card grid with keyword stats, volume formatting, tooltip enrichment |
+| **Shared Components** | `PageMeta`, `PageHeader`, `Card`, `Badge`, `Tooltip`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Overlaps with `Settings/Industries` (both show industry cards) |
+| **Template** | None (card grid) |
+
+### Reference/SeedKeywords.tsx (119 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `SeedKeywords` |
+| **Purpose** | Global keyword library browser with industry filter and search |
+| **Origin** | `custom` |
+| **UI Patterns** | Filter bar (industry dropdown + search), keyword list |
+| **Shared Components** | `PageMeta`, `Card`, `Badge`, `useToast`, `usePageLoading` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Overlaps with `Setup/IndustriesSectorsKeywords` keyword browsing |
+| **Template** | None |
+
+---
+
+## 17. Standalone Pages
+
+### Payment.tsx (122 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Payment` |
+| **Purpose** | Manual payment contact form — generates mailto link for sales |
+| **Origin** | `custom` |
+| **UI Patterns** | Simple form, mailto link generation, plan display from URL params |
+| **Shared Components** | `InputField`, `TextArea`, `Label`, `Button`, `useAuthStore` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None — unique manual payment flow |
+| **Template** | None |
+
+### UIElements.tsx (737 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `UIElements` |
+| **Purpose** | **DEV REFERENCE** — UI component showcase/documentation page (non-indexable) |
+| **Origin** | `tailadmin-modified` |
+| **UI Patterns** | Component showcase with live examples of all `components/ui/` elements |
+| **Shared Components** | Imports effectively ALL `components/ui/` components |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | N/A — reference page |
+| **Template** | None |
+
+### Components.tsx (680 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Components` |
+| **Purpose** | **DEV REFERENCE** — Modal, dropdown, pagination, card, chart demo page |
+| **Origin** | `tailadmin-modified` |
+| **UI Patterns** | Component showcase with AlertModal, Modal, Dropdown, Pagination, Card variants |
+| **Shared Components** | `PageMeta`, `AlertModal`, `Modal`, `Button`, `Dropdown`, `DropdownItem`, `Pagination`, `Card`, `ChartTab`, `InputField`, `TextArea` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | N/A — reference page |
+| **Template** | None |
+
+---
+
+## 18. Legal
+
+### legal/Privacy.tsx (260 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Privacy` |
+| **Purpose** | Privacy policy static content page |
+| **Origin** | `custom` |
+| **UI Patterns** | Static content with sections, centered card layout, back-to-home link |
+| **Shared Components** | `PageMeta` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Same layout pattern as Terms.tsx |
+| **Template** | None (standalone legal) |
+
+### legal/Terms.tsx (186 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `Terms` |
+| **Purpose** | Terms and conditions static content page |
+| **Origin** | `custom` |
+| **UI Patterns** | Static content with sections, centered card layout, back-to-home link |
+| **Shared Components** | `PageMeta` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | Same layout pattern as Privacy.tsx — could extract a `LegalPageLayout` |
+| **Template** | None (standalone legal) |
+
+---
+
+## 19. OtherPage
+
+### OtherPage/NotFound.tsx (44 lines)
+
+| Field | Value |
+|---|---|
+| **Component** | `NotFound` |
+| **Purpose** | 404 error page |
+| **Origin** | `tailadmin-original` |
+| **UI Patterns** | Centered error display, SVG illustration, back-to-home link, GridShape background |
+| **Shared Components** | `PageMeta`, `GridShape` |
+| **Local Sub-components** | None |
+| **Pattern Duplication** | None |
+| **Template** | None |
+
+---
+
+## Summary Statistics
+
+| Metric | Count |
+|---|---|
+| **Total page files** | 68 |
+| **Using `TablePageTemplate`** | 10 (Keywords, Clusters, Ideas, Tasks, Content, Review, Approved, Images, Sites/List (table view), Setup/IndustriesSectorsKeywords) |
+| **Using `ContentViewTemplate`** | 1 (ContentView) |
+| **Custom (no template)** | 50 |
+| **Placeholder / Coming Soon** | 5 (ImageTesting, Profile, Strategies, Settings/Account, Settings/System) |
+| **Deprecated** | 1 (DeploymentPanel) |
+| **TailAdmin-original** | 1 (NotFound) |
+| **TailAdmin-modified** | 4 (SignIn, SignUp, UIElements, Components) |
+| **Dev reference only** | 2 (UIElements, Components) |
+
+---
+
+## Key Findings — Pattern Duplication
+
+### 1. Manual Table Duplication
+**Pages**: `Sites/Content`, `Sites/ContentStructure`, `Optimizer/ContentSelector`, `Linker/ContentList`
+These pages build manual `` with inline pagination instead of using `TablePageTemplate`. Candidate for migration or a simpler `SimpleTableTemplate`.
+
+### 2. Settings Form Proliferation
+**Pages**: `Sites/Settings`, `Sites/AIAutomationSettings`, `Publisher/PublishSettings`, `Automation/PipelineSettings`, `account/ContentSettingsPage`, `Settings/Publishing`
+At least 6 pages implement settings forms with similar card+toggle+save patterns. Consider a `SettingsFormTemplate` or shared `SettingsSection` component.
+
+### 3. Billing/Usage Triplication
+**Legacy**: `Settings/CreditsAndBilling`, `Billing/Usage`, `Billing/Credits`, `Billing/Transactions`
+**Current**: `account/PlansAndBillingPage`, `account/UsageDashboardPage`, `account/UsageAnalyticsPage`
+The legacy Settings/Billing pages duplicate what the account/* pages already provide. Candidates for removal.
+
+### 4. Inline Tab Implementation
+**Pages**: `ClusterDetail`, `Sites/Settings`, `Sites/PostEditor`
+Custom button-based tab implementations instead of using a shared `Tabs` component.
+
+### 5. Cascading Filter Boilerplate
+**Pages**: `Keywords`, `Clusters`, `Ideas`, `Tasks`, `Content`, `Review`, `Approved`, `Images`
+All Planner+Writer table pages repeat ~50-100 lines of cascading filter loading logic. Could be extracted into a `useCascadingFilters` hook.
+
+### 6. WordPress Sync Overlap
+**Pages**: `Settings/WordPressIntegrationDebug` vs `Sites/SyncDashboard`
+Both show WordPress sync health with overlapping functionality.
+
+### 7. Industry Display Overlap
+**Pages**: `Settings/Industries` vs `Reference/Industries`
+Both display industry cards; the Reference version adds keyword stats.
+
+### 8. Calendar Duplication
+**Pages**: `Publisher/ContentCalendar` vs `Sites/PublishingQueue`
+Both implement calendar+list views for scheduled content. The site-scoped version could reuse the publisher calendar component.
+
+### 9. Legal Page Layout
+**Pages**: `legal/Privacy` vs `legal/Terms`
+Identical layout wrapper — candidate for a `LegalPageLayout` component.
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Content_Types_Writing_Plan.md b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Content_Types_Writing_Plan.md
new file mode 100644
index 00000000..eb840c1d
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Content_Types_Writing_Plan.md
@@ -0,0 +1,156 @@
+# Content Types Writing Plan (Detailed)
+
+**Goal:** Make IGNY8 capable of **writing content for multiple post types** (pages, products, services, company pages, taxonomy terms) using the **same Planner → Ideas → Tasks → Writer → Images** workflow as posts.
+
+**Scope:** WordPress-only for current release. Shopify/custom support is future.
+
+---
+
+## 1) Core Principle
+All content types follow the **same pipeline**:
+
+```
+Clusters → Ideas → Tasks → Content → Images → Review → Publish
+```
+
+Differences are handled by **content_type** and **content_structure** presets, plus targeted prompts and schema.
+
+---
+
+## 2) Content Types & Structures
+
+### 2.1 Pages (Static)
+- **content_type:** `page`
+- **content_structure:** `landing_page`, `business_page`, `general`
+- **Use cases:** About, Contact, FAQs, Pillar landing pages
+
+### 2.2 Products (Custom Post Type)
+- **content_type:** `product`
+- **content_structure:** `product_page`
+- **Use cases:** Individual products or product collections
+
+### 2.3 Services (Custom Post Type)
+- **content_type:** `service`
+- **content_structure:** `service_page`
+- **Use cases:** Service offering pages, location variants
+
+### 2.4 Company Pages
+- **content_type:** `page`
+- **content_structure:** `business_page` or `general`
+- **Use cases:** Team, Careers, Press, Mission
+
+### 2.5 Taxonomy Terms (Landing Pages)
+- **content_type:** `taxonomy`
+- **content_structure:** `category_archive`, `tag_archive`, `attribute_archive`, `cluster_hub`
+- **Use cases:** Category/tag/attribute landing pages with SEO content
+
+---
+
+## 3) Pipeline Mapping (Same as Posts)
+
+### 3.1 Clusters → Ideas
+- Each cluster generates ideas **per content type** based on intent.
+- Example: one cluster may yield a page, a product page, and a service page idea.
+
+### 3.2 Ideas → Tasks
+- `Tasks` created with `content_type` and `content_structure`.
+- Taxonomy terms can create tasks tied to `taxonomy_term`.
+
+### 3.3 Tasks → Content
+- Writer uses existing prompt system with type-specific prompts.
+- Outputs HTML + meta title + meta description + structure.
+
+### 3.4 Content → Images
+- Uses existing image pipeline (featured + in‑article).
+- Products/services can add attribute-based prompts.
+
+---
+
+## 4) WordPress Integration (Current Scope)
+
+### 4.1 Post Types
+- `post`, `page`, custom post types (`product`, `service`)
+
+### 4.2 Taxonomies
+- `category`, `post_tag`, `product_cat`, `product_tag`
+- WooCommerce attributes (e.g., `pa_color`, `pa_size`)
+
+---
+
+## 5) Writing Rules per Content Type
+
+### 5.1 Pages
+- Clear CTA and conversion focus.
+- Structured sections for trust + proof.
+
+### 5.2 Products
+- Feature/benefit sections, specs table, FAQs.
+- Product schema + review snippets.
+
+### 5.3 Services
+- Service overview, process steps, outcomes, FAQs.
+- Local SEO sections if location-based.
+
+### 5.4 Company Pages
+- Brand mission, values, history, team bios.
+- FAQ and media/press block where relevant.
+
+### 5.5 Taxonomy Landing Pages
+- Intro + topical definition
+- Key subtopics + internal links
+- Related products/posts/services
+- FAQ section
+
+---
+
+## 6) Cluster Alignment
+- Each page is mapped to a **primary cluster**.
+- Secondary clusters used for semantic coverage.
+- Cluster keywords drive headings and metadata.
+
+---
+
+## 7) Required Enhancements
+
+### 7.1 Ideas Generation
+- Add type-specific idea templates:
+ - Product ideas (features/specs/benefits)
+ - Service ideas (process/outcomes)
+ - Company page ideas (mission/team/careers)
+ - Term landing ideas (taxonomy descriptions)
+
+### 7.2 Writer Prompts
+- Add prompt variants for each `content_structure`.
+
+### 7.3 Publishing
+- Map content types to WordPress post types correctly.
+- Taxonomy landing pages publish to term descriptions or custom fields.
+
+---
+
+## 8) Rollout Phases
+
+**Phase 1**
+- Pages + services + company pages in Writer
+- Task creation with new structures
+
+**Phase 2**
+- Products pages writing (WooCommerce)
+- Attribute-based prompts
+
+**Phase 3**
+- Taxonomy landing pages
+- Cluster hub pages
+
+---
+
+## 9) Success Criteria
+- All content types generated via same pipeline.
+- Cluster alignment across all page types.
+- Improved SEO coverage beyond posts.
+
+---
+
+## 10) Non‑Goals (v1)
+- Shopify/custom CMS adapters
+- Auto‑publish without review
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/FB_LinkedIn_Auth_flow_Steps.md b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/FB_LinkedIn_Auth_flow_Steps.md
new file mode 100644
index 00000000..91a61828
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/FB_LinkedIn_Auth_flow_Steps.md
@@ -0,0 +1,210 @@
+## IGNY8 Socializer Module - Development Flow
+
+---
+
+### 1. Meta (Facebook) Setup
+
+**One-time Config:**
+- Create Business App at developers.facebook.com
+- Add Facebook Login + Pages API products
+- Set redirect URI: `https://igny8.com/auth/facebook/callback`
+- Request permissions: `pages_manage_posts`, `pages_read_engagement`, `publish_to_groups`
+- Submit for App Review (required for production)
+
+**What to Build:**
+
+| Component | Details |
+|-----------|---------|
+| Connect Button | Triggers OAuth, stores long-lived user token + page tokens |
+| Account Picker | After auth, user selects which Pages/Groups to enable |
+| Token Refresh Job | Cron to refresh tokens before 60-day expiry |
+| Post Service | Accepts content + destination, calls `/{page-id}/feed` |
+| Webhook Listener | Optional: receive post status updates |
+
+**Posting Capabilities:**
+- ✅ Pages (as Page)
+- ⚠️ Groups (limited, user must be admin, needs approval)
+- ❌ Personal profiles (blocked by Meta)
+
+---
+
+### 2. LinkedIn Setup
+
+**One-time Config:**
+- Create App at linkedin.com/developers
+- Verify/associate with a Company Page
+- Request products: "Share on LinkedIn", "Marketing Developer Platform" (for org posting)
+- Set redirect URI: `https://igny8.com/auth/linkedin/callback`
+- Permissions: `w_member_social`, `w_organization_social`, `r_liteprofile`, `r_organization_social`
+
+**What to Build:**
+
+| Component | Details |
+|-----------|---------|
+| Connect Button | OAuth flow, store access token + refresh token |
+| Account Picker | User selects personal profile and/or Company Pages they admin |
+| Token Refresh Job | Use refresh token before 60-day expiry |
+| Post Service | Calls `/rest/posts` with author URN (person or organization) |
+| URN Storage | Store `urn:li:person:{id}` and `urn:li:organization:{id}` per account |
+
+**Posting Capabilities:**
+- ✅ Personal profile
+- ✅ Company Pages (user must be admin)
+- ❌ Groups (no API)
+
+---
+
+### 3. Database Schema (additions)
+
+```
+SocialAccount
+├── user (FK to IGNY8 user)
+├── platform (facebook | linkedin)
+├── platform_user_id
+├── access_token (encrypted)
+├── refresh_token (encrypted, LinkedIn only)
+├── token_expires_at
+├── scopes_granted
+├── created_at / updated_at
+
+SocialDestination
+├── social_account (FK)
+├── destination_type (page | group | profile | company)
+├── destination_id (platform's ID)
+├── destination_name
+├── is_active
+├── permissions_valid
+
+SocialPost
+├── site (FK to user's IGNY8 site)
+├── content_source (FK to generated content)
+├── destination (FK to SocialDestination)
+├── platform_post_id
+├── status (pending | posted | failed)
+├── posted_at
+├── error_message
+```
+
+---
+
+### 4. Backend Services
+
+| Service | Purpose |
+|---------|---------|
+| `SocialAuthService` | Handle OAuth callbacks, token exchange, storage |
+| `TokenRefreshService` | Scheduled job to refresh expiring tokens |
+| `DestinationSyncService` | After auth, fetch and store available pages/groups/companies |
+| `SocialPublisherService` | Generic interface → platform-specific posting logic |
+| `PostQueueWorker` | Process scheduled social posts from queue |
+
+---
+
+### 5. Frontend Components
+
+| Component | Purpose |
+|-----------|---------|
+| Social Connections Page | List connected accounts, connect/disconnect buttons |
+| Destination Selector | Per-site config: which destinations receive auto-posts |
+| Post Preview Modal | Before posting: preview how content appears |
+| Post History Table | Show status of all social posts per site |
+| Settings per Destination | Customize format, hashtags, include link, image behavior |
+
+---
+
+### 6. Content-to-Social Flow
+
+```
+Content Published to WP
+ ↓
+Check site's social destinations (active ones)
+ ↓
+For each destination:
+ → Format content (title, excerpt, link, image)
+ → Apply destination-specific template
+ → Queue SocialPost record
+ ↓
+PostQueueWorker picks up
+ ↓
+Call platform API → update status → log result
+```
+
+---
+
+### 7. Post Formatting Options (per destination)
+
+- Post template: `{title}\n\n{excerpt}\n\nRead more: {url}`
+- Include featured image: yes/no
+- Auto-hashtags from keywords
+- Character limit handling (LinkedIn: 3000, Facebook: 63,206)
+- Link preview behavior
+
+---
+
+### 8. Error Handling
+
+- Token expired → mark account as needs reconnection, notify user
+- Rate limited → exponential backoff retry
+- Permission revoked → disable destination, notify user
+- API error → log, retry up to 3x, then mark failed
+
+---
+---
+
+## Rate Limits & User Limits
+
+---
+
+### Facebook/Meta
+
+**No limit on number of users/pages/groups** connecting to your single app.
+
+**But there are API call limits:**
+
+| Limit Type | Details |
+|------------|---------|
+| App-level | 200 calls/user/hour baseline, scales with active users |
+| Page posting | ~25 posts/page/day (soft limit, not documented hard cap) |
+| Groups | Much stricter, ~5-10 posts/day/group to avoid spam flags |
+| Burst protection | Too many calls in short time = temporary throttle |
+
+**Scaling factor:** Your app's call limit increases automatically as more users connect (more users = higher pool).
+
+---
+
+### LinkedIn
+
+**No limit on users/companies** connecting.
+
+**API limits:**
+
+| Limit Type | Details |
+|------------|---------|
+| Daily app limit | 100,000 calls/day (standard tier) |
+| Per-user posting | ~100-150 posts/day/member (undocumented soft limit) |
+| Company pages | ~100 posts/day/org |
+| Rate limit | 100 requests/minute per user token |
+
+**Marketing Developer Platform** (if approved): Higher limits for company page management.
+
+---
+
+### Practical Concerns
+
+| Concern | Reality |
+|---------|---------|
+| 100 IGNY8 users, each with 2 pages | No problem at all |
+| 1000 users, each with 5 pages | Still fine, monitor call volume |
+| Spam behavior | Biggest risk - platforms will flag/ban aggressive posting |
+
+---
+
+### Recommendations for IGNY8
+
+1. **Implement per-destination cooldowns** - minimum 4-6 hours between posts to same page/group
+2. **Track API usage** - log calls, alert if approaching limits
+3. **Queue with spreading** - don't burst 50 posts at once, spread across hours
+4. **User-level limits** - cap posts/day per destination in your own system
+
+---
+
+No licensing fees or per-seat costs from Meta/LinkedIn for API access itself. Just respect the rate limits and avoid spammy patterns.
\ No newline at end of file
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/GSC_plnning_to_be_updated_consistent_with_supported_API_and_Igny8_app.md b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/GSC_plnning_to_be_updated_consistent_with_supported_API_and_Igny8_app.md
new file mode 100644
index 00000000..e69de29b
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Linker_Module_Plan.md b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Linker_Module_Plan.md
new file mode 100644
index 00000000..3ad32158
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Linker_Module_Plan.md
@@ -0,0 +1,264 @@
+# Linker Module Plan (Detailed)
+
+**Scope:** Current implementation is **WordPress-only** for publishing/sync and content discovery. The design supports future Shopify and custom sites but is **not enabled** for them in v1.
+
+**Status Today:** Linker module exists but is inactive by default and not fully protected by feature flags. See [docs/10-MODULES/LINKER.md](../../10-MODULES/LINKER.md).
+
+---
+
+## 1) Goal
+Enable AI-driven internal and external linking for all content types that IGNY8 manages or syncs, while staying consistent with the existing pipeline and settings architecture.
+
+**Primary objectives:**
+- Increase topical authority via strategic internal linking (posts, pages, taxonomy pages, cluster pages, products, services).
+- Improve UX and SEO through better anchor placement and link coverage.
+- Maintain link hygiene with ongoing link health monitoring.
+- Support outbound linking to authoritative sources with relevance scoring.
+- Provide a pathway for **backlink discovery** (informational only in v1, no outreach automation).
+
+---
+
+## 2) Feature Set (Detailed)
+
+### 2.1 Internal Linking (Core)
+**What it does**
+- Suggests internal links for content based on keyword clusters, topic similarity, and taxonomy alignment.
+
+**Targets supported**
+- Posts
+- Pages
+- Taxonomy archives (category/tag)
+- Cluster pages (IGNY8-defined topical clusters)
+- Product pages *(WordPress product CPT if present; Shopify later)*
+- Service pages *(custom post types if configured)*
+
+**Anchor strategies**
+- Exact match
+- Partial match
+- Semantic match
+- Brand-safe anchor constraints (from site-level settings)
+
+**Controls**
+- Max links per content item
+- Per-section link density caps
+- Avoid repeated anchors
+- Exclude URLs or content statuses (draft, private)
+
+---
+
+### 2.2 External Linking (Authority Sources)
+**What it does**
+- Recommends outbound links to reputable domains relevant to content topic.
+
+**Constraints**
+- Domain whitelist/blacklist
+- Authority threshold (DR/DA proxy)
+- No competitor domains (configurable)
+- Link type: dofollow/nofollow
+
+---
+
+### 2.3 Backlink Discovery (Read-only in v1)
+**What it does**
+- Lists relevant external sites that are topically related for future outreach.
+
+**Notes**
+- No automated outreach in v1.
+- Future: integrate with email/outreach tools.
+
+---
+
+### 2.4 Link Health & Monitoring
+**What it does**
+- Detects broken internal/external links.
+- Tracks link status and changes.
+
+**Actions**
+- Flag broken links
+- Suggest replacements
+- Quick-fix internal links
+
+---
+
+### 2.5 Automation & Pipeline Integration
+**What it does**
+- Can run after Writer stage to enrich IGNY8-generated content.
+- Can run on synced WordPress content.
+
+**Modes**
+- Manual: per content item
+- Batch: selected items
+- Automation stage: optional in automation pipeline
+
+---
+
+## 3) App-Consistent Architecture
+
+### 3.1 Backend Modules (Aligned with Current Structure)
+- Existing: `backend/igny8_core/modules/linker/`
+- Existing: `backend/igny8_core/business/content/services/content_pipeline_service.py`
+
+**Add / Extend**
+- `business/linker/` (services, scoring, health checks)
+- `modules/linker/models.py` (link suggestions, health checks)
+- `modules/linker/serializers.py`
+- `modules/linker/views.py` (extend API)
+
+---
+
+### 3.2 Data Models (Proposed)
+
+**LinkSuggestion**
+- `account`, `site`, `content`
+- `anchor_text`, `anchor_strategy`
+- `target_url`, `target_content_id` (nullable for external)
+- `target_type` (internal/external/taxonomy/cluster/product/service)
+- `confidence_score`
+- `status` (suggested/applied/rejected)
+- `metadata` (keyword match, similarity score)
+
+**LinkHealthStatus**
+- `site`, `url`, `status_code`, `last_checked_at`, `is_broken`
+
+**ExternalSourceCandidate**
+- `topic`, `domain`, `url`, `authority_score`, `relevance_score`
+
+---
+
+### 3.3 API Endpoints (Aligned with Existing Style)
+
+**Existing**
+- `POST /api/v1/linker/process/`
+- `POST /api/v1/linker/batch_process/`
+
+**Add**
+- `GET /api/v1/linker/suggestions/?content_id=`
+- `POST /api/v1/linker/apply/`
+- `POST /api/v1/linker/reject/`
+- `POST /api/v1/linker/health/scan/`
+- `GET /api/v1/linker/health/status/?site_id=`
+- `GET /api/v1/linker/external-sources/?content_id=`
+
+---
+
+### 3.4 Frontend Pages (Consistent with Current UI)
+
+**Pages**
+- `/linker/content` (list content + status + batch actions)
+- `/linker/content/:id` (link suggestions + apply)
+
+**Components**
+- Suggestions table
+- Inline preview with anchor highlights
+- Link health panel
+- External sources panel
+
+---
+
+## 4) WordPress-Only Scope (Current Release)
+
+### 4.1 WordPress Content Types
+- Posts
+- Pages
+- Categories / Tags (taxonomy archives)
+- Custom post types (products/services) if configured in integration
+
+### 4.2 WordPress Sync Integration
+- Leverage existing sync flows to ingest WordPress content and taxonomies.
+- Maintain `wordpress_id` mapping for internal link targeting.
+
+---
+
+## 5) Linking Logic (High-Level)
+
+### 5.1 Internal Link Discovery
+- Cluster overlap
+- Keyword match to title + headers
+- Taxonomy match (category/tag)
+- Content type compatibility
+
+### 5.2 External Link Discovery
+- Use curated sources or internal dataset
+- Score by relevance + authority
+
+### 5.3 Anchor Placement
+- Avoid headings and existing links
+- Prefer first 60% of content
+- Cap per section
+
+---
+
+## 6) Settings & Controls (Unified Settings)
+
+**Site Settings → Automation tab**
+- Enable Linker module
+- Max internal links per content
+- Max external links per content
+- Target link density
+- Excluded URLs / domains
+- Anchor text rules
+
+---
+
+## 7) Notifications
+- “Link suggestions ready”
+- “Links applied”
+- “Broken links detected”
+
+---
+
+## 8) Rollout Phases
+
+**Phase 1 (MVP)**
+- Internal links + anchor suggestions
+- Manual apply
+- Content-level preview
+
+**Phase 2**
+- External link suggestions
+- Batch processing
+
+**Phase 3**
+- Link health scanning
+- Automation stage support
+
+**Phase 4**
+- Backlink discovery (read-only)
+
+---
+
+## 9) Non-Goals (v1)
+- Automated outreach
+- Paid backlink acquisition
+- Shopify support (future)
+- Custom CMS adapters (future)
+
+---
+
+## 10) Success Criteria
+- Increased internal link coverage per content piece
+- Reduced orphaned content
+- Improved ranking on linked clusters
+- Minimal false-positive link placements
+
+---
+
+## 11) Dependencies
+- Content metadata quality (keywords, clusters, taxonomies)
+- WordPress integration sync health
+- Automation settings availability
+
+---
+
+## 12) Risks & Mitigations
+- **Risk:** Over-linking → **Mitigation:** enforce density caps and editor review.
+- **Risk:** Bad anchors → **Mitigation:** anchor validation + manual approval.
+- **Risk:** Broken external links → **Mitigation:** link health checks + replacements.
+
+---
+
+## 13) Future Extensions (Post‑WordPress)
+- Shopify product catalogs
+- Custom CMS content ingestion
+- Cross-domain linking for multi-brand portfolios
+- Outreach workflows for backlink acquisition
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Optimizer_Module_Plan.md b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Optimizer_Module_Plan.md
new file mode 100644
index 00000000..a16b1619
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Optimizer_Module_Plan.md
@@ -0,0 +1,235 @@
+# Optimizer Module Plan (Detailed)
+
+**Scope:** Optimizer focuses on **rewriting/optimizing existing content** across posts, pages, products, services, company pages, and taxonomy archives. Current release scope is **WordPress-only** (publish/sync + content discovery). Shopify/custom support is future.
+
+**Status Today:** Optimizer module exists but is inactive by default and partially implemented. See [docs/10-MODULES/OPTIMIZER.md](../../10-MODULES/OPTIMIZER.md).
+
+---
+
+## 1) Goal
+Upgrade existing content to SEO‑strong, intent‑aligned pages by:
+- Mapping content to **semantic/topic clusters**.
+- Aligning page intent with cluster keyword targets.
+- Rewriting structure + content to match current search intent.
+- Adding schema, metadata, and on‑page SEO improvements.
+
+---
+
+## 2) Feature Set (Detailed)
+
+### 2.1 Content Types Supported (WordPress v1)
+- Posts (blog/article)
+- Pages (static)
+- Products (custom post type, if configured)
+- Services (custom post type, if configured)
+- Company pages (about/team/careers/FAQ/press)
+- Taxonomy archives (category/tag)
+- Cluster pages (IGNY8 cluster views)
+
+---
+
+### 2.2 Cluster‑Aligned Optimization
+**What it does**
+- Associates each content item with a **primary cluster** + secondary clusters.
+- Uses cluster keyword list as optimization targets.
+
+**Outputs**
+- Updated content aligned to the best matching cluster intent.
+- Keyword coverage improvements with semantic variants.
+
+---
+
+### 2.3 Intent‑Aligned Rewrite Engine
+**What it does**
+- Rewrites content to match user intent (informational, commercial, transactional).
+- Adjusts structure and sections to meet SERP expectations.
+
+**Capabilities**
+- Expand thin pages into full SEO pages.
+- Compress overly long pages to reduce fluff.
+- Add missing sections and re‑order content flow.
+
+---
+
+### 2.4 SEO‑Rich Output (Structure + Meta + Schema)
+**What it does**
+- Generates SEO‑optimized headings, internal structure, and metadata.
+- Adds schema markup when applicable.
+
+**Includes**
+- Meta title + meta description refresh
+- H1/H2/H3 structure alignment
+- Internal/external link placeholders (Linker integration)
+- Image alt text improvements
+- Schema JSON‑LD (Article, Product, FAQ, Organization, Breadcrumb, Service)
+
+---
+
+### 2.5 Page‑Level Optimization Scores
+**What it does**
+- Scores before/after content quality using current Optimizer scoring model.
+- Tracks improvements by cluster alignment + keyword coverage.
+
+---
+
+## 3) App‑Consistent Architecture
+
+### 3.1 Backend Modules (Aligned with Current Structure)
+- Existing: `backend/igny8_core/modules/optimizer/`
+- Existing: `backend/igny8_core/business/optimization/`
+
+**Add / Extend**
+- `business/optimization/cluster_mapping.py` (cluster assignment & keyword targets)
+- `modules/optimizer/models.py` (extend OptimizationTask)
+- `modules/optimizer/serializers.py` (add cluster mapping + schema)
+- `modules/optimizer/views.py` (extend API)
+
+---
+
+### 3.2 Data Models (Proposed Extensions)
+
+**OptimizationTask** (extend)
+- `primary_cluster_id`
+- `secondary_cluster_ids` (JSON)
+- `keyword_targets` (JSON)
+- `schema_type` (article/product/service/faq/org)
+- `schema_json` (JSON)
+- `metadata_before` (JSON)
+- `metadata_after` (JSON)
+- `structure_changes` (JSON)
+
+---
+
+### 3.3 API Endpoints (Aligned with Existing Style)
+
+**Existing**
+- `POST /api/v1/optimizer/analyze/`
+- `POST /api/v1/optimizer/optimize/`
+- `POST /api/v1/optimizer/batch_optimize/`
+
+**Add**
+- `POST /api/v1/optimizer/assign_cluster/`
+- `GET /api/v1/optimizer/cluster_suggestions/?content_id=`
+- `POST /api/v1/optimizer/preview/` (structure + metadata + schema preview)
+- `POST /api/v1/optimizer/apply/` (persist optimized version)
+
+---
+
+### 3.4 Frontend Pages (Consistent with Current UI)
+
+**Pages**
+- `/optimizer/content` (content list + status)
+- `/optimizer/preview/:id` (analysis + diff + schema preview)
+
+**Components**
+- Cluster mapping panel
+- Keyword target editor
+- Structure diff viewer
+- Metadata + schema preview
+
+---
+
+## 4) WordPress‑Only Scope (Current Release)
+
+### 4.1 WordPress Content Coverage
+- Posts and Pages
+- Taxonomy archives (category/tag)
+- Custom post types (products/services if configured)
+
+### 4.2 WordPress Sync Integration
+- Use existing sync pipelines to pull WordPress content.
+- Maintain `wordpress_id` mapping for optimized updates.
+
+---
+
+## 5) Optimization Logic (High‑Level)
+
+### 5.1 Cluster Matching
+- Analyze content title, headings, and keyword density.
+- Match to existing cluster keyword sets.
+- Provide suggestions if confidence < threshold.
+
+### 5.2 Content Rewrite
+- Rebuild structure to match intent + cluster focus.
+- Inject missing sections (FAQs, comparisons, benefits, use cases).
+- Normalize tone with existing Writer prompt settings.
+
+### 5.3 SEO Enhancements
+- Meta title/description refresh
+- Heading structure refinement
+- Internal link opportunities (handoff to Linker)
+- Schema generation based on content type
+
+---
+
+## 6) Settings & Controls (Unified Settings)
+
+**Site Settings → Automation tab**
+- Enable Optimizer module
+- Default schema type per content type
+- Keyword density targets
+- Content length guidelines
+- Allow auto‑apply vs manual review
+
+---
+
+## 7) Notifications
+- “Optimization analysis ready”
+- “Optimization applied”
+- “Schema generated”
+
+---
+
+## 8) Rollout Phases
+
+**Phase 1 (MVP)**
+- Analyze + optimize existing posts/pages
+- Cluster mapping suggestions
+- Manual apply
+
+**Phase 2**
+- Products/services/company pages support
+- Schema + metadata output
+
+**Phase 3**
+- Taxonomy archive optimization
+- Batch optimization
+
+**Phase 4**
+- Full automation stage integration
+
+---
+
+## 9) Non‑Goals (v1)
+- Shopify/custom CMS support
+- Automated schema validation tools
+- Automatic publishing without review
+
+---
+
+## 10) Success Criteria
+- Increased keyword coverage vs cluster targets
+- Higher content quality scores (before/after)
+- Improved SERP performance for optimized pages
+
+---
+
+## 11) Dependencies
+- Cluster data quality in Planner
+- WordPress sync reliability
+- Unified settings availability
+
+---
+
+## 12) Risks & Mitigations
+- **Risk:** Over‑optimization → **Mitigation:** density caps + manual review.
+- **Risk:** Wrong cluster mapping → **Mitigation:** suggestion + override flow.
+- **Risk:** Schema mismatch → **Mitigation:** type validation + preview.
+
+---
+
+## 13) Future Extensions (Post‑WordPress)
+- Shopify product catalogs
+- Custom CMS adapters
+- Automated schema validation pipeline
+- SERP‑based optimization suggestions
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Socializer_Video_Modules_Plan.md b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Socializer_Video_Modules_Plan.md
new file mode 100644
index 00000000..c4b3a149
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Socializer_Video_Modules_Plan.md
@@ -0,0 +1,187 @@
+# Socializer + Video Content Creator Plan (Detailed)
+
+**Scope:** Q3–Q4 2026 modules from https://igny8.com/upcoming. Integrations target top social platforms. Content sources are IGNY8‑generated and optimized (new or rewritten), linked back to the original page/post/product/service.
+
+**Goal:** Automate multi‑platform social publishing and video creation for every IGNY8 content item, using consistent app structure (Ideas → Tasks → Content → Images → Publish + Automation + Calendar).
+
+---
+
+## 1) Socializer Module (Multi‑Platform Social Publishing)
+
+### 1.1 Core Capabilities
+- Auto‑generate platform‑specific social posts from any IGNY8 content item.
+- Schedule and auto‑publish to connected social accounts.
+- Maintain back‑links to the original page/post/product/service.
+- Provide a unified social calendar integrated with content calendar.
+
+### 1.2 Content Sources (What can be socialized)
+- Posts (blog/article)
+- Pages (static)
+- Products (WooCommerce)
+- Services (custom post type)
+- Company pages
+- Taxonomy landing pages
+
+**Rule:** Any IGNY8 content item (new or optimized) can generate social content.
+
+### 1.3 Platform Targets (Phase 1)
+- LinkedIn
+- Twitter/X
+- Facebook
+- Instagram (posts + reels)
+- TikTok (short video)
+
+### 1.4 Platform‑Specific Output
+- **Text posts:** title + summary + CTA + link
+- **Captions:** tone/length variations per platform
+- **Images:** resized and cropped per platform specs
+- **Short videos / reels:** generated from content (via Video module)
+
+### 1.5 Social Post Types
+- **Announcement:** “New article/product/service” with link
+- **Highlights:** key takeaways + CTA
+- **Quote cards:** single insight with branded template
+- **FAQ snippets:** for services or product categories
+- **Carousel (future):** multi‑panel posts
+
+### 1.6 Scheduling & Automation
+- Auto‑publish on content approval or scheduled publish.
+- Schedule rules: time windows, frequency caps, platform‑specific limits.
+- Sync with Publisher scheduling (same calendar).
+
+---
+
+## 2) Video Content Creator (AI Video Generation & Publishing)
+
+### 2.1 Core Capabilities
+- Convert articles/pages into video scripts.
+- Generate short‑form videos (Reels/Shorts/TikTok).
+- Generate long‑form YouTube videos with chapters.
+- Auto‑publish to video platforms.
+
+### 2.2 Video Types
+- **Short:** 15–60s highlights
+- **Medium:** 60–180s summaries
+- **Long:** 5–12 min explainer (YouTube)
+
+### 2.3 Video Outputs
+- Script + captions
+- AI voiceover or user‑uploaded voice
+- Visuals: stock + AI images + brand templates
+- Titles, descriptions, tags (SEO optimized)
+
+### 2.4 Publishing Targets (Phase 1)
+- YouTube
+- TikTok
+- Instagram Reels
+- YouTube Shorts
+
+---
+
+## 3) Integration with IGNY8 Content Workflow
+
+### 3.1 Trigger Points
+- On **content approval**
+- On **scheduled publish**
+- On **optimizer rewrite completion**
+
+### 3.2 Link‑Back Rule
+Every social/video post must link to the original page/post/product on the site.
+
+### 3.3 Metadata Alignment
+- Use IGNY8 meta title + description as base.
+- Add platform‑specific variations.
+
+---
+
+## 4) App‑Consistent Architecture
+
+### 4.1 Backend Modules (Proposed)
+- `backend/igny8_core/modules/socializer/`
+- `backend/igny8_core/business/social/`
+- `backend/igny8_core/modules/video/`
+- `backend/igny8_core/business/video/`
+
+### 4.2 Data Models (Proposed)
+
+**SocialAccount**
+- `account`, `site`, `platform`, `auth_tokens`, `status`
+
+**SocialPost**
+- `content_id`, `platform`, `post_type`, `caption`, `media_url`, `status`, `scheduled_at`, `published_at`, `external_id`
+
+**VideoProject**
+- `content_id`, `type`, `script`, `voice`, `status`, `video_url`, `published_at`
+
+**EngagementMetric**
+- `platform`, `post_id`, `views`, `likes`, `comments`, `shares`
+
+---
+
+## 5) API Endpoints (Proposed)
+
+### Socializer
+- `POST /api/v1/social/accounts/connect/`
+- `GET /api/v1/social/accounts/`
+- `POST /api/v1/social/posts/generate/`
+- `POST /api/v1/social/posts/schedule/`
+- `POST /api/v1/social/posts/publish/`
+- `GET /api/v1/social/posts/status/`
+
+### Video Creator
+- `POST /api/v1/video/projects/generate/`
+- `POST /api/v1/video/projects/publish/`
+- `GET /api/v1/video/projects/status/`
+
+---
+
+## 6) Frontend Pages
+
+### Socializer
+- `/social/accounts` – connect platforms
+- `/social/calendar` – unified social calendar
+- `/social/posts` – list + status + actions
+
+### Video Creator
+- `/video/projects` – list + status
+- `/video/preview/:id` – script + preview + publish
+
+---
+
+## 7) Scheduling & Automation Rules
+- Respect per‑platform rate limits.
+- Enforce daily/weekly caps per site.
+- Time‑slot scheduling aligned with Publisher rules.
+
+---
+
+## 8) Rollout Phases
+
+**Phase 1**
+- Social accounts + post generation
+- Manual scheduling + publish
+
+**Phase 2**
+- Auto‑publish on content approval
+- Calendar integration
+
+**Phase 3**
+- Video creator (short‑form)
+- Auto‑publish to video platforms
+
+**Phase 4**
+- Long‑form video creation + analytics
+
+---
+
+## 9) Success Criteria
+- Every IGNY8 content item can generate social + video assets.
+- Social posts consistently link back to the original page.
+- Improved traffic attribution from social channels.
+
+---
+
+## 10) Non‑Goals (v1)
+- Social ad automation
+- Outreach automation
+- Shopify/custom CMS publishing
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Taxonomy_Term_Content_Plan.md b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Taxonomy_Term_Content_Plan.md
new file mode 100644
index 00000000..6f7acba4
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/Future_Moduels_Features/Taxonomy_Term_Content_Plan.md
@@ -0,0 +1,199 @@
+# Taxonomy & Term Content Plan (Detailed)
+
+**Scope:** WordPress-only for current release. Shopify/custom sites remain future.
+
+**Goal:** Make taxonomy terms and archives first‑class content pages (SEO landing pages) that are generated, optimized, and mapped to clusters using the same Planner → Writer → Optimizer pipeline as posts.
+
+---
+
+## 1) Current App Findings (Relevant Parts)
+
+### 1.1 Content Models Already Support Taxonomy
+- `Tasks` supports `content_type='taxonomy'` and `content_structure` values including `category_archive`, `tag_archive`, `attribute_archive`, `cluster_hub`. See [backend/igny8_core/business/content/models.py](../../backend/igny8_core/business/content/models.py).
+- `Content` supports `content_type='taxonomy'` and taxonomy‑specific structures. See [backend/igny8_core/business/content/models.py](../../backend/igny8_core/business/content/models.py).
+- `ContentTaxonomy` exists with `external_taxonomy`, `external_id`, `description`, and `metadata` for sync. See [backend/igny8_core/business/content/models.py](../../backend/igny8_core/business/content/models.py).
+
+### 1.2 WordPress Client Already Knows Taxonomies
+- WordPress REST: `get_categories`, `get_tags`, `create_category`, `create_tag`. See [backend/igny8_core/utils/wordpress.py](../../backend/igny8_core/utils/wordpress.py).
+- WooCommerce: product categories + attributes and terms are fetchable. See [backend/igny8_core/utils/wordpress.py](../../backend/igny8_core/utils/wordpress.py).
+
+### 1.3 Sync Service Partially Implemented (Then Removed)
+- Taxonomy sync functions exist but are currently **skipped** with a “legacy removed” note. See [backend/igny8_core/business/integration/services/content_sync_service.py](../../backend/igny8_core/business/integration/services/content_sync_service.py).
+- Posts sync assigns placeholder categories/tags by ID; product sync stores categories/tags/attributes in metadata only.
+
+**Conclusion:** The database and data model already allow taxonomy content, but sync + content generation for terms is incomplete.
+
+---
+
+## 2) Target Outcome
+
+### 2.1 First‑Class Term Landing Pages
+Every taxonomy term becomes a **rich SEO landing page** rather than a simple list of posts.
+
+**Examples**
+- Category: “Electric Toothbrushes” → full landing page with intro, buyer guidance, top items, FAQs.
+- Tag: “Remote Work” → topical overview + curated posts.
+- Product Attribute: “Material: Stainless Steel” → attribute landing page.
+
+### 2.2 Cluster‑Aligned Structure
+- Each term is mapped to **primary cluster** + optional secondary clusters.
+- Each term page follows a **cluster‑aligned structure** (H2/H3 outline, keyword coverage, semantic variants).
+
+### 2.3 Same Pipeline as Posts
+Planner → Writer → Optimizer should work for taxonomy pages the same way it works for posts.
+
+---
+
+## 3) Functional Scope
+
+### 3.1 Content Writer for All Terms (Default + Custom Taxonomies)
+- WordPress default: category, post_tag
+- WooCommerce: product_cat, product_tag
+- Product attributes (e.g., `pa_color`, `pa_size`)
+- Custom taxonomies (configurable list from site integration)
+
+### 3.2 Products Pages Writing
+- Use existing product sync data + clusters to generate product landing pages and individual product enhancements.
+
+### 3.3 Services / Company Pages Writing
+- Use existing Writer structures (`service_page`, `business_page`, `general`) and cluster mapping.
+
+### 3.4 Cluster Hub Pages
+- Create **cluster landing pages** that aggregate all related terms + posts + products.
+
+---
+
+## 4) Architecture Plan (Aligned with App)
+
+### 4.1 Taxonomy Sync (WordPress)
+**Add/Restore taxonomy sync** in `ContentSyncService`:
+- Fetch categories & tags via `WordPressClient`.
+- Fetch WooCommerce product categories + attributes + terms.
+- Sync to `ContentTaxonomy` with correct `external_taxonomy` values.
+
+**Why:** term metadata is required for mapping, writing, and linking.
+
+---
+
+### 4.2 Term‑to‑Cluster Mapping
+**New service:** `business/optimization/cluster_mapping.py` (shared with Optimizer).
+- Map term name/description to clusters.
+- Persist mapping in `Content.cluster` and/or a `ContentClusterMap`.
+
+---
+
+### 4.3 Term Content Generation (Writer)
+**Flow (mirrors posts):**
+1. Create `ContentIdea` from term + cluster data.
+2. Create `Tasks` with `content_type='taxonomy'` and appropriate `content_structure`.
+3. Use Writer to generate HTML content, meta, and structure.
+4. Save as `Content` linked to `ContentTaxonomy`.
+
+**Suggested structures:**
+- Category → `category_archive`
+- Tag → `tag_archive`
+- Attribute → `attribute_archive`
+- Cluster landing → `cluster_hub`
+
+---
+
+### 4.4 Publishing Back to WordPress
+**WordPress update targets:**
+- Write generated content to **term description** for taxonomy pages.
+- Store structured content in term meta (future: ACF or custom IGNY8 plugin fields).
+
+**Notes:**
+- WordPress term descriptions accept HTML and can be displayed by themes.
+
+---
+
+### 4.5 Optimizer Alignment
+Use Optimizer to:
+- Rewrite existing term descriptions.
+- Align term pages with cluster keyword targets.
+- Inject schema and metadata updates.
+
+---
+
+## 5) API & UI Plan
+
+### 5.1 API Endpoints (Proposed)
+- `GET /api/v1/taxonomy/terms/?site_id=`
+- `POST /api/v1/taxonomy/terms/sync/`
+- `POST /api/v1/taxonomy/terms/create_tasks/`
+- `POST /api/v1/taxonomy/terms/optimize/`
+- `POST /api/v1/taxonomy/terms/publish/`
+
+### 5.2 UI Pages
+- **Taxonomy Overview**: list terms, cluster mapping status, content status.
+- **Term Content Editor**: preview + rewrite + publish.
+- **Cluster Hub Manager**: cluster landing pages and cross‑links.
+
+---
+
+## 6) Keyword + Cluster Strategy
+
+### 6.1 Term‑Cluster Assignment
+- Auto‑assign cluster based on keyword overlap + semantic similarity.
+- Manual override in UI.
+
+### 6.2 Term Keyword Targets
+- Use cluster keywords as primary/secondary targets.
+- Add term‑specific modifiers (e.g., “best”, “vs”, “near me”).
+
+---
+
+## 7) Term Landing Page Structure (SEO‑Rich)
+
+**Default sections (taxonomy pages):**
+1. Intro + term definition
+2. Key subtopics (H2/H3)
+3. Top related posts/products/services
+4. FAQs
+5. Internal links to related clusters
+
+**Schema:**
+- `CollectionPage` or `WebPage`
+- `FAQPage` if FAQs present
+
+---
+
+## 8) Rollout Phases
+
+**Phase 1**
+- Taxonomy sync (categories + tags)
+- Term mapping to clusters
+- Writer tasks for term pages
+
+**Phase 2**
+- WooCommerce product categories + attributes
+- Term optimization with Optimizer
+
+**Phase 3**
+- Cluster hub pages
+- Full taxonomy publish flow
+
+**Phase 4**
+- Custom taxonomies configuration
+- Cross‑site cluster navigation
+
+---
+
+## 9) Success Criteria
+- All taxonomy terms have generated content and cluster mapping.
+- Term landing pages outperform plain archive pages.
+- Consistent internal linking between clusters, terms, and posts.
+
+---
+
+## 10) Risks & Mitigations
+- **Risk:** Themes not showing term descriptions → **Mitigation:** IGNY8 plugin blocks or template guidance.
+- **Risk:** Incorrect cluster mapping → **Mitigation:** manual override + suggestions.
+- **Risk:** Over‑optimization → **Mitigation:** density caps + manual review.
+
+---
+
+## 11) Non‑Goals (v1)
+- Shopify taxonomy sync
+- Custom CMS adapters
+- Automated publishing without review
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/GO-LIVE-CHECKLIST.md b/v2/Live Docs on Server/igny8-app-docs/plans/GO-LIVE-CHECKLIST.md
new file mode 100644
index 00000000..01e39de0
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/GO-LIVE-CHECKLIST.md
@@ -0,0 +1,145 @@
+# 🚀 IGNY8 Go-Live Checklist
+
+**Date:** January 20, 2026
+**Purpose:** Quick reference for launching IGNY8 to production
+
+---
+
+## ✅ Pre-Launch Checklist
+
+### Infrastructure Ready
+- [ ] PostgreSQL running and accessible
+- [ ] Redis running and accessible
+- [ ] Caddy configured with SSL for all domains
+- [ ] DNS records pointing to server
+- [ ] Firewall configured (ports 80, 443 open)
+
+### Application Ready
+- [ ] Production `.env` configured with real secrets
+- [ ] All API keys set (OpenAI, Stripe, etc.)
+- [ ] Django `SECRET_KEY` is unique and secure
+- [ ] `DEBUG=False` in production
+- [ ] CORS and ALLOWED_HOSTS configured
+
+### Operational Scripts Ready
+- [x] `/data/app/igny8/scripts/ops/backup-db.sh`
+- [x] `/data/app/igny8/scripts/ops/backup-full.sh`
+- [x] `/data/app/igny8/scripts/ops/restore-db.sh`
+- [x] `/data/app/igny8/scripts/ops/deploy-production.sh`
+- [x] `/data/app/igny8/scripts/ops/deploy-staging.sh`
+- [x] `/data/app/igny8/scripts/ops/rollback.sh`
+- [x] `/data/app/igny8/scripts/ops/health-check.sh`
+- [x] `/data/app/igny8/scripts/ops/sync-prod-to-staging.sh`
+- [x] `/data/app/igny8/scripts/ops/log-rotate.sh`
+
+### Staging Environment (Optional but Recommended)
+- [x] `docker-compose.staging.yml` created
+- [x] `.env.staging.example` created
+- [ ] Copy to `.env.staging` and configure
+- [ ] Create staging database
+- [ ] Configure staging DNS records
+
+---
+
+## 🏁 Go-Live Steps
+
+### Step 1: Create Initial Backup
+```bash
+/data/app/igny8/scripts/ops/backup-db.sh pre-deploy
+```
+
+### Step 2: Verify Health
+```bash
+/data/app/igny8/scripts/ops/health-check.sh
+```
+
+### Step 3: Set Up Automated Backups
+```bash
+# Install cron job
+sudo cp /data/app/igny8/scripts/ops/igny8-cron /etc/cron.d/igny8
+sudo chmod 644 /etc/cron.d/igny8
+
+# Verify cron
+sudo crontab -l -u root
+```
+
+### Step 4: Test Backup & Restore (Optional)
+```bash
+# Create test backup
+/data/app/igny8/scripts/ops/backup-db.sh daily
+
+# Verify backup exists
+ls -la /data/backups/daily/
+```
+
+---
+
+## 📋 Daily Operations
+
+### Check System Health
+```bash
+/data/app/igny8/scripts/ops/health-check.sh
+```
+
+### View Logs
+```bash
+# Backend logs
+docker logs -f igny8_backend
+
+# All app logs
+docker compose -f /data/app/igny8/docker-compose.app.yml -p igny8-app logs -f
+```
+
+### Container Status
+```bash
+docker compose -f /data/app/igny8/docker-compose.app.yml -p igny8-app ps
+```
+
+---
+
+## 🚨 Emergency Procedures
+
+### Immediate Rollback
+```bash
+/data/app/igny8/scripts/ops/rollback.sh
+```
+
+### Restore Database
+```bash
+# List available backups
+ls -la /data/backups/
+
+# Restore from latest
+/data/app/igny8/scripts/ops/restore-db.sh /data/backups/latest_db.sql.gz
+```
+
+### Restart All Services
+```bash
+docker compose -f /data/app/igny8/docker-compose.app.yml -p igny8-app restart
+```
+
+---
+
+## 📁 Key File Locations
+
+| Item | Location |
+|------|----------|
+| Production Compose | `/data/app/igny8/docker-compose.app.yml` |
+| Staging Compose | `/data/app/igny8/docker-compose.staging.yml` |
+| Production Env | `/data/app/igny8/.env` |
+| Staging Env | `/data/app/igny8/.env.staging` |
+| Ops Scripts | `/data/app/igny8/scripts/ops/` |
+| Backups | `/data/backups/` |
+| Logs | `/data/logs/` |
+
+---
+
+## 📞 Support Contacts
+
+- **Documentation:** `/data/app/igny8/docs/`
+- **Deployment Guide:** `/data/app/igny8/docs/50-DEPLOYMENT/`
+- **Operations Guide:** `/data/app/igny8/docs/50-DEPLOYMENT/DEVOPS-OPERATIONS-GUIDE.md`
+
+---
+
+**You're ready to go live! 🎉**
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/SOCIALIZER-AND-VIDEO-CREATOR-MODULES.md b/v2/Live Docs on Server/igny8-app-docs/plans/SOCIALIZER-AND-VIDEO-CREATOR-MODULES.md
new file mode 100644
index 00000000..03f7a714
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/SOCIALIZER-AND-VIDEO-CREATOR-MODULES.md
@@ -0,0 +1,1376 @@
+# Socializer & Video Content Creator — Development Plan
+
+> **Created:** February 22, 2026
+> **Target Version:** v2.0.0
+> **Status:** Planning
+> **Dependencies:** Existing IGNY8 v1.8.4 architecture
+
+---
+
+## Table of Contents
+
+1. [Executive Summary](#1-executive-summary)
+2. [Module A: Socializer](#2-module-a-socializer)
+3. [Module B: Video Content Creator](#3-module-b-video-content-creator)
+4. [Shared Infrastructure](#4-shared-infrastructure)
+5. [Self-Hosted GPU Option](#5-self-hosted-gpu-option)
+6. [Database Schema (All New Models)](#6-database-schema)
+7. [AI Functions (New)](#7-ai-functions)
+8. [API Endpoints (New)](#8-api-endpoints)
+9. [Frontend Pages (New)](#9-frontend-pages)
+10. [Celery Tasks (New)](#10-celery-tasks)
+11. [Credit Cost Matrix](#11-credit-cost-matrix)
+12. [Development Phases](#12-development-phases)
+13. [Risk & Dependency Matrix](#13-risk--dependency-matrix)
+
+---
+
+## 1. Executive Summary
+
+Two new active modules extending the existing content pipeline:
+
+```
+CURRENT PIPELINE (v1.8.4):
+Keywords → Clusters → Ideas → Tasks → Content → Images → Published (WordPress)
+
+EXTENDED PIPELINE (v2.0.0):
+ ┌→ WordPress (existing)
+Keywords → Clusters → Ideas → Tasks → Content → Images ──┼→ Socializer → 5 Platforms
+ └→ Video Creator → 3+ Platforms
+```
+
+### What We're Building
+
+| Module | Purpose | Platforms | AI Involved |
+|--------|---------|-----------|-------------|
+| **Socializer** | Adapt published content into social posts, schedule across platforms | LinkedIn, Twitter/X, Facebook, Instagram, TikTok | Text adaptation, image resizing/generation, hashtag optimization |
+| **Video Creator** | Convert articles into video content, publish to video platforms | YouTube, Instagram Reels, TikTok, YouTube Shorts | Script generation, TTS voiceover, video assembly, thumbnail generation |
+
+### Integration Points with Existing System
+
+| Existing Component | How It's Used |
+|--------------------|---------------|
+| `Content` model | Source material for both modules |
+| `Images` model | Source images for social posts and video thumbnails |
+| `AIEngine` | Extended with new functions for social/video generation |
+| `ModelRegistry` / `AIModelConfig` | New models registered (TTS, video) |
+| `IntegrationProvider` | New providers added (social APIs, video APIs) |
+| `CreditService` | All operations are credit-based |
+| `AutomationConfig` | New stages 8 (Socializer) and 9 (Video) added to pipeline |
+| `NotificationService` | Notifications for publish success/failure |
+| `PublishingSettings` | Extended with social + video scheduling rules |
+| `Celery Beat` | New scheduled tasks for social posting windows |
+
+---
+
+## 2. Module A: Socializer
+
+### 2.1 Overview
+
+```
+┌──────────────────────────────────────────────────────────────────────────────┐
+│ SOCIALIZER MODULE │
+├──────────────────────────────────────────────────────────────────────────────┤
+│ │
+│ CONTENT (Published) │
+│ │ │
+│ ▼ │
+│ ┌─────────────────┐ ┌────────────────────────────────────────────────┐ │
+│ │ AI Adaptation │──►│ Platform-Specific Posts │ │
+│ │ Engine │ │ │ │
+│ │ │ │ LinkedIn → Professional tone, 1300 chars │ │
+│ │ • Tone shift │ │ Twitter/X → Punchy, 280 chars, thread option │ │
+│ │ • Length trim │ │ Facebook → Conversational, 500 chars │ │
+│ │ • Hashtag gen │ │ Instagram → Visual-first, 2200 chars+30 tags │ │
+│ │ • CTA insertion │ │ TikTok → Gen-Z tone, trending hooks │ │
+│ └─────────────────┘ └──────────────────────┬─────────────────────────┘ │
+│ │ │
+│ ┌────────────────────────────────────────┤ │
+│ ▼ ▼ │
+│ ┌─────────────────┐ ┌─────────────────┐ │
+│ │ Image Optimizer │ │ Social Calendar │ │
+│ │ │ │ │ │
+│ │ LinkedIn: 1200 │ │ Best-time slots │ │
+│ │ ×627 │ │ Queue management │ │
+│ │ Twitter: 1600 │ │ Drag-and-drop │ │
+│ │ ×900 │ │ Integrated with │ │
+│ │ Facebook: 1200 │ │ content calendar │ │
+│ │ ×630 │ └────────┬────────┘ │
+│ │ Instagram: 1080 │ │ │
+│ │ ×1080 │ ▼ │
+│ │ TikTok: 1080 │ ┌─────────────────┐ │
+│ │ ×1920 │ │ Platform APIs │ │
+│ │ │ │ (OAuth2 + SDK) │ │
+│ └─────────────────┘ └─────────────────┘ │
+│ │
+└──────────────────────────────────────────────────────────────────────────────┘
+```
+
+### 2.2 Platform API Requirements
+
+| Platform | API | Auth | Post Types | Rate Limits | Developer Access |
+|----------|-----|------|------------|-------------|-----------------|
+| **LinkedIn** | LinkedIn Marketing API v2 | OAuth 2.0 (3-legged) | Text, Image, Article, Carousel | 100 posts/day | Company page required, app review |
+| **Twitter/X** | X API v2 (Free/Basic/Pro) | OAuth 2.0 + PKCE | Tweet, Thread, Image, Poll | 1500 tweets/mo (Free), 3000 (Basic) | Developer account, app approval |
+| **Facebook** | Meta Graph API v19 | OAuth 2.0 (Page token) | Text, Photo, Link, Video, Carousel | 200 posts/hr per page | Meta Business verification |
+| **Instagram** | Instagram Graph API | OAuth 2.0 (via Facebook) | Photo, Carousel, Reel, Story | 25 API calls/hr per user | Facebook Business account required |
+| **TikTok** | TikTok Content Posting API | OAuth 2.0 | Video, Photo | 10k requests/day | TikTok for Developers access |
+
+### 2.3 Features Breakdown
+
+#### A. Content Adaptation (AI)
+
+| Feature | Description | AI Provider | Existing/New |
+|---------|-------------|-------------|--------------|
+| Tone adaptation | Rewrite content excerpt per platform voice | OpenAI GPT-4o / Anthropic Claude | New AI Function |
+| Length optimization | Trim/expand to platform char limits | OpenAI GPT-4o-mini | New AI Function |
+| Hashtag generation | Generate relevant, trending hashtags | OpenAI GPT-4o-mini | New AI Function |
+| CTA insertion | Add platform-appropriate calls-to-action | OpenAI GPT-4o-mini | Part of adaptation |
+| Thread splitting | Break long content into Twitter threads | OpenAI GPT-4o-mini | New AI Function |
+| Carousel creation | Split article into carousel slides (IG/LinkedIn) | OpenAI GPT-4o | New AI Function |
+| Emoji optimization | Add appropriate emojis per platform norms | Included in adaptation | Part of adaptation |
+
+#### B. Image Optimization
+
+| Feature | Description | AI Provider | Existing/New |
+|---------|-------------|-------------|--------------|
+| Resize/crop | Resize source images to platform specs | Pillow (local) | New utility |
+| Text overlay | Add headline text on images for social | Pillow + custom fonts | New utility |
+| Thumbnail generation | Create eye-catching social thumbnails | Runware / DALL-E / Bria | Extend existing |
+| Format conversion | Convert to platform-optimal format (WebP/JPG) | Pillow (local) | New utility |
+| Carousel image gen | Generate multiple slide images | Runware / DALL-E | Extend existing |
+
+**Platform Image Specs:**
+
+| Platform | Post Image | Story/Reel Cover | Carousel Slide | Max File Size |
+|----------|-----------|-------------------|----------------|---------------|
+| LinkedIn | 1200×627 | N/A | 1080×1080 | 10 MB |
+| Twitter/X | 1600×900 | N/A | N/A | 5 MB |
+| Facebook | 1200×630 | 1080×1920 | 1080×1080 | 10 MB |
+| Instagram | 1080×1080 | 1080×1920 | 1080×1080 | 8 MB |
+| TikTok | 1080×1920 | 1080×1920 | N/A | 72 MB (video) |
+
+#### C. Social Calendar
+
+| Feature | Description |
+|---------|-------------|
+| Calendar view | Monthly/weekly/daily calendar showing scheduled social posts |
+| Best-time scheduling | AI-suggested optimal posting times per platform |
+| Drag-and-drop | Reschedule posts by dragging on calendar |
+| Queue management | FIFO queue with priority override |
+| Integration | Merged view with existing Content Calendar (`/publisher/content-calendar`) |
+| Bulk scheduling | Schedule posts for multiple platforms in one action |
+| Recurring posts | Evergreen content re-posting on schedule |
+
+#### D. Analytics & Tracking
+
+| Metric | Source | Storage |
+|--------|--------|---------|
+| Impressions | Platform APIs (delayed) | `SocialPostMetrics` model |
+| Clicks | Platform APIs OR UTM + our analytics | `SocialPostMetrics` model |
+| Engagement rate | Calculated (likes+comments+shares / impressions) | Computed |
+| Best performing platform | Aggregated | Dashboard widget |
+| Best posting times | Historical analysis | `SocialAnalytics` model |
+
+### 2.4 User Flow
+
+```
+1. Content is published (or approved) in Writer/Publisher
+ │
+ ▼
+2. User navigates to /socializer/posts (or auto-triggered by automation)
+ │
+ ▼
+3. AI generates platform-specific versions (all 5 or selected)
+ │
+ ├── LinkedIn post (professional tone, image 1200×627)
+ ├── Twitter/X tweet or thread (punchy, image 1600×900)
+ ├── Facebook post (conversational, image 1200×630)
+ ├── Instagram caption + image (1080×1080) or carousel
+ └── TikTok caption (for image-to-video or article link)
+ │
+ ▼
+4. User reviews/edits each platform version
+ │
+ ▼
+5. User schedules posting time (or uses AI-suggested best time)
+ │
+ ▼
+6. Celery task publishes at scheduled time via platform APIs
+ │
+ ▼
+7. Engagement metrics fetched periodically (every 6 hours)
+```
+
+---
+
+## 3. Module B: Video Content Creator
+
+### 3.1 Overview
+
+```
+┌──────────────────────────────────────────────────────────────────────────────┐
+│ VIDEO CONTENT CREATOR MODULE │
+├──────────────────────────────────────────────────────────────────────────────┤
+│ │
+│ CONTENT (Published Article) │
+│ │ │
+│ ▼ │
+│ ┌─────────────────┐ │
+│ │ Script Engine │ AI converts article → video script │
+│ │ (GPT-4o) │ • Sections with narration text │
+│ │ │ • Visual cues per section │
+│ │ │ • Timing estimates │
+│ └────────┬──────────┘ │
+│ │ │
+│ ┌─────┴──────┐ │
+│ ▼ ▼ │
+│ ┌────────┐ ┌──────────┐ │
+│ │Short │ │Long Form │ │
+│ │Form │ │(YouTube) │ │
+│ │30-90s │ │5-15 min │ │
+│ └───┬────┘ └────┬─────┘ │
+│ │ │ │
+│ ▼ ▼ │
+│ ┌─────────────────────────┐ │
+│ │ TTS Engine │ AI voiceover from script │
+│ │ • OpenAI TTS │ • Multiple voices │
+│ │ • ElevenLabs (opt) │ • Speed/tone control │
+│ │ • Self-hosted Coqui │ • Multi-language │
+│ └────────────┬─────────────┘ │
+│ │ │
+│ ▼ │
+│ ┌─────────────────────────┐ │
+│ │ Visual Assembly │ │
+│ │ │ │
+│ │ • Stock footage search │ Pexels/Pixabay API (free) │
+│ │ • Article images │ From existing Images model │
+│ │ • AI-generated scenes │ Runware/DALL-E/Stable Diffusion │
+│ │ • Text overlays │ Key points, statistics │
+│ │ • Transitions │ Fade, slide, zoom │
+│ └────────────┬─────────────┘ │
+│ │ │
+│ ▼ │
+│ ┌─────────────────────────┐ │
+│ │ Video Composer │ FFmpeg / MoviePy │
+│ │ │ │
+│ │ • Merge audio+visuals │ │
+│ │ • Add captions/subs │ Burned-in or SRT │
+│ │ • Add music (opt) │ Royalty-free background │
+│ │ • Render final MP4 │ H.264 / H.265 │
+│ │ • Multi-resolution │ 1080p, 720p │
+│ └────────────┬─────────────┘ │
+│ │ │
+│ ┌─────────┼──────────┐ │
+│ ▼ ▼ ▼ │
+│ ┌──────┐ ┌───────┐ ┌────────┐ │
+│ │ YT │ │ Reels │ │ TikTok │ + YouTube Shorts │
+│ │Long │ │ Short │ │ Short │ │
+│ │form │ │ form │ │ form │ │
+│ └──────┘ └───────┘ └────────┘ │
+│ │
+└──────────────────────────────────────────────────────────────────────────────┘
+```
+
+### 3.2 Platform Requirements
+
+| Platform | Format | Max Duration | Resolution | Max Size | API |
+|----------|--------|-------------|------------|----------|-----|
+| **YouTube** (long) | MP4 (H.264) | 12 hours | 1920×1080 (16:9) | 256 GB | YouTube Data API v3 |
+| **YouTube Shorts** | MP4 (H.264) | 60 seconds | 1080×1920 (9:16) | 256 GB | YouTube Data API v3 |
+| **Instagram Reels** | MP4 (H.264) | 90 seconds | 1080×1920 (9:16) | 650 MB | Instagram Graph API |
+| **TikTok** | MP4 (H.264) | 10 minutes | 1080×1920 (9:16) | 72 MB | TikTok Content Posting API |
+
+### 3.3 Video Generation Pipeline
+
+#### Stage 1: Script Generation (AI)
+
+| Input | Process | Output |
+|-------|---------|--------|
+| `Content.content_body` (HTML) | GPT-4o extracts key points, writes narration script | `VideoScript` JSON |
+| `Content.meta_description` | Creates hook/intro | Opening section |
+| `Content.target_keywords` | SEO optimization for video title/description | Video SEO metadata |
+
+**VideoScript Structure:**
+```json
+{
+ "title": "10 Python Tips Every Beginner Should Know",
+ "description": "SEO-optimized video description...",
+ "tags": ["python", "programming", "tutorial"],
+ "sections": [
+ {
+ "section_id": 1,
+ "type": "hook",
+ "narration": "Did you know that 80% of Python beginners...",
+ "visual_cue": "animated_text",
+ "text_overlay": "80% of beginners make this mistake",
+ "duration_estimate": 5.0
+ },
+ {
+ "section_id": 2,
+ "type": "intro",
+ "narration": "In this video, we'll cover 10 essential tips...",
+ "visual_cue": "title_card",
+ "text_overlay": "10 Essential Python Tips",
+ "duration_estimate": 8.0
+ },
+ {
+ "section_id": 3,
+ "type": "point",
+ "narration": "Tip number one: Use list comprehensions...",
+ "visual_cue": "code_snippet",
+ "text_overlay": "Tip 1: List Comprehensions",
+ "code_block": "result = [x*2 for x in range(10)]",
+ "duration_estimate": 20.0
+ }
+ ],
+ "total_duration_estimate": 480.0,
+ "chapter_markers": [
+ {"time": "0:00", "title": "Introduction"},
+ {"time": "0:13", "title": "Tip 1: List Comprehensions"}
+ ]
+}
+```
+
+#### Stage 2: Voiceover (TTS)
+
+| Provider | Model | Quality | Latency | Cost Model | Self-Hostable |
+|----------|-------|---------|---------|------------|---------------|
+| **OpenAI TTS** | `tts-1` / `tts-1-hd` | Good / High | Fast | $15 / 1M chars (tts-1), $30 (hd) | No |
+| **ElevenLabs** | Various | Very High | Medium | $5-$330/mo plans | No |
+| **Coqui TTS** | XTTS-v2 | Good | Medium | Free (self-hosted) | **Yes** ✅ |
+| **Bark** | Bark | Medium | Slow | Free (self-hosted) | **Yes** ✅ |
+| **Piper TTS** | Piper | Good (fast) | Very Fast | Free (self-hosted) | **Yes** ✅ |
+
+#### Stage 3: Visual Asset Assembly
+
+| Asset Type | Source | How |
+|-----------|--------|-----|
+| Article images | Existing `Images` model | Pull from content |
+| AI-generated scenes | Runware / DALL-E / Bria / Stable Diffusion | Generate from visual cues |
+| Stock footage | Pexels API / Pixabay API | Free stock video clips |
+| Text overlays | Pillow / FFmpeg drawtext | Rendered per section |
+| Code snippets | Syntax-highlighted rendering | Pillow + Pygments |
+| Background music | Royalty-free library (local) | Bundled tracks |
+
+#### Stage 4: Video Composition
+
+| Component | Technology | Purpose |
+|-----------|-----------|---------|
+| **FFmpeg** | System binary | Core video encoding, merging, transcoding |
+| **MoviePy** | Python library (wraps FFmpeg) | High-level composition API |
+| **Pillow** | Python library | Image manipulation, text overlays |
+| **pydub** | Python library | Audio manipulation, mixing |
+| **Pygments** | Python library | Code syntax highlighting for tech content |
+
+**Render Presets:**
+
+| Preset | Resolution | Aspect | Duration | Use Case |
+|--------|-----------|--------|----------|----------|
+| `youtube_long` | 1920×1080 | 16:9 | 3-15 min | YouTube main video |
+| `youtube_short` | 1080×1920 | 9:16 | 30-60s | YouTube Shorts |
+| `instagram_reel` | 1080×1920 | 9:16 | 30-90s | Instagram Reels |
+| `tiktok` | 1080×1920 | 9:16 | 30-180s | TikTok |
+
+#### Stage 5: Video SEO & Publishing
+
+| Feature | Description |
+|---------|-------------|
+| Title optimization | AI-generated SEO titles per platform |
+| Description | Keyword-rich descriptions with timestamps (YouTube) |
+| Tags | AI-extracted relevant tags from content |
+| Thumbnails | AI-generated eye-catching thumbnails |
+| Captions/Subtitles | Auto-generated SRT from TTS transcript |
+| Chapter markers | YouTube chapters from script sections |
+
+### 3.4 User Flow
+
+```
+1. Content is published (or user manually selects content)
+ │
+ ▼
+2. User navigates to /video/create (or auto-triggered by automation)
+ │
+ ▼
+3. Select video type: Short-form (Reels/Shorts/TikTok) or Long-form (YouTube)
+ │
+ ▼
+4. AI generates video script → User reviews/edits script
+ │
+ ▼
+5. Select voice (from TTS provider voice list)
+ │
+ ▼
+6. Generate voiceover (TTS) → Preview/re-generate
+ │
+ ▼
+7. AI assembles visuals (images + stock + overlays)
+ │
+ ▼
+8. Render final video → Preview
+ │
+ ▼
+9. Optimize SEO metadata (title, description, tags)
+ │
+ ▼
+10. Schedule/publish to selected platform(s)
+ │
+ ▼
+11. Track views, engagement (fetched from platform APIs)
+```
+
+---
+
+## 4. Shared Infrastructure
+
+### 4.1 New Integration Providers
+
+Add to `IntegrationProvider` table:
+
+| provider_id | display_name | provider_type | Purpose |
+|-------------|-------------|---------------|---------|
+| `linkedin` | LinkedIn | social | OAuth tokens, Company Page ID |
+| `twitter` | Twitter/X | social | OAuth tokens, API keys |
+| `facebook` | Facebook/Meta | social | Page tokens, App credentials |
+| `instagram` | Instagram | social | Linked via Facebook, IG Business Account ID |
+| `tiktok` | TikTok | social | OAuth tokens, Creator credentials |
+| `youtube` | YouTube | video | OAuth tokens, Channel ID |
+| `elevenlabs` | ElevenLabs | ai | API key for TTS |
+| `pexels` | Pexels | stock | API key for stock video/images |
+| `pixabay` | Pixabay | stock | API key for stock video/images |
+| `gpu_server` | Self-Hosted GPU | ai | URL + auth for custom GPU inference |
+
+### 4.2 New AIModelConfig Entries
+
+| model_name | model_type | provider | Purpose |
+|-----------|-----------|----------|---------|
+| `tts-1` | tts | openai | Standard TTS voice |
+| `tts-1-hd` | tts | openai | High-quality TTS voice |
+| `eleven-multilingual-v2` | tts | elevenlabs | Premium TTS (optional) |
+| `coqui-xtts-v2` | tts | gpu_server | Self-hosted TTS |
+| `piper-en-us` | tts | gpu_server | Self-hosted fast TTS |
+| `stable-diffusion-xl` | image | gpu_server | Self-hosted image gen |
+| `llama-3.1-70b` | text | gpu_server | Self-hosted text gen |
+
+### 4.3 File Storage
+
+New requirement: **video and audio file storage**.
+
+| Option | For Development | For Production |
+|--------|----------------|----------------|
+| **Local filesystem** | `MEDIA_ROOT/videos/`, `MEDIA_ROOT/audio/` | Not recommended |
+| **S3-compatible** | MinIO (local Docker) | AWS S3 / DigitalOcean Spaces / Cloudflare R2 |
+| **CDN** | Not needed | CloudFront / Bunny CDN (for video delivery) |
+
+**Recommended:** Add `django-storages` with S3 backend. All video/audio files stored in S3 with CDN for delivery.
+
+```python
+# settings.py additions
+DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
+AWS_STORAGE_BUCKET_NAME = 'igny8-media'
+AWS_S3_REGION_NAME = 'us-east-1'
+MEDIA_URL = 'https://cdn.igny8.com/media/'
+```
+
+### 4.4 Extended Automation Pipeline
+
+Current 7-stage pipeline extended to 9:
+
+| Stage | Name | Module | New? |
+|-------|------|--------|------|
+| 1 | Keywords → Clusters | Planner | Existing |
+| 2 | Clusters → Ideas | Planner | Existing |
+| 3 | Ideas → Tasks | Writer | Existing |
+| 4 | Tasks → Content | Writer | Existing |
+| 5 | Content → Image Prompts | Writer | Existing |
+| 6 | Image Prompts → Images | Writer | Existing |
+| 7 | Review → Published | Publisher | Existing |
+| **8** | **Published → Social Posts** | **Socializer** | **NEW** |
+| **9** | **Published → Video** | **Video Creator** | **NEW** |
+
+New fields on `AutomationConfig`:
+
+```python
+# Stage 8 - Socializer
+stage_8_enabled = BooleanField(default=False)
+stage_8_platforms = JSONField(default=list) # ["linkedin", "twitter", "facebook"]
+stage_8_batch_size = IntegerField(default=5)
+max_social_posts_per_run = IntegerField(default=20)
+
+# Stage 9 - Video Creator
+stage_9_enabled = BooleanField(default=False)
+stage_9_video_type = CharField(default='short') # short / long / both
+stage_9_batch_size = IntegerField(default=2)
+max_videos_per_run = IntegerField(default=5)
+```
+
+---
+
+## 5. Self-Hosted GPU Option
+
+### 5.1 Architecture
+
+```
+┌─────────────────────────────────────────────────────────────────────────┐
+│ IGNY8 APP SERVER │
+│ (Django + Celery Workers) │
+└───────────────────────────┬─────────────────────────────────────────────┘
+ │
+ ┌─────────────┼─────────────────────┐
+ ▼ ▼ ▼
+ ┌────────────┐ ┌─────────────┐ ┌────────────────┐
+ │ OpenAI │ │ Anthropic │ │ GPU Server │
+ │ Cloud API │ │ Cloud API │ │ (Self-Hosted) │
+ │ │ │ │ │ │
+ │ GPT-4o │ │ Claude 3.5 │ │ vLLM API │
+ │ DALL-E 3 │ │ │ │ ├ Llama 3.1 │
+ │ TTS-1 │ │ │ │ ├ Mistral │
+ └────────────┘ └─────────────┘ │ ComfyUI API │
+ │ ├ SDXL │
+ │ ├ FLUX │
+ │ Coqui TTS │
+ │ ├ XTTS-v2 │
+ └────────────────┘
+```
+
+### 5.2 GPU Server Stack
+
+| Component | Purpose | GPU VRAM Needed | Docker Image |
+|-----------|---------|----------------|--------------|
+| **vLLM** | Text generation (Llama, Mistral) | 40 GB (70B) / 16 GB (7B) | `vllm/vllm-openai` |
+| **ComfyUI** | Image generation (SDXL, FLUX) | 12-24 GB | `comfyanonymous/comfyui` |
+| **Coqui TTS** | Voice synthesis (XTTS-v2) | 4-6 GB | `ghcr.io/coqui-ai/tts` |
+| **Piper TTS** | Fast TTS (lower quality) | 1 GB (CPU ok) | `rhasspy/piper` |
+| **Whisper** | Speech-to-text (for captioning) | 4-10 GB | `openai/whisper` |
+
+**Minimum GPU requirement:** 1× NVIDIA A100 80GB or 2× NVIDIA RTX 4090 (24GB each)
+**Budget option:** 1× NVIDIA RTX 4090 running 7B text + SDXL + Coqui TTS
+
+### 5.3 GPU Server Integration with ModelRegistry
+
+```python
+# New provider type in IntegrationProvider
+IntegrationProvider.objects.create(
+ provider_id='gpu_server',
+ display_name='Self-Hosted GPU Server',
+ provider_type='ai',
+ api_endpoint='https://gpu.igny8.internal:8000',
+ api_key='internal-auth-token',
+ config={
+ 'vllm_base_url': 'http://gpu:8000/v1', # OpenAI-compatible
+ 'comfyui_base_url': 'http://gpu:8188', # ComfyUI API
+ 'tts_base_url': 'http://gpu:5002', # Coqui TTS API
+ 'piper_base_url': 'http://gpu:10200', # Piper TTS API
+ }
+)
+
+# ModelRegistry already supports this — just add AIModelConfig entries
+# vLLM serves an OpenAI-compatible API, so existing OpenAI client code reuses
+```
+
+### 5.4 Fallback Strategy
+
+```
+Request → Check gpu_server availability
+ │
+ ┌─────────┴──────────┐
+ │ GPU Online │ GPU Offline/Overloaded
+ ▼ ▼
+Use self-hosted Fallback to cloud
+(zero API cost) (OpenAI/Anthropic)
+```
+
+Implementation: `ModelRegistry.get_model()` checks `IntegrationProvider.is_active` and a health-check endpoint before routing.
+
+---
+
+## 6. Database Schema
+
+### 6.1 Socializer Models
+
+**File:** `backend/igny8_core/business/socializer/models.py`
+
+```python
+class SocialAccount(AccountBaseModel):
+ """Connected social media accounts"""
+ platform = CharField(max_length=20, choices=SOCIAL_PLATFORMS)
+ # linkedin, twitter, facebook, instagram, tiktok
+ platform_user_id = CharField(max_length=255)
+ platform_username = CharField(max_length=255)
+ platform_page_name = CharField(max_length=255, blank=True)
+ access_token = TextField() # Encrypted
+ refresh_token = TextField(blank=True) # Encrypted
+ token_expires_at = DateTimeField(null=True)
+ scopes = JSONField(default=list)
+ is_active = BooleanField(default=True)
+ connected_at = DateTimeField(auto_now_add=True)
+ last_used_at = DateTimeField(null=True)
+ metadata = JSONField(default=dict) # Platform-specific data
+
+
+class SocialPost(SiteSectorBaseModel):
+ """A social media post for a specific platform"""
+ content = ForeignKey('writer.Content', on_delete=CASCADE, related_name='social_posts')
+ social_account = ForeignKey(SocialAccount, on_delete=CASCADE)
+ platform = CharField(max_length=20, choices=SOCIAL_PLATFORMS)
+
+ # Content
+ post_text = TextField()
+ hashtags = JSONField(default=list)
+ link_url = URLField(blank=True)
+ call_to_action = CharField(max_length=255, blank=True)
+ post_type = CharField(max_length=20)
+ # text, image, carousel, video, thread, story
+
+ # Media
+ media_urls = JSONField(default=list) # URLs of attached images/videos
+ thumbnail_url = URLField(blank=True)
+
+ # Scheduling
+ status = CharField(max_length=20, choices=SOCIAL_POST_STATUS)
+ # draft, scheduled, publishing, published, failed, cancelled
+ scheduled_at = DateTimeField(null=True)
+ published_at = DateTimeField(null=True)
+ platform_post_id = CharField(max_length=255, blank=True)
+ platform_post_url = URLField(blank=True)
+ error_message = TextField(blank=True)
+
+ # AI Generation
+ ai_model_used = CharField(max_length=100, blank=True)
+ credits_used = DecimalField(max_digits=10, decimal_places=2, default=0)
+
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+
+
+class SocialPostMetrics(models.Model):
+ """Engagement metrics for a published social post"""
+ social_post = OneToOneField(SocialPost, on_delete=CASCADE, related_name='metrics')
+ impressions = IntegerField(default=0)
+ reach = IntegerField(default=0)
+ likes = IntegerField(default=0)
+ comments = IntegerField(default=0)
+ shares = IntegerField(default=0)
+ clicks = IntegerField(default=0)
+ saves = IntegerField(default=0)
+ engagement_rate = DecimalField(max_digits=5, decimal_places=2, default=0)
+ last_fetched_at = DateTimeField(null=True)
+ raw_data = JSONField(default=dict) # Full API response
+
+
+class SocialCalendarSlot(AccountBaseModel):
+ """Preferred posting times per platform per site"""
+ site = ForeignKey('auth.Site', on_delete=CASCADE)
+ platform = CharField(max_length=20, choices=SOCIAL_PLATFORMS)
+ day_of_week = IntegerField() # 0=Monday, 6=Sunday
+ time_slot = TimeField()
+ is_active = BooleanField(default=True)
+```
+
+### 6.2 Video Creator Models
+
+**File:** `backend/igny8_core/business/video/models.py`
+
+```python
+class VideoProject(SiteSectorBaseModel):
+ """A video project derived from content"""
+ content = ForeignKey('writer.Content', on_delete=CASCADE, related_name='video_projects')
+ title = CharField(max_length=500)
+ description = TextField(blank=True)
+
+ # Configuration
+ video_type = CharField(max_length=20, choices=VIDEO_TYPES)
+ # youtube_long, youtube_short, instagram_reel, tiktok
+ target_duration = IntegerField(help_text="Target duration in seconds")
+ voice_id = CharField(max_length=100, blank=True)
+ tts_provider = CharField(max_length=50, default='openai')
+ background_music = CharField(max_length=255, blank=True)
+
+ # Script
+ script = JSONField(default=dict) # VideoScript structure
+ script_status = CharField(max_length=20, default='pending')
+ # pending, generating, ready, approved
+
+ # Status
+ status = CharField(max_length=20, choices=VIDEO_STATUS)
+ # draft, script_ready, generating_audio, generating_visuals,
+ # composing, rendering, ready, published, failed
+ progress_pct = IntegerField(default=0)
+ error_message = TextField(blank=True)
+
+ # Output
+ video_url = URLField(blank=True) # S3/CDN URL of final video
+ thumbnail_url = URLField(blank=True)
+ subtitle_url = URLField(blank=True) # SRT file URL
+ duration_seconds = IntegerField(null=True)
+ file_size_bytes = BigIntegerField(null=True)
+ resolution = CharField(max_length=20, blank=True) # 1920x1080
+
+ # AI/Credits
+ ai_model_used = CharField(max_length=100, blank=True)
+ tts_model_used = CharField(max_length=100, blank=True)
+ credits_used = DecimalField(max_digits=10, decimal_places=2, default=0)
+
+ created_at = DateTimeField(auto_now_add=True)
+ updated_at = DateTimeField(auto_now=True)
+
+
+class VideoAsset(models.Model):
+ """Individual assets used in a video project"""
+ project = ForeignKey(VideoProject, on_delete=CASCADE, related_name='assets')
+ asset_type = CharField(max_length=20)
+ # voiceover, image, stock_video, text_overlay, music, subtitle
+ section_id = IntegerField(null=True) # Maps to script section
+ file_url = URLField()
+ duration_seconds = DecimalField(max_digits=8, decimal_places=2, null=True)
+ position = IntegerField(default=0) # Order in sequence
+ metadata = JSONField(default=dict)
+ created_at = DateTimeField(auto_now_add=True)
+
+
+class VideoPublishRecord(AccountBaseModel):
+ """Publishing record for a video to a platform"""
+ project = ForeignKey(VideoProject, on_delete=CASCADE, related_name='publish_records')
+ site = ForeignKey('auth.Site', on_delete=CASCADE)
+ platform = CharField(max_length=20)
+ # youtube, instagram, tiktok
+ platform_video_id = CharField(max_length=255, blank=True)
+ platform_url = URLField(blank=True)
+ status = CharField(max_length=20)
+ # pending, uploading, processing, published, failed
+ seo_title = CharField(max_length=500, blank=True)
+ seo_description = TextField(blank=True)
+ seo_tags = JSONField(default=list)
+ chapter_markers = JSONField(default=list)
+ published_at = DateTimeField(null=True)
+ error_message = TextField(blank=True)
+ metadata = JSONField(default=dict)
+
+
+class VideoMetrics(models.Model):
+ """Video performance metrics from platform APIs"""
+ publish_record = OneToOneField(VideoPublishRecord, on_delete=CASCADE, related_name='metrics')
+ views = IntegerField(default=0)
+ likes = IntegerField(default=0)
+ comments = IntegerField(default=0)
+ shares = IntegerField(default=0)
+ watch_time_seconds = IntegerField(default=0)
+ average_view_duration = DecimalField(max_digits=8, decimal_places=2, default=0)
+ click_through_rate = DecimalField(max_digits=5, decimal_places=2, default=0)
+ last_fetched_at = DateTimeField(null=True)
+ raw_data = JSONField(default=dict)
+```
+
+### 6.3 Model Count Impact
+
+| Current (v1.8.4) | New Models | New Total |
+|-------------------|-----------|-----------|
+| 52+ models | +8 (Socializer: 4, Video: 4) | 60+ models |
+
+---
+
+## 7. AI Functions
+
+### 7.1 New AI Functions
+
+**Location:** `backend/igny8_core/ai/functions/`
+
+| Function | File | Input | Output | Provider |
+|----------|------|-------|--------|----------|
+| `AdaptContentForSocial` | `social.py` | Content + platform | Platform-specific post text | GPT-4o-mini / Claude |
+| `GenerateHashtags` | `social.py` | Content + platform | Hashtag list | GPT-4o-mini |
+| `GenerateTwitterThread` | `social.py` | Content | Thread of tweets | GPT-4o |
+| `GenerateCarouselSlides` | `social.py` | Content | Slide texts + prompts | GPT-4o |
+| `GenerateVideoScript` | `video.py` | Content + video_type | VideoScript JSON | GPT-4o |
+| `GenerateVideoSEO` | `video.py` | VideoScript + platform | Title, desc, tags | GPT-4o-mini |
+| `GenerateVideoThumbnailPrompt` | `video.py` | VideoScript | Image prompt for thumbnail | GPT-4o-mini |
+
+### 7.2 New Non-AI Processing Functions
+
+| Function | File | Input | Output | Technology |
+|----------|------|-------|--------|------------|
+| `TextToSpeech` | `tts.py` | Script narration text | Audio MP3/WAV | OpenAI TTS / ElevenLabs / Coqui |
+| `ResizeImageForPlatform` | `image_processing.py` | Image + platform specs | Resized image | Pillow |
+| `RenderTextOverlay` | `image_processing.py` | Image + text | Image with text | Pillow |
+| `ComposeVideo` | `video_composer.py` | Assets (audio, images, overlays) | MP4 video | FFmpeg / MoviePy |
+| `GenerateSubtitles` | `subtitle.py` | TTS audio + script | SRT file | Whisper / text-alignment |
+| `FetchStockVideo` | `stock.py` | Search query | Video clip URL | Pexels / Pixabay API |
+
+### 7.3 Registration in AIEngine
+
+```python
+# ai/engine.py — extend AIEngine
+class AIEngine:
+ # Existing
+ def auto_cluster(self, keywords): ...
+ def generate_ideas(self, cluster): ...
+ def generate_content(self, task): ...
+ def generate_images(self, content): ...
+
+ # NEW — Socializer
+ def adapt_for_social(self, content, platform, social_account): ...
+ def generate_hashtags(self, content, platform): ...
+ def generate_thread(self, content): ...
+ def generate_carousel(self, content): ...
+
+ # NEW — Video Creator
+ def generate_video_script(self, content, video_type): ...
+ def generate_voiceover(self, script, voice_id, provider): ...
+ def compose_video(self, project): ...
+ def generate_video_seo(self, project, platform): ...
+```
+
+---
+
+## 8. API Endpoints
+
+### 8.1 Socializer Endpoints
+
+**Base:** `/api/v1/socializer/`
+
+| Method | Path | Handler | Purpose |
+|--------|------|---------|---------|
+| **Accounts** | | | |
+| GET | `/accounts/` | `SocialAccountViewSet.list` | List connected social accounts |
+| POST | `/accounts/connect/` | `SocialAccountViewSet.connect` | Start OAuth flow for platform |
+| POST | `/accounts/{id}/disconnect/` | `SocialAccountViewSet.disconnect` | Disconnect account |
+| POST | `/accounts/{id}/refresh/` | `SocialAccountViewSet.refresh_token` | Refresh OAuth token |
+| **Posts** | | | |
+| GET | `/posts/` | `SocialPostViewSet.list` | List social posts (filterable) |
+| POST | `/posts/generate/` | `SocialPostViewSet.generate` | AI-generate posts for content |
+| PUT | `/posts/{id}/` | `SocialPostViewSet.update` | Edit post text/media |
+| POST | `/posts/{id}/schedule/` | `SocialPostViewSet.schedule` | Schedule for publishing |
+| POST | `/posts/{id}/publish-now/` | `SocialPostViewSet.publish_now` | Publish immediately |
+| POST | `/posts/{id}/cancel/` | `SocialPostViewSet.cancel` | Cancel scheduled post |
+| POST | `/posts/bulk-generate/` | `SocialPostViewSet.bulk_generate` | Generate for multiple contents |
+| POST | `/posts/bulk-schedule/` | `SocialPostViewSet.bulk_schedule` | Schedule multiple posts |
+| **Calendar** | | | |
+| GET | `/calendar/` | `SocialCalendarViewSet.list` | Get calendar events (date range) |
+| GET | `/calendar/slots/` | `SocialCalendarViewSet.slots` | Get configured time slots |
+| PUT | `/calendar/slots/` | `SocialCalendarViewSet.update_slots` | Update time slots |
+| **Analytics** | | | |
+| GET | `/analytics/overview/` | `SocialAnalyticsViewSet.overview` | Aggregated metrics |
+| GET | `/analytics/platform/{platform}/` | `SocialAnalyticsViewSet.by_platform` | Per-platform metrics |
+| GET | `/analytics/post/{id}/` | `SocialAnalyticsViewSet.by_post` | Single post metrics |
+
+### 8.2 Video Creator Endpoints
+
+**Base:** `/api/v1/video/`
+
+| Method | Path | Handler | Purpose |
+|--------|------|---------|---------|
+| **Projects** | | | |
+| GET | `/projects/` | `VideoProjectViewSet.list` | List video projects |
+| POST | `/projects/` | `VideoProjectViewSet.create` | Create project from content |
+| GET | `/projects/{id}/` | `VideoProjectViewSet.retrieve` | Get project detail |
+| DELETE | `/projects/{id}/` | `VideoProjectViewSet.destroy` | Delete project + assets |
+| **Script** | | | |
+| POST | `/projects/{id}/generate-script/` | `VideoProjectViewSet.generate_script` | AI-generate video script |
+| PUT | `/projects/{id}/script/` | `VideoProjectViewSet.update_script` | Edit script manually |
+| POST | `/projects/{id}/approve-script/` | `VideoProjectViewSet.approve_script` | Approve script for production |
+| **Production** | | | |
+| POST | `/projects/{id}/generate-voiceover/` | `VideoProjectViewSet.generate_voiceover` | Generate TTS audio |
+| POST | `/projects/{id}/generate-visuals/` | `VideoProjectViewSet.generate_visuals` | Generate/collect visual assets |
+| POST | `/projects/{id}/compose/` | `VideoProjectViewSet.compose` | Render final video |
+| POST | `/projects/{id}/regenerate-section/{section_id}/` | `VideoProjectViewSet.regenerate_section` | Re-do a specific section |
+| **Publishing** | | | |
+| POST | `/projects/{id}/publish/` | `VideoProjectViewSet.publish` | Publish to platform(s) |
+| GET | `/projects/{id}/publish-status/` | `VideoProjectViewSet.publish_status` | Check publishing status |
+| **Assets & Voices** | | | |
+| GET | `/voices/` | `VoiceViewSet.list` | List available TTS voices |
+| GET | `/projects/{id}/assets/` | `VideoAssetViewSet.list` | List project assets |
+| **Analytics** | | | |
+| GET | `/analytics/overview/` | `VideoAnalyticsViewSet.overview` | Aggregated video metrics |
+| GET | `/analytics/project/{id}/` | `VideoAnalyticsViewSet.by_project` | Single video metrics |
+
+---
+
+## 9. Frontend Pages
+
+### 9.1 New Routes
+
+```
+├── SOCIALIZER
+│ /socializer/dashboard → Social Dashboard (overview, metrics)
+│ /socializer/accounts → Connected Accounts (manage OAuth)
+│ /socializer/posts → Social Posts (list, filter, bulk actions)
+│ /socializer/posts/:id → Post Detail (edit, preview per platform)
+│ /socializer/calendar → Social Calendar (scheduling view)
+│ /socializer/analytics → Social Analytics (engagement dashboard)
+│
+├── VIDEO CREATOR
+│ /video/dashboard → Video Dashboard (overview, metrics)
+│ /video/projects → Video Projects (list)
+│ /video/create → New Video (select content, configure)
+│ /video/projects/:id → Video Project Detail (script, preview, publish)
+│ /video/projects/:id/editor → Video Editor (timeline, preview)
+│ /video/analytics → Video Analytics
+```
+
+### 9.2 New Zustand Stores
+
+| Store | File | Purpose |
+|-------|------|---------|
+| `socialStore` | `store/socialStore.ts` | Social accounts, posts, calendar state |
+| `videoStore` | `store/videoStore.ts` | Video projects, rendering state, voices |
+
+### 9.3 New Components
+
+| Component | Purpose |
+|-----------|---------|
+| `SocialPostPreview` | Platform-mockup preview (shows how post will look) |
+| `SocialCalendar` | Calendar widget for scheduling |
+| `PlatformSelector` | Multi-select for target platforms |
+| `VideoTimeline` | Timeline editor showing sections, audio, visuals |
+| `VideoPlayer` | In-app video preview player |
+| `ScriptEditor` | Editable script with section management |
+| `VoiceSelector` | TTS voice selector with audio samples |
+
+### 9.4 Sidebar Navigation Updates
+
+```
+Current: New:
+───────── ─────────
+Dashboard Dashboard
+Planner Planner
+ Keywords Keywords
+ Clusters Clusters
+ Ideas Ideas
+Writer Writer
+ Tasks Tasks
+ Content Content
+ Images Images
+ Review Review
+Automation Automation
+Publisher Publisher
+ Socializer ← NEW
+ Dashboard
+ Posts
+ Calendar
+ Analytics
+ Video Creator ← NEW
+ Dashboard
+ Projects
+ Analytics
+```
+
+---
+
+## 10. Celery Tasks
+
+### 10.1 Socializer Tasks
+
+| Task | Schedule | Purpose |
+|------|----------|---------|
+| `socializer.publish_scheduled_posts` | Every 5 min | Publish posts where `scheduled_at <= now` |
+| `socializer.refresh_expired_tokens` | Every 6 hours | Refresh OAuth tokens nearing expiration |
+| `socializer.fetch_post_metrics` | Every 6 hours | Fetch engagement metrics for published posts |
+| `socializer.cleanup_failed_posts` | Daily at 3 AM | Retry or mark stale failed posts |
+
+### 10.2 Video Creator Tasks
+
+| Task | Schedule | Purpose |
+|------|----------|---------|
+| `video.process_video_project` | On-demand (triggered) | Full pipeline: script → TTS → visuals → compose |
+| `video.generate_voiceover` | On-demand | Generate TTS audio for a project |
+| `video.compose_video` | On-demand | Render final video (CPU/GPU intensive) |
+| `video.publish_video` | On-demand | Upload video to platform |
+| `video.fetch_video_metrics` | Every 12 hours | Fetch view/engagement metrics |
+| `video.cleanup_temp_assets` | Daily at 4 AM | Remove temporary render files |
+
+### 10.3 Celery Worker Configuration
+
+Video rendering is CPU/GPU intensive — use a separate queue:
+
+```python
+# celery.py additions
+CELERY_TASK_ROUTES = {
+ 'igny8_core.business.video.tasks.compose_video': {'queue': 'video_render'},
+ 'igny8_core.business.video.tasks.generate_voiceover': {'queue': 'video_render'},
+ 'igny8_core.business.socializer.tasks.*': {'queue': 'social'},
+ # Existing tasks stay on 'default' queue
+}
+
+# docker-compose additions
+# worker-video:
+# command: celery -A igny8_core worker -Q video_render --concurrency=2
+# worker-social:
+# command: celery -A igny8_core worker -Q social --concurrency=4
+```
+
+---
+
+## 11. Credit Cost Matrix
+
+### 11.1 Socializer Operations
+
+| Operation | AI Model | Est. Tokens | Credits | Notes |
+|-----------|----------|------------|---------|-------|
+| Adapt content for 1 platform | GPT-4o-mini | ~500 | 1 | Per platform |
+| Generate hashtags | GPT-4o-mini | ~200 | 0.5 | Per platform |
+| Generate Twitter thread | GPT-4o-mini | ~1000 | 2 | Full thread |
+| Generate carousel slides | GPT-4o | ~2000 | 5 | Per carousel |
+| Generate social image | Runware/DALL-E | N/A | 3-10 | Per image |
+| **Full social suite (5 platforms)** | Mixed | ~5000 | **~15-25** | Per content item |
+
+### 11.2 Video Creator Operations
+
+| Operation | Model/Tool | Est. Usage | Credits | Notes |
+|-----------|-----------|------------|---------|-------|
+| Generate video script | GPT-4o | ~3000 tokens | 5 | Per script |
+| Generate TTS voiceover | OpenAI TTS-1 | ~5000 chars | 10 | Per minute audio |
+| Generate TTS voiceover (HD) | OpenAI TTS-1-HD | ~5000 chars | 20 | Per minute audio |
+| Generate TTS (self-hosted) | Coqui XTTS | ~5000 chars | 2 | Reduced (own GPU) |
+| Generate visual assets | Runware/DALL-E | ~5 images | 15-50 | Per video |
+| Generate thumbnail | DALL-E/Runware | 1 image | 3-10 | Per video |
+| Video composition | FFmpeg | CPU time | 5 | Per render |
+| Video SEO metadata | GPT-4o-mini | ~500 tokens | 1 | Per platform |
+| **Full short-form video** | Mixed | - | **~40-80** | 30-60s video |
+| **Full long-form video** | Mixed | - | **~100-250** | 5-15 min video |
+
+### 11.3 Self-Hosted GPU Savings
+
+| Operation | Cloud Cost (credits) | Self-Hosted (credits) | Saving |
+|-----------|---------------------|----------------------|--------|
+| TTS voiceover (1 min) | 10-20 | 2 | 80-90% |
+| Image generation (per image) | 5-10 | 1 | 80-90% |
+| Text generation (per 1K tokens) | 1-3 | 0.5 | 50-83% |
+
+> Credits for self-hosted operations are lower because there's no API cost—only a flat infrastructure fee per account or globally amortized.
+
+---
+
+## 12. Development Phases
+
+### Phase 1: Foundation (Weeks 1-3)
+
+| # | Task | Type | Effort | Dependencies |
+|---|------|------|--------|-------------|
+| 1.1 | Add `django-storages` + S3 config for media | Backend infra | 2 days | S3 bucket provisioned |
+| 1.2 | Create `SocialAccount`, `SocialPost`, `SocialPostMetrics`, `SocialCalendarSlot` models + migrations | Backend models | 2 days | None |
+| 1.3 | Create `VideoProject`, `VideoAsset`, `VideoPublishRecord`, `VideoMetrics` models + migrations | Backend models | 2 days | 1.1 |
+| 1.4 | Add new `IntegrationProvider` entries (social, video, GPU) | Backend seed data | 0.5 days | None |
+| 1.5 | Add new `AIModelConfig` entries (TTS models, GPU models) | Backend seed data | 0.5 days | None |
+| 1.6 | Extend `AutomationConfig` with stage 8 & 9 fields + migration | Backend models | 1 day | None |
+| 1.7 | Add FFmpeg + MoviePy + pydub to `requirements.txt` and Dockerfile | Backend infra | 1 day | None |
+| 1.8 | Create backend module scaffolding (`modules/socializer/`, `modules/video/`, `business/socializer/`, `business/video/`) | Backend structure | 1 day | None |
+| 1.9 | Admin registration for all new models | Backend admin | 1 day | 1.2, 1.3 |
+
+### Phase 2: Socializer — Core (Weeks 3-6)
+
+| # | Task | Type | Effort | Dependencies |
+|---|------|------|--------|-------------|
+| 2.1 | OAuth2 flow for LinkedIn, Twitter/X, Facebook/Instagram, TikTok | Backend auth | 5 days | Platform developer accounts |
+| 2.2 | `AdaptContentForSocial` AI function + prompt templates | Backend AI | 2 days | None |
+| 2.3 | `GenerateHashtags` AI function | Backend AI | 1 day | None |
+| 2.4 | `GenerateTwitterThread` AI function | Backend AI | 1 day | None |
+| 2.5 | Image resizing utility (Pillow) for all platform specs | Backend utility | 2 days | None |
+| 2.6 | SocialPost CRUD ViewSet + serializers | Backend API | 2 days | 1.2 |
+| 2.7 | Social post publishing service (per-platform SDK wrappers) | Backend service | 5 days | 2.1 |
+| 2.8 | `publish_scheduled_posts` Celery task | Backend task | 1 day | 2.7 |
+| 2.9 | `fetch_post_metrics` Celery task | Backend task | 2 days | 2.7 |
+| 2.10 | Social Calendar API endpoints | Backend API | 2 days | 1.2 |
+| 2.11 | Frontend: Social accounts page (OAuth connect/disconnect) | Frontend | 3 days | 2.1 |
+| 2.12 | Frontend: Social posts page (list, generate, edit) | Frontend | 4 days | 2.6 |
+| 2.13 | Frontend: Platform post preview components | Frontend | 3 days | 2.12 |
+| 2.14 | Frontend: Social calendar page | Frontend | 4 days | 2.10 |
+| 2.15 | Frontend: Social analytics dashboard | Frontend | 3 days | 2.9 |
+| 2.16 | Frontend: Zustand social store | Frontend | 1 day | 2.11 |
+| 2.17 | Notifications integration (publish success/failure) | Backend | 1 day | 2.7 |
+| 2.18 | Automation stage 8 integration | Backend | 2 days | 2.7, 1.6 |
+
+### Phase 3: Video Creator — Core (Weeks 6-10)
+
+| # | Task | Type | Effort | Dependencies |
+|---|------|------|--------|-------------|
+| 3.1 | `GenerateVideoScript` AI function + prompt templates | Backend AI | 3 days | None |
+| 3.2 | TTS integration service (OpenAI TTS API) | Backend service | 2 days | None |
+| 3.3 | TTS integration service (ElevenLabs — optional) | Backend service | 2 days | ElevenLabs API key |
+| 3.4 | Stock video/image fetcher (Pexels + Pixabay) | Backend service | 2 days | API keys |
+| 3.5 | Visual asset assembler (collect images, stock, generate missing) | Backend service | 3 days | 3.4, existing ImageGen |
+| 3.6 | Video composer service (FFmpeg + MoviePy pipeline) | Backend service | 5 days | 1.7 |
+| 3.7 | Subtitle generator (SRT from script timestamps) | Backend utility | 1 day | None |
+| 3.8 | Text overlay renderer (Pillow + Pygments for code) | Backend utility | 2 days | None |
+| 3.9 | `GenerateVideoSEO` AI function | Backend AI | 1 day | None |
+| 3.10 | Thumbnail generator (AI image + text overlay) | Backend service | 2 days | Existing ImageGen |
+| 3.11 | VideoProject CRUD ViewSet + serializers | Backend API | 2 days | 1.3 |
+| 3.12 | Video rendering Celery tasks (separate queue) | Backend task | 2 days | 3.6 |
+| 3.13 | YouTube upload service (YouTube Data API v3) | Backend service | 3 days | YouTube API credentials |
+| 3.14 | Instagram Reels upload service | Backend service | 2 days | 2.1 (Facebook OAuth) |
+| 3.15 | TikTok video upload service | Backend service | 2 days | TikTok API credentials |
+| 3.16 | Frontend: Video projects page (list, create) | Frontend | 3 days | 3.11 |
+| 3.17 | Frontend: Script editor page | Frontend | 3 days | 3.1 |
+| 3.18 | Frontend: Video timeline/preview page | Frontend | 5 days | 3.6 |
+| 3.19 | Frontend: Voice selector component | Frontend | 2 days | 3.2 |
+| 3.20 | Frontend: Video analytics page | Frontend | 2 days | 3.13 |
+| 3.21 | Frontend: Zustand video store | Frontend | 1 day | 3.16 |
+| 3.22 | Notifications integration | Backend | 1 day | 3.12 |
+| 3.23 | Automation stage 9 integration | Backend | 2 days | 3.12, 1.6 |
+
+### Phase 4: Self-Hosted GPU (Weeks 10-12) — OPTIONAL
+
+| # | Task | Type | Effort | Dependencies |
+|---|------|------|--------|-------------|
+| 4.1 | GPU server Docker Compose (vLLM + ComfyUI + Coqui TTS) | DevOps | 3 days | GPU hardware |
+| 4.2 | vLLM adapter in ModelRegistry (OpenAI-compatible client) | Backend | 2 days | 4.1 |
+| 4.3 | ComfyUI adapter in image generation service | Backend | 2 days | 4.1 |
+| 4.4 | Coqui TTS adapter in TTS service | Backend | 1 day | 4.1 |
+| 4.5 | Health check + fallback logic in ModelRegistry | Backend | 2 days | 4.2, 4.3, 4.4 |
+| 4.6 | GPU provider admin UI (settings, monitoring) | Frontend | 2 days | 4.5 |
+| 4.7 | Load testing and optimization | QA | 3 days | All above |
+
+### Phase 5: Polish & Integration (Weeks 12-14)
+
+| # | Task | Type | Effort | Dependencies |
+|---|------|------|--------|-------------|
+| 5.1 | Module enable/disable (ModuleEnableSettings: `socializer_enabled`, `video_creator_enabled`) | Both | 1 day | All above |
+| 5.2 | Dashboard widgets (Social Overview, Video Pipeline) | Frontend | 2 days | Phases 2-3 |
+| 5.3 | Unified settings: social + video config in Site Settings | Both | 2 days | Phases 2-3 |
+| 5.4 | End-to-end testing (full pipeline: content → social + video → published) | QA | 3 days | All above |
+| 5.5 | Credit system testing (all new operations correctly deducted) | QA | 2 days | Phases 2-3 |
+| 5.6 | Documentation (update all docs: ARCHITECTURE, MODULES, ENDPOINTS, MODELS) | Docs | 2 days | All above |
+| 5.7 | Rate limiting and error handling for all platform APIs | Backend | 2 days | Phases 2-3 |
+| 5.8 | Data migration for existing users (create default social calendar slots) | Backend | 1 day | Phase 2 |
+
+### Timeline Summary
+
+| Phase | Duration | Focus |
+|-------|----------|-------|
+| Phase 1 | Weeks 1-3 | Foundation: models, migrations, infra |
+| Phase 2 | Weeks 3-6 | Socializer: OAuth, AI, scheduling, frontend |
+| Phase 3 | Weeks 6-10 | Video Creator: script, TTS, compositor, frontend |
+| Phase 4 | Weeks 10-12 | Self-hosted GPU (optional) |
+| Phase 5 | Weeks 12-14 | Polish, integration, testing, docs |
+| **Total** | **14 weeks** | **~70 working days** |
+
+---
+
+## 13. Risk & Dependency Matrix
+
+### External Dependencies
+
+| Dependency | Risk Level | Mitigation |
+|-----------|------------|------------|
+| **Platform API access** (LinkedIn, Twitter, Meta, TikTok) | 🔴 High | Apply for developer access ASAP (can take 2-4 weeks for approval). Twitter/X API pricing changes are unpredictable. |
+| **YouTube Data API** | 🟡 Medium | Well-documented, generous quota (10K units/day). Need Google Cloud project + OAuth consent screen review. |
+| **ElevenLabs API** | 🟢 Low | Optional — OpenAI TTS is primary. ElevenLabs is premium add-on. |
+| **FFmpeg on server** | 🟢 Low | Well-supported, already common in Docker images. Add to Dockerfile. |
+| **S3-compatible storage** | 🟢 Low | Many providers (AWS, DO Spaces, Cloudflare R2). Straightforward setup. |
+| **GPU hardware** (self-hosted) | 🟡 Medium | Optional phase. Cloud GPU rental (RunPod, Lambda) as interim. |
+
+### Technical Risks
+
+| Risk | Impact | Probability | Mitigation |
+|------|--------|------------|------------|
+| Video rendering is slow (minutes per video) | User experience | High | Separate Celery queue, progress tracking, async preview |
+| Platform API rate limits | Publishing delays | Medium | Queue system with backoff, respect rate limits, spread over time |
+| OAuth token expiration | Silent failures | Medium | Proactive token refresh task, user notification on failure |
+| Video file sizes (100MB+) | Storage costs, slow uploads | High | Compression optimization, CDN delivery, tiered render quality |
+| TTS quality inconsistency | User satisfaction | Medium | Voice preview before generation, multiple provider options |
+| Platform API breaking changes | Feature outages | Medium | Abstract platform SDKs behind interface, monitor changelogs |
+
+### File & Directory Structure (New)
+
+```
+backend/igny8_core/
+├── modules/
+│ ├── socializer/ ← NEW
+│ │ ├── __init__.py
+│ │ ├── views.py # SocialPostViewSet, SocialAccountViewSet, etc.
+│ │ ├── serializers.py
+│ │ ├── urls.py
+│ │ └── admin.py
+│ ├── video/ ← NEW
+│ │ ├── __init__.py
+│ │ ├── views.py # VideoProjectViewSet, etc.
+│ │ ├── serializers.py
+│ │ ├── urls.py
+│ │ └── admin.py
+│
+├── business/
+│ ├── socializer/ ← NEW
+│ │ ├── __init__.py
+│ │ ├── models.py # SocialAccount, SocialPost, SocialPostMetrics, SocialCalendarSlot
+│ │ ├── services/
+│ │ │ ├── adaptation_service.py # AI content adaptation
+│ │ │ ├── publishing_service.py # Platform-specific publishers
+│ │ │ ├── oauth_service.py # OAuth2 flows for each platform
+│ │ │ ├── metrics_service.py # Fetch engagement metrics
+│ │ │ └── calendar_service.py # Scheduling logic
+│ │ ├── tasks.py # Celery tasks
+│ │ └── platform_adapters/
+│ │ ├── base.py # Abstract platform adapter
+│ │ ├── linkedin.py
+│ │ ├── twitter.py
+│ │ ├── facebook.py
+│ │ ├── instagram.py
+│ │ └── tiktok.py
+│ ├── video/ ← NEW
+│ │ ├── __init__.py
+│ │ ├── models.py # VideoProject, VideoAsset, VideoPublishRecord, VideoMetrics
+│ │ ├── services/
+│ │ │ ├── script_service.py # AI script generation
+│ │ │ ├── tts_service.py # TTS provider abstraction
+│ │ │ ├── asset_service.py # Visual asset collection
+│ │ │ ├── composer_service.py # FFmpeg/MoviePy video composition
+│ │ │ ├── subtitle_service.py # SRT generation
+│ │ │ ├── publishing_service.py # YouTube/IG/TikTok upload
+│ │ │ └── metrics_service.py # Fetch video metrics
+│ │ ├── tasks.py # Celery tasks
+│ │ └── platform_adapters/
+│ │ ├── base.py
+│ │ ├── youtube.py
+│ │ ├── instagram.py
+│ │ └── tiktok.py
+│
+├── ai/functions/
+│ ├── social.py ← NEW (AdaptContentForSocial, GenerateHashtags, etc.)
+│ ├── video.py ← NEW (GenerateVideoScript, GenerateVideoSEO, etc.)
+│ └── tts.py ← NEW (TextToSpeech provider abstraction)
+
+frontend/src/
+├── pages/
+│ ├── Socializer/ ← NEW
+│ │ ├── SocialDashboard.tsx
+│ │ ├── SocialAccounts.tsx
+│ │ ├── SocialPosts.tsx
+│ │ ├── SocialPostDetail.tsx
+│ │ ├── SocialCalendar.tsx
+│ │ └── SocialAnalytics.tsx
+│ ├── Video/ ← NEW
+│ │ ├── VideoDashboard.tsx
+│ │ ├── VideoProjects.tsx
+│ │ ├── VideoCreate.tsx
+│ │ ├── VideoProjectDetail.tsx
+│ │ ├── VideoEditor.tsx
+│ │ └── VideoAnalytics.tsx
+├── store/
+│ ├── socialStore.ts ← NEW
+│ └── videoStore.ts ← NEW
+├── api/
+│ ├── socializer.api.ts ← NEW
+│ └── video.api.ts ← NEW
+├── components/
+│ ├── socializer/ ← NEW
+│ │ ├── SocialPostPreview.tsx
+│ │ ├── PlatformSelector.tsx
+│ │ └── SocialCalendarWidget.tsx
+│ ├── video/ ← NEW
+│ │ ├── VideoPlayer.tsx
+│ │ ├── VideoTimeline.tsx
+│ │ ├── ScriptEditor.tsx
+│ │ └── VoiceSelector.tsx
+│ └── dashboard/
+│ ├── SocialOverviewWidget.tsx ← NEW
+│ └── VideoPipelineWidget.tsx ← NEW
+```
+
+---
+
+## Appendix A: Python Dependencies (New)
+
+```txt
+# requirements.txt additions
+
+# Media/Video
+moviepy>=1.0.3
+pydub>=0.25.1
+Pillow>=10.0.0 # Already present
+ffmpeg-python>=0.2.0
+
+# Storage
+django-storages[s3]>=1.14
+boto3>=1.34
+
+# Social Platform SDKs
+python-linkedin-v2>=0.9.0
+tweepy>=4.14 # Twitter/X
+facebook-sdk>=3.1.0
+python-instagram>=1.3.2
+tiktok-api>=0.1.0 # Or direct HTTP client
+
+# TTS
+openai>=1.0 # Already present (for TTS endpoints)
+elevenlabs>=0.2.0 # Optional
+
+# Video
+google-api-python-client>=2.0 # YouTube Data API
+google-auth-oauthlib>=1.0
+
+# Self-hosted (optional)
+# vllm served externally — uses OpenAI-compatible client (already has openai package)
+# coqui-tts served externally — HTTP API calls
+```
+
+## Appendix B: Environment Variables (New)
+
+```env
+# Storage
+AWS_ACCESS_KEY_ID=xxx
+AWS_SECRET_ACCESS_KEY=xxx
+AWS_STORAGE_BUCKET_NAME=igny8-media
+AWS_S3_REGION_NAME=us-east-1
+MEDIA_CDN_URL=https://cdn.igny8.com
+
+# Social Platform OAuth Apps (stored in IntegrationProvider, but app-level config)
+LINKEDIN_CLIENT_ID=xxx
+LINKEDIN_CLIENT_SECRET=xxx
+TWITTER_CLIENT_ID=xxx
+TWITTER_CLIENT_SECRET=xxx
+META_APP_ID=xxx
+META_APP_SECRET=xxx
+TIKTOK_CLIENT_KEY=xxx
+TIKTOK_CLIENT_SECRET=xxx
+GOOGLE_CLIENT_ID=xxx
+GOOGLE_CLIENT_SECRET=xxx
+
+# Optional: Self-hosted GPU
+GPU_SERVER_URL=https://gpu.igny8.internal:8000
+GPU_SERVER_AUTH_TOKEN=xxx
+
+# Optional: ElevenLabs
+ELEVENLABS_API_KEY=xxx
+```
+
+## Appendix C: Docker Compose Additions
+
+```yaml
+# docker-compose.app.yml additions
+
+ worker-social:
+ build: ./backend
+ command: celery -A igny8_core worker -Q social --concurrency=4 -l info
+ depends_on:
+ - redis
+ - db
+ env_file: ./backend/.env
+
+ worker-video:
+ build:
+ context: ./backend
+ dockerfile: Dockerfile.video # Includes FFmpeg
+ command: celery -A igny8_core worker -Q video_render --concurrency=2 -l info
+ depends_on:
+ - redis
+ - db
+ env_file: ./backend/.env
+ volumes:
+ - video_temp:/tmp/igny8_video # Temp render storage
+
+volumes:
+ video_temp:
+```
+
+```dockerfile
+# backend/Dockerfile.video
+FROM python:3.11-slim
+
+# Install FFmpeg
+RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
+
+COPY requirements.txt .
+RUN pip install -r requirements.txt
+
+COPY . /app
+WORKDIR /app
+```
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocA-SAG-Architecture-Dev-Guide.md b/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocA-SAG-Architecture-Dev-Guide.md
new file mode 100644
index 00000000..46d2f196
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocA-SAG-Architecture-Dev-Guide.md
@@ -0,0 +1,1789 @@
+# Doc A — SAG Architecture: Development Guide for Claude Code
+
+**Version:** 1.0
+**Date:** March 2026
+**For:** Claude Code (Opus 4.6) in VSCode on IGNY8 repo
+**Purpose:** Step-by-step implementation guide for all SAG architecture features — where every file goes, what models to create or modify, what the frontend shows, how automation works
+**Scope:** SAG Core (3-layer architecture, Site Builder, Existing Site Intelligence), Interlinking (Doc 3 / Linker module), External Backlink Campaigns (Doc 4), Industry/Sector Templates
+**Rule:** Nothing currently working breaks. All new models use nullable fields on existing tables. All new modules use feature flags. All new frontend pages use the existing sidebar/routing pattern.
+
+---
+
+## Table of Contents
+
+1. [System Context — What Exists Today](#1-system-context)
+2. [Implementation Sequence — The Critical Path](#2-implementation-sequence)
+3. [Phase 1: Data Foundation — New Models](#3-phase-1-data-foundation)
+4. [Phase 2: Sector Attribute Templates](#4-phase-2-sector-attribute-templates)
+5. [Phase 3: Cluster Formation & Keyword Generation Engine](#5-phase-3-cluster-formation--keyword-generation)
+6. [Phase 4: Case 2 — SAG Site Builder Wizard](#6-phase-4-sag-site-builder-wizard)
+7. [Phase 5: Blueprint-Aware Content Pipeline](#7-phase-5-blueprint-aware-content-pipeline)
+8. [Phase 6: Taxonomy Creation Flow](#8-phase-6-taxonomy-creation-flow)
+9. [Phase 7: Case 1 — Existing Site Analysis](#9-phase-7-existing-site-analysis)
+10. [Phase 8: Blueprint Health Monitoring](#10-phase-8-blueprint-health-monitoring)
+11. [Phase 9: SAG Interlinking — Linker Module Evolution](#11-phase-9-sag-interlinking)
+12. [Phase 10: External Backlink Campaign Module](#12-phase-10-external-backlink-campaigns)
+13. [Frontend Navigation & UI Map](#13-frontend-navigation--ui-map)
+14. [API Endpoint Registry](#14-api-endpoint-registry)
+15. [AI Function Registry](#15-ai-function-registry)
+16. [Celery Task Registry](#16-celery-task-registry)
+17. [Feature Flag Registry](#17-feature-flag-registry)
+18. [Cross-Reference: What Feeds What](#18-cross-reference)
+
+---
+
+## 1. System Context — What Exists Today {#1-system-context}
+
+Before building anything, understand the current codebase layout that MUST be preserved.
+
+### 1.1 Backend File Structure (Django)
+
+```
+backend/igny8_core/
+├── auth/ # User, Account, Site, Sector, Plan models + auth views
+│ ├── models.py # Site model lives here — will get sag_blueprint_id field
+│ └── ...
+├── api/ # Base ViewSets, authentication, pagination
+├── ai/ # AI engine — will get new SAG functions
+│ ├── engine.py # AIEngine orchestrator
+│ ├── functions/ # AutoCluster, GenerateIdeas, GenerateContent, etc.
+│ ├── providers/ # OpenAI, Anthropic, Runware, Bria
+│ ├── registry.py # Function registry
+│ └── model_registry.py # ModelRegistry service
+├── modules/ # API layer — ViewSets, serializers, URLs per module
+│ ├── planner/ # Keywords, Clusters, Ideas
+│ ├── writer/ # Tasks, Content, Images
+│ ├── billing/ # Credits, usage
+│ ├── integration/ # WordPress integration
+│ ├── system/ # Settings, prompts, AI config
+│ ├── linker/ # Internal linking (INACTIVE — behind linker_enabled flag)
+│ ├── optimizer/ # Content optimization (INACTIVE)
+│ └── publisher/ # Publishing pipeline
+├── business/ # Service layer — business logic
+│ ├── automation/ # 7-stage automation pipeline
+│ ├── content/ # Content generation orchestration
+│ ├── integration/ # Sync services
+│ ├── linking/ # Link processing (INACTIVE)
+│ ├── optimization/ # Content optimization (INACTIVE)
+│ ├── planning/ # Clustering, idea generation
+│ └── publishing/ # Publishing orchestration
+├── plugins/ # Plugin distribution system
+└── tasks/ # Celery task definitions
+```
+
+### 1.2 Frontend File Structure (React/TypeScript)
+
+```
+frontend/src/
+├── api/ # API clients (linker.api.ts, optimizer.api.ts, etc.)
+├── services/
+│ └── api.ts # Main API service (2500+ lines)
+├── store/ # Zustand stores (authStore, siteStore, sectorStore, billingStore, moduleStore)
+├── pages/ # Route pages
+│ ├── Dashboard/ # Main dashboard with widgets
+│ ├── Planner/ # Keywords, Clusters, Ideas
+│ ├── Writer/ # Tasks, Content, Images, Review, Published
+│ ├── Automation/ # Pipeline config and monitoring
+│ ├── Linker/ # Internal linking (INACTIVE)
+│ ├── Optimizer/ # Content optimization (INACTIVE)
+│ ├── Settings/ # Site settings, AI models, prompts
+│ ├── Billing/ # Plans, usage, transactions
+│ └── Auth/ # Login, register, password reset
+├── components/
+│ ├── common/ # Shared components
+│ ├── dashboard/ # Dashboard widgets
+│ └── header/ # NotificationDropdown
+├── layout/ # AppLayout, AppHeader, AppSidebar
+└── hooks/ # Custom hooks
+```
+
+### 1.3 Current Sidebar Navigation
+
+```
+Dashboard
+SETUP
+ ├── Add Keywords
+ ├── Content Settings
+ ├── Sites (if sites_enabled)
+ └── Thinker (admin only, if thinker_enabled)
+WORKFLOW
+ ├── Planner (Keywords → Clusters → Ideas)
+ ├── Writer (Queue → Drafts → Images → Review → Published)
+ ├── Automation
+ ├── Linker (if linker_enabled — currently hidden)
+ └── Optimizer (if optimizer_enabled — currently hidden)
+ACCOUNT
+ ├── Account Settings
+ ├── Plans & Billing
+ ├── Usage
+ └── AI Models (admin only)
+HELP
+ └── Help & Docs
+```
+
+### 1.4 Existing Models That Will Be Modified
+
+| Model | Location | What Gets Added | Why |
+|-------|----------|----------------|-----|
+| **Site** | `auth/models.py` | `sag_blueprint_id` (FK, nullable) | Link site to its active blueprint |
+| **Cluster** | `modules/planner/models.py` | `sag_cluster_id` (FK, nullable), `cluster_type` (Enum, nullable) | Connect existing clusters to SAG clusters |
+| **Tasks** | `modules/writer/models.py` | `sag_cluster_id` (FK, nullable), `blueprint_context` (JSON, nullable) | Writer gets cluster context for type-specific prompts |
+| **Content** | `modules/writer/models.py` | `sag_cluster_id` (FK, nullable), `outbound_link_count` (Int, nullable), `inbound_link_count` (Int, nullable), `backlink_count` (Int, nullable) | Map content to clusters, track link metrics |
+| **ContentIdea** | `modules/planner/models.py` | `sag_cluster_id` (FK, nullable), `idea_source` (Enum, nullable) | Track whether idea came from keyword clustering or SAG blueprint |
+
+**Critical rule:** ALL additions to existing models are nullable. No migrations that alter non-null columns. No breaking changes to existing API serializers — new fields are added as optional with `required=False`.
+
+### 1.5 Existing AI Functions
+
+```
+ai/functions/
+├── auto_cluster.py # AutoClusterKeywords — Keywords → Clusters
+├── generate_ideas.py # GenerateContentIdeas — Cluster → Ideas
+├── generate_content.py # GenerateContent — Task → Full article
+├── generate_image_prompts.py # GenerateImagePrompts — Content → Image prompts
+├── generate_images.py # GenerateImages — Prompts → Images
+└── optimize_content.py # OptimizeContent — PENDING, not implemented
+```
+
+### 1.6 Existing Automation Pipeline (7 stages)
+
+```
+Stage 1: Process New Keywords
+Stage 2: AI Cluster Keywords
+Stage 3: Generate Content Ideas
+Stage 4: Create Writer Tasks
+Stage 5: Generate Article Content
+Stage 6: Extract Image Prompts
+Stage 7: Generate Images → Review Queue
+```
+
+### 1.7 Multi-Tenant Data Scoping
+
+All new models MUST follow the existing pattern:
+- Extend `AccountBaseModel` for account-scoped data (SAGBlueprint, SAGCampaign)
+- Extend `SiteSectorBaseModel` for site+sector-scoped data where applicable
+- ViewSets extend `AccountModelViewSet` or `SiteSectorModelViewSet` for auto-filtering
+- `AccountContextMiddleware` resolves tenant from JWT — no manual filtering needed
+
+---
+
+## 2. Implementation Sequence — The Critical Path {#2-implementation-sequence}
+
+Everything depends on what came before. This sequence cannot be reordered.
+
+```
+PHASE 1 ─── Data Foundation (NEW models + modified existing models)
+ │ No UI yet. Backend only. Migrations.
+ │
+PHASE 2 ─── Sector Attribute Templates (NEW data layer)
+ │ Admin interface to manage templates.
+ │ AI-assisted template generation.
+ │
+PHASE 3 ─── Cluster Formation & Keyword Generation Engine
+ │ AI functions that turn attributes → clusters → keywords.
+ │ No user-facing UI yet — these are services called by wizard and pipeline.
+ │
+PHASE 4 ─── SAG Site Builder Wizard (Case 2)
+ │ Frontend: Setup wizard gets Step 3 "Site Structure".
+ │ First user-facing SAG feature.
+ │
+PHASE 5 ─── Blueprint-Aware Content Pipeline
+ │ Existing 7-stage pipeline enhanced with blueprint context.
+ │ Idea generation reads blueprint. Writer uses type-specific prompts.
+ │
+PHASE 6 ─── Taxonomy Creation Flow
+ │ IGNY8 → Plugin: push taxonomy creation payload.
+ │ Plugin creates WP taxonomies from blueprint.
+ │
+PHASE 7 ─── Existing Site Analysis (Case 1)
+ │ Plugin sends site data → IGNY8 AI extracts attributes → gap analysis.
+ │
+PHASE 8 ─── Blueprint Health Monitoring
+ │ Background Celery tasks. Dashboard widgets.
+ │
+PHASE 9 ─── SAG Interlinking (Linker Module Evolution)
+ │ Activate linker_enabled. New SAG-aware linking rules.
+ │ Depends on: blueprints, clusters, published content.
+ │
+PHASE 10 ── External Backlink Campaign Module
+ Depends on: blueprints, clusters, interlinking, GSC data.
+ New models, new UI, FatGrid/PR integrations.
+```
+
+**Parallel tracks possible:**
+- Phase 2 (templates) and Phase 8 (health monitoring) share no dependencies — template creation can continue while monitoring is built.
+- Phase 9 (interlinking) and Phase 10 (backlinks) can overlap: interlinking rules can be finalized while backlink data models are built.
+
+---
+
+## 3. Phase 1: Data Foundation — New Models {#3-phase-1-data-foundation}
+
+### 3.1 New App: `sag`
+
+Create a new Django app for all SAG-specific models and business logic. This keeps SAG cleanly separated from existing modules.
+
+**Create:**
+```
+backend/igny8_core/
+├── sag/ # NEW Django app
+│ ├── __init__.py
+│ ├── apps.py # SagConfig
+│ ├── models.py # SAGBlueprint, SAGAttribute, SAGCluster,
+│ │ # SectorAttributeTemplate
+│ ├── serializers.py # DRF serializers for all SAG models
+│ ├── views.py # ViewSets (SAGBlueprintViewSet, etc.)
+│ ├── urls.py # /api/v1/sag/*
+│ ├── admin.py # Django admin for SAG models
+│ ├── services/ # Business logic
+│ │ ├── __init__.py
+│ │ ├── blueprint_service.py # Blueprint CRUD, versioning, lifecycle
+│ │ ├── attribute_service.py # Attribute framework loading, merging, validation
+│ │ ├── cluster_service.py # Cluster formation, type classification
+│ │ ├── keyword_service.py # Keyword auto-generation from attribute intersections
+│ │ ├── template_service.py # Sector template loading, AI generation
+│ │ └── health_service.py # Blueprint health score calculation
+│ ├── ai_functions/ # SAG-specific AI functions
+│ │ ├── __init__.py
+│ │ ├── attribute_discovery.py # AI: Industry+Sector → Attribute framework
+│ │ ├── attribute_extraction.py # AI: Site data → Attribute values (Case 1)
+│ │ ├── attribute_population.py # AI: User inputs → Attribute values (Case 2)
+│ │ ├── cluster_formation.py # AI: Populated attributes → Clusters with types
+│ │ ├── keyword_generation.py # AI: Clusters + attribute values → Keywords
+│ │ └── content_planning.py # AI: Clusters + keywords → Content ideas
+│ └── migrations/
+│ └── 0001_initial.py
+```
+
+**Register in settings.py:**
+```python
+INSTALLED_APPS = [
+ ...
+ 'igny8_core.sag',
+]
+```
+
+**Register URLs in root urls.py:**
+```python
+urlpatterns = [
+ ...
+ path('api/v1/sag/', include('igny8_core.sag.urls')),
+]
+```
+
+### 3.2 New Models — Complete Definitions
+
+**SAGBlueprint** — The master architectural document for a site.
+
+```python
+# sag/models.py
+
+class SAGBlueprint(AccountBaseModel):
+ """
+ The SAG Blueprint is the complete site architecture generated from
+ attribute analysis. Both Case 1 (existing site) and Case 2 (new site)
+ produce this same model. One active blueprint per site at a time.
+ """
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ site = models.ForeignKey('auth.Site', on_delete=models.CASCADE, related_name='sag_blueprints')
+ version = models.IntegerField(default=1)
+ status = models.CharField(
+ max_length=20,
+ choices=[
+ ('draft', 'Draft'), # Generated, awaiting user confirmation
+ ('active', 'Active'), # Confirmed, driving all content operations
+ ('evolving', 'Evolving'), # New clusters being added as site grows
+ ('archived', 'Archived'), # Replaced by newer version
+ ],
+ default='draft'
+ )
+ source = models.CharField(
+ max_length=20,
+ choices=[
+ ('site_builder', 'Site Builder (Case 2)'),
+ ('site_analysis', 'Existing Site Analysis (Case 1)'),
+ ('manual', 'Manual Creation'),
+ ]
+ )
+ # Denormalized JSON for quick reads — authoritative data is in related models
+ attributes_json = models.JSONField(default=dict, blank=True)
+ clusters_json = models.JSONField(default=dict, blank=True)
+ taxonomy_plan = models.JSONField(default=dict, blank=True)
+ execution_priority = models.JSONField(default=list, blank=True)
+ internal_linking_map = models.JSONField(
+ default=dict, blank=True,
+ help_text="Placeholder until Doc 3 interlinking spec populates this"
+ )
+
+ # Metrics
+ sag_health_score = models.FloatField(default=0.0, help_text="0-100 score")
+ total_clusters = models.IntegerField(default=0)
+ total_keywords = models.IntegerField(default=0)
+ total_content_planned = models.IntegerField(default=0)
+ total_content_published = models.IntegerField(default=0)
+
+ # Timestamps
+ confirmed_at = models.DateTimeField(null=True, blank=True)
+ last_health_check = models.DateTimeField(null=True, blank=True)
+
+ class Meta:
+ ordering = ['-created_at']
+ unique_together = ['site', 'version']
+```
+
+**SAGAttribute** — A classification axis within a blueprint.
+
+```python
+class SAGAttribute(models.Model):
+ """
+ One dimensional axis of the SAG grid. Each attribute becomes a WordPress
+ custom taxonomy. Values become taxonomy terms.
+ """
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ blueprint = models.ForeignKey(SAGBlueprint, on_delete=models.CASCADE, related_name='attributes')
+ name = models.CharField(max_length=100) # "Target Area"
+ slug = models.SlugField(max_length=100) # "target-area"
+ description = models.TextField(blank=True) # "Primary body area the device targets"
+ level = models.CharField(
+ max_length=20,
+ choices=[
+ ('primary', 'Primary'), # Main navigation axes
+ ('secondary', 'Secondary'), # Cluster depth axes
+ ('tertiary', 'Tertiary'), # Filtering/tagging
+ ]
+ )
+ values = models.JSONField(
+ default=list,
+ help_text='Array of {name, slug} objects. E.g. [{"name": "Foot", "slug": "foot"}]'
+ )
+ # WordPress sync state
+ wp_taxonomy_slug = models.CharField(max_length=100, null=True, blank=True)
+ wp_sync_status = models.CharField(
+ max_length=20,
+ choices=[
+ ('pending', 'Pending'),
+ ('synced', 'Synced'),
+ ('failed', 'Failed'),
+ ],
+ default='pending'
+ )
+ sort_order = models.IntegerField(default=0)
+ created_at = models.DateTimeField(auto_now_add=True)
+
+ class Meta:
+ ordering = ['sort_order', 'level']
+```
+
+**SAGCluster** — A meaningful intersection of 2+ attribute values.
+
+```python
+class SAGCluster(AccountBaseModel):
+ """
+ A cluster represents a topical ecosystem formed at the intersection of
+ 2+ attribute values. Each cluster has a hub page and supporting content.
+ """
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ blueprint = models.ForeignKey(SAGBlueprint, on_delete=models.CASCADE, related_name='clusters')
+ site = models.ForeignKey('auth.Site', on_delete=models.CASCADE, related_name='sag_clusters')
+ name = models.CharField(max_length=200) # "Foot Massagers for Neuropathy"
+ slug = models.SlugField(max_length=200)
+ cluster_type = models.CharField(
+ max_length=30,
+ choices=[
+ ('product_category', 'Product/Service Category'),
+ ('condition_problem', 'Condition/Problem'),
+ ('feature', 'Feature'),
+ ('brand', 'Brand'),
+ ('informational', 'Informational'),
+ ('comparison', 'Comparison'),
+ ]
+ )
+ attribute_intersection = models.JSONField(
+ help_text='Which attribute values form this cluster. E.g. {"target_area": "Foot", "relief_focus": "Neuropathy"}'
+ )
+
+ # Hub page info
+ hub_page_title = models.CharField(max_length=300, blank=True)
+ hub_page_type = models.CharField(max_length=30, default='cluster_hub')
+ hub_page_structure = models.CharField(max_length=30, default='guide_tutorial')
+ hub_page_url_slug = models.CharField(max_length=300, blank=True)
+
+ # Auto-generated keywords
+ auto_generated_keywords = models.JSONField(default=list)
+
+ # Supporting content plan
+ supporting_content_plan = models.JSONField(
+ default=list,
+ help_text='Array of {title, type, structure, keywords} for planned supporting content'
+ )
+
+ # Linking
+ linked_attribute_terms = models.JSONField(
+ default=list,
+ help_text='Which attribute term slugs this cluster connects to'
+ )
+ cross_cluster_links = models.JSONField(
+ default=list,
+ help_text='Slugs of other clusters sharing an attribute value'
+ )
+
+ # Status and metrics
+ status = models.CharField(
+ max_length=20,
+ choices=[
+ ('planned', 'Planned'),
+ ('partial', 'Partial'), # Some content published
+ ('complete', 'Complete'), # Hub + all supporting content published
+ ],
+ default='planned'
+ )
+ content_count = models.IntegerField(default=0)
+ link_coverage_score = models.FloatField(default=0.0, help_text="0-100")
+
+ # Backlink campaign fields (Phase 10)
+ backlink_target_tier = models.CharField(
+ max_length=5,
+ choices=[('T1','T1'),('T2','T2'),('T3','T3'),('T4','T4'),('T5','T5')],
+ null=True, blank=True,
+ help_text='Backlink campaign tier assignment — set by Doc 4 campaign generator'
+ )
+
+ created_at = models.DateTimeField(auto_now_add=True)
+
+ class Meta:
+ ordering = ['name']
+```
+
+**SectorAttributeTemplate** — The NEW data layer: sector-level attribute intelligence.
+
+```python
+class SectorAttributeTemplate(models.Model):
+ """
+ This is the foundational data layer that does NOT currently exist.
+ Each sector gets an attribute framework that defines its dimensional axes
+ and suggested values. This is the structural DNA of a sector.
+ """
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ industry = models.CharField(max_length=200)
+ sector = models.CharField(max_length=200)
+ site_type = models.CharField(
+ max_length=30,
+ choices=[
+ ('e_commerce', 'E-Commerce'),
+ ('services', 'Services'),
+ ('saas', 'SaaS'),
+ ('content', 'Content/Blog'),
+ ('local_business', 'Local Business'),
+ ('brand', 'Brand'),
+ ]
+ )
+ attribute_framework = models.JSONField(
+ help_text='Template attributes with suggested values. Array of {name, description, level, suggested_values[]}'
+ )
+ keyword_templates = models.JSONField(
+ default=dict,
+ help_text='Keyword generation templates per cluster type. E.g. {"condition_problem": ["best {target} for {condition}", ...]}'
+ )
+ source = models.CharField(
+ max_length=30,
+ choices=[
+ ('manual', 'Manual'),
+ ('ai_generated', 'AI Generated'),
+ ('user_contributed', 'User Contributed'),
+ ],
+ default='manual'
+ )
+ is_active = models.BooleanField(default=True)
+ created_at = models.DateTimeField(auto_now_add=True)
+ updated_at = models.DateTimeField(auto_now=True)
+
+ class Meta:
+ unique_together = ['industry', 'sector']
+ ordering = ['industry', 'sector']
+```
+
+### 3.3 Migrations for Existing Models
+
+**Site model** (`auth/models.py`):
+```python
+# Add to Site model:
+sag_blueprint_id = models.ForeignKey(
+ 'sag.SAGBlueprint', on_delete=models.SET_NULL,
+ null=True, blank=True, related_name='active_for_sites',
+ help_text='Currently active SAG blueprint for this site'
+)
+```
+
+**Cluster model** (`modules/planner/models.py`):
+```python
+# Add to existing Cluster model:
+sag_cluster_id = models.ForeignKey(
+ 'sag.SAGCluster', on_delete=models.SET_NULL,
+ null=True, blank=True, related_name='legacy_clusters'
+)
+cluster_type = models.CharField(max_length=30, null=True, blank=True)
+```
+
+**Tasks model** (`modules/writer/models.py`):
+```python
+# Add to existing Tasks model:
+sag_cluster_id = models.ForeignKey(
+ 'sag.SAGCluster', on_delete=models.SET_NULL,
+ null=True, blank=True
+)
+blueprint_context = models.JSONField(null=True, blank=True)
+```
+
+**Content model** (`modules/writer/models.py`):
+```python
+# Add to existing Content model:
+sag_cluster_id = models.ForeignKey(
+ 'sag.SAGCluster', on_delete=models.SET_NULL,
+ null=True, blank=True
+)
+outbound_link_count = models.IntegerField(null=True, blank=True)
+inbound_link_count = models.IntegerField(null=True, blank=True)
+backlink_count = models.IntegerField(null=True, blank=True)
+```
+
+**ContentIdea model** (`modules/planner/models.py`):
+```python
+# Add to existing ContentIdea model:
+sag_cluster_id = models.ForeignKey(
+ 'sag.SAGCluster', on_delete=models.SET_NULL,
+ null=True, blank=True
+)
+idea_source = models.CharField(
+ max_length=30, null=True, blank=True,
+ choices=[
+ ('keyword_clustering', 'Keyword Clustering'),
+ ('sag_blueprint', 'SAG Blueprint'),
+ ('gap_analysis', 'Gap Analysis'),
+ ]
+)
+```
+
+### 3.4 Serializers
+
+```
+sag/serializers.py
+```
+
+Create DRF serializers for each model. Key considerations:
+- `SAGBlueprintSerializer` — include nested `attributes` and `clusters` on detail view, exclude on list view for performance
+- `SAGBlueprintListSerializer` — lightweight: id, site, version, status, health_score, total_clusters, total_keywords, timestamps
+- `SAGAttributeSerializer` — full attribute with values array
+- `SAGClusterSerializer` — full cluster with keywords, supporting content plan, linking data
+- `SectorAttributeTemplateSerializer` — admin-only, includes full attribute_framework JSON
+
+### 3.5 ViewSets and URLs
+
+```python
+# sag/views.py
+
+class SAGBlueprintViewSet(AccountModelViewSet):
+ """
+ CRUD for SAG Blueprints.
+ Additional actions: confirm, archive, regenerate, health_check
+ """
+ queryset = SAGBlueprint.objects.all()
+ serializer_class = SAGBlueprintSerializer
+
+ @action(detail=True, methods=['post'])
+ def confirm(self, request, pk=None):
+ """Move blueprint from draft → active. Sets site.sag_blueprint_id."""
+ pass
+
+ @action(detail=True, methods=['post'])
+ def archive(self, request, pk=None):
+ """Move blueprint to archived. Removes from site.sag_blueprint_id."""
+ pass
+
+ @action(detail=True, methods=['post'])
+ def regenerate(self, request, pk=None):
+ """Create new version of blueprint from updated attributes."""
+ pass
+
+ @action(detail=True, methods=['get'])
+ def health_check(self, request, pk=None):
+ """Run health check and return score + details."""
+ pass
+
+class SAGAttributeViewSet(AccountModelViewSet):
+ """CRUD for attributes within a blueprint."""
+ queryset = SAGAttribute.objects.all()
+ serializer_class = SAGAttributeSerializer
+
+class SAGClusterViewSet(AccountModelViewSet):
+ """CRUD for clusters within a blueprint."""
+ queryset = SAGCluster.objects.all()
+ serializer_class = SAGClusterSerializer
+
+class SectorAttributeTemplateViewSet(ModelViewSet):
+ """Admin-only: manage sector attribute templates."""
+ queryset = SectorAttributeTemplate.objects.all()
+ serializer_class = SectorAttributeTemplateSerializer
+ permission_classes = [IsAdminUser]
+```
+
+```python
+# sag/urls.py
+
+router = DefaultRouter()
+router.register(r'blueprints', SAGBlueprintViewSet)
+router.register(r'attributes', SAGAttributeViewSet)
+router.register(r'clusters', SAGClusterViewSet)
+router.register(r'templates', SectorAttributeTemplateViewSet)
+
+urlpatterns = [
+ path('', include(router.urls)),
+]
+```
+
+### 3.6 Django Admin
+
+Register all 4 models in Django admin with:
+- SAGBlueprint: list display (site, version, status, health_score, created_at), filters (status, source)
+- SAGAttribute: inline on Blueprint admin, sortable by sort_order
+- SAGCluster: list display (name, cluster_type, status, content_count), filters (cluster_type, status)
+- SectorAttributeTemplate: list display (industry, sector, site_type, source, is_active), filters (industry, site_type, source)
+
+### 3.7 Frontend — Phase 1 Has No User-Facing UI
+
+Phase 1 is backend-only. The only frontend addition is a read-only blueprint viewer in Site Settings (for development verification):
+
+```
+frontend/src/pages/Settings/
+├── SiteSettings.tsx # EXISTING — add a "SAG Blueprint" tab
+└── components/
+ └── BlueprintViewer.tsx # NEW — read-only JSON display of active blueprint
+```
+
+This is a development aid. The real UI comes in Phase 4 (wizard) and Phase 8 (dashboard).
+
+---
+
+## 4. Phase 2: Sector Attribute Templates {#4-phase-2-sector-attribute-templates}
+
+### 4.1 What This Phase Delivers
+
+The SectorAttributeTemplate model from Phase 1 gets populated with actual data. This is the structural DNA that makes everything else work.
+
+### 4.2 Backend: Template Service
+
+```
+sag/services/template_service.py
+```
+
+**Functions:**
+- `get_template(industry, sector)` → returns SectorAttributeTemplate or None
+- `get_or_generate_template(industry, sector)` → returns existing template OR triggers AI generation
+- `merge_templates(sector_list)` → for multi-sector sites: merge attribute frameworks, combine value lists, deduplicate
+- `validate_template(template_data)` → ensure all attributes have names, levels, and at least suggested_values structure
+
+### 4.3 Backend: AI Template Generation
+
+```
+sag/ai_functions/attribute_discovery.py
+```
+
+**New AI function: `DiscoverSectorAttributes`**
+
+Registered in AI engine function registry alongside existing functions.
+
+```python
+# Register in ai/registry.py:
+'discover_sector_attributes': 'igny8_core.sag.ai_functions.attribute_discovery.DiscoverSectorAttributes'
+```
+
+**Input:** industry name, sector name, site_type
+**Output:** attribute_framework JSON matching SectorAttributeTemplate schema
+**Prompt strategy:** "You are an expert in site architecture for {industry}/{sector}. Define the dimensional axes that organize this sector. For each attribute, specify: name, description, level (primary/secondary/tertiary), and 5-10 suggested values."
+
+### 4.4 Backend: Manual Template Seeding
+
+Priority: Seed templates for sectors with highest existing user base in IGNY8. Use the Healthcare/Medical Excel workbook (SAGIndustry01HealthcareMedical.xlsx) as the reference format for how templates should be structured.
+
+**Admin Interface:** Django admin for SectorAttributeTemplate allows manual creation and editing. The `attribute_framework` JSON field should use a structured widget or at minimum raw JSON with validation.
+
+### 4.5 Frontend — Admin Template Manager (Admin Only)
+
+```
+frontend/src/pages/Settings/
+└── components/
+ └── SectorTemplateManager.tsx # NEW — admin-only interface
+```
+
+This is a simple CRUD interface visible only to admin users (similar to existing AI Models admin page). Shows list of all templates, allows editing attribute frameworks, and can trigger AI generation for missing sectors.
+
+**Not in main sidebar** — accessed via Settings → Admin → Sector Templates (similar to how AI Models is nested under Settings).
+
+---
+
+## 5. Phase 3: Cluster Formation & Keyword Generation Engine {#5-phase-3-cluster-formation--keyword-generation}
+
+### 5.1 What This Phase Delivers
+
+The AI intelligence that turns populated attributes into clusters with types, and clusters into 300-500+ keywords. These are backend services — no direct UI yet. They're called by the wizard (Phase 4) and the pipeline (Phase 5).
+
+### 5.2 Backend: AI Functions
+
+**`sag/ai_functions/cluster_formation.py` — `FormClusters`**
+
+Register in AI engine:
+```python
+'form_clusters': 'igny8_core.sag.ai_functions.cluster_formation.FormClusters'
+```
+
+**Input:** populated attributes (all values per attribute), sector context, site_type
+**Output:** array of cluster objects with: name, cluster_type, attribute_intersection, hub_page_title, hub_page_structure, supporting_content_plan
+
+**Logic:**
+1. Generate all 2-value intersections of primary × primary, primary × secondary
+2. AI evaluates each intersection: is this a real topical ecosystem with search demand?
+3. Valid intersections become clusters
+4. AI classifies each cluster by type (product_category, condition_problem, feature, brand, informational, comparison)
+5. AI generates hub page title and supporting content titles per cluster
+6. Maximum 50 clusters per sector (hard cap from SAG methodology)
+
+**`sag/ai_functions/keyword_generation.py` — `GenerateKeywords`**
+
+Register in AI engine:
+```python
+'generate_keywords': 'igny8_core.sag.ai_functions.keyword_generation.GenerateKeywords'
+```
+
+**Input:** clusters with attribute values, keyword_templates from SectorAttributeTemplate
+**Output:** per-cluster keyword arrays (15-25 keywords per cluster)
+
+**Logic:**
+1. Load keyword templates for this sector type
+2. For each cluster, substitute attribute values into templates
+3. Generate long-tail variants with modifiers (best, review, vs, for, how to)
+4. Deduplicate across clusters
+5. Total should be 300-500+ keywords per site
+
+### 5.3 Backend: Blueprint Assembly Service
+
+```
+sag/services/blueprint_service.py — extend with:
+```
+
+**`assemble_blueprint(site, attributes, clusters, keywords)`**
+
+Takes all outputs from Phases 2-3 and assembles the complete SAGBlueprint:
+1. Create SAGBlueprint record (status=draft)
+2. Create SAGAttribute records from attributes
+3. Create SAGCluster records from clusters
+4. Populate auto_generated_keywords on each cluster
+5. Generate taxonomy_plan from attributes
+6. Generate execution_priority from cluster types and keyword volumes
+7. Populate denormalized JSON fields on blueprint
+8. Return blueprint ID
+
+### 5.4 Backend: Cluster Service
+
+```
+sag/services/cluster_service.py
+```
+
+**Functions:**
+- `classify_cluster_type(intersection, sector_context)` → Enum
+- `generate_hub_page_info(cluster)` → title, type, structure, url_slug
+- `plan_supporting_content(cluster)` → array of {title, type, structure, keywords}
+- `find_cross_cluster_links(all_clusters)` → for each cluster, find others sharing attribute values
+- `find_linked_attribute_terms(cluster)` → which attribute value slugs this cluster connects to
+
+---
+
+## 6. Phase 4: SAG Site Builder Wizard (Case 2) {#6-phase-4-sag-site-builder-wizard}
+
+### 6.1 What This Phase Delivers
+
+The first user-facing SAG feature. The setup wizard gets a new Step 3 "Site Structure" that collects business data and generates a complete blueprint.
+
+### 6.2 Backend: Wizard API Endpoints
+
+Add to `sag/views.py` or create `sag/wizard_views.py`:
+
+```python
+# POST /api/v1/sag/wizard/generate-attributes/
+# Input: {industry, sectors[], site_type}
+# Output: {attributes: [{name, level, suggested_values}]}
+# Calls: template_service.get_or_generate_template() + merge if multi-sector
+
+# POST /api/v1/sag/wizard/populate-attributes/
+# Input: {attributes: [{name, level, values}], business_data: {products, services, brands, locations, conditions}}
+# Output: {populated_attributes: [{name, level, values}]} (values now enriched from business data)
+# Calls: ai_functions.attribute_population.PopulateAttributes
+
+# POST /api/v1/sag/wizard/generate-blueprint/
+# Input: {site_id, populated_attributes, mode: 'quick'|'detailed'}
+# Output: {blueprint_id, clusters, keywords_count, content_plan_count, taxonomy_count}
+# Calls: cluster_formation → keyword_generation → blueprint_service.assemble_blueprint()
+
+# POST /api/v1/sag/wizard/confirm-blueprint/
+# Input: {blueprint_id}
+# Output: {success, blueprint_status: 'active'}
+# Calls: blueprint_service.confirm() — sets site.sag_blueprint_id, triggers taxonomy creation
+```
+
+### 6.3 Backend: AI Function for Business Data Population
+
+**`sag/ai_functions/attribute_population.py` — `PopulateAttributes`**
+
+**Input:** attribute framework + user's business data (products list, services list, brands, locations, conditions)
+**Output:** populated attributes with site-specific values extracted from business data
+
+**Logic:**
+1. Parse business data inputs (free text, comma-separated lists, structured inputs)
+2. Map business items to attribute values (e.g., "foot massagers, neck massagers" → Target Area: [Foot, Neck])
+3. Identify values not in suggested_values → add as new values
+4. Apply pruning rules (single-value primary → demote to secondary, etc.)
+5. Assess completeness per attribute → flag any that need user attention
+
+### 6.4 Frontend: Setup Wizard Enhancement
+
+The existing setup wizard lives at:
+```
+frontend/src/pages/Settings/ # or wherever the Add Site wizard is
+```
+
+**Modify the wizard to insert Step 3 between "Add Site" and "Connect WordPress":**
+
+```
+frontend/src/pages/Settings/
+├── SetupWizard/ # EXISTING wizard component
+│ ├── WizardStep1Welcome.tsx # No changes
+│ ├── WizardStep2AddSite.tsx # No changes — already collects Industry, Sectors
+│ ├── WizardStep3SiteStructure.tsx # NEW — the Site Builder step
+│ │ ├── ModeSelector.tsx # Quick Mode vs Detailed Mode toggle
+│ │ ├── AttributeReview.tsx # Shows AI-generated attributes, toggle on/off, edit values
+│ │ ├── BusinessDataInput.tsx # Per-site-type input forms (products, services, etc.)
+│ │ ├── BlueprintPreview.tsx # Tree view of clusters, keywords count, content plan
+│ │ └── BlueprintConfirm.tsx # Approve & Build / Adjust Attributes buttons
+│ ├── WizardStep4ConnectWP.tsx # EXISTING — enhanced: auto-creates taxonomies after connect
+│ ├── WizardStep5Keywords.tsx # EXISTING — now shows "optional" messaging + gap analysis
+│ └── WizardStep6Complete.tsx # EXISTING — enhanced: shows blueprint summary
+```
+
+### 6.5 Frontend: Step 3 Component Details
+
+**ModeSelector.tsx**
+- Two cards: "Quick Mode" (auto-build, skip review) and "Detailed Mode" (full review + business data)
+- Quick mode calls: generate-attributes → generate-blueprint (with defaults) → confirm
+- Detailed mode proceeds through all sub-steps
+
+**AttributeReview.tsx**
+- Displays attributes grouped by level (Primary, Secondary, Tertiary)
+- Each attribute: name, toggle switch (on/off), expandable values list
+- Values: chip/tag UI with [+ Add] button, click to remove
+- [+ Add Custom Attribute] button at bottom
+- Loading state while AI generates attributes
+
+**BusinessDataInput.tsx**
+- Dynamic form based on site_type from Step 2
+- E-commerce: Products/categories (textarea), Device types (textarea), Problems solved (textarea), Brands (textarea), Features (textarea)
+- Services: Services offered (textarea), Locations (textarea), Property types (textarea), Problems solved (textarea)
+- SaaS: Features (textarea), Use cases (textarea), Integrations (textarea), Competitors (textarea)
+- Content: Topics (textarea), Subtopics (textarea), Audience (textarea)
+- Local Business: Services (textarea), Locations (textarea), Conditions (textarea)
+- Each textarea has helper text: "Enter one per line, or comma-separated"
+
+**BlueprintPreview.tsx**
+- Tree/accordion view of clusters grouped by primary attribute value
+- Each cluster shows: name, type badge, hub page title, supporting content count, keyword count
+- Summary bar at top: X clusters, Y keywords, Z content pieces, W taxonomies
+- Expandable per cluster: see all keywords, all planned supporting content titles
+- This is the "Your Site Architecture" preview from the spec document
+
+**BlueprintConfirm.tsx**
+- Two buttons: [Approve & Build] and [Adjust Attributes] (goes back to AttributeReview)
+- Approve triggers: POST /wizard/confirm-blueprint/
+- Shows brief loading animation during confirmation
+- On success: proceeds to Step 4 (Connect WordPress)
+
+### 6.6 Frontend: Zustand Store
+
+```
+frontend/src/store/
+└── sagStore.ts # NEW
+```
+
+```typescript
+interface SAGState {
+ blueprint: SAGBlueprint | null;
+ attributes: SAGAttribute[];
+ clusters: SAGCluster[];
+ wizardMode: 'quick' | 'detailed';
+ wizardStep: number; // Sub-step within Step 3
+ isGenerating: boolean;
+ error: string | null;
+
+ // Actions
+ setWizardMode: (mode: 'quick' | 'detailed') => void;
+ generateAttributes: (industry: string, sectors: string[]) => Promise;
+ populateAttributes: (attributes: any[], businessData: any) => Promise;
+ generateBlueprint: (siteId: string) => Promise;
+ confirmBlueprint: (blueprintId: string) => Promise;
+ loadBlueprint: (siteId: string) => Promise;
+}
+```
+
+### 6.7 Frontend: API Client
+
+```
+frontend/src/api/
+└── sag.api.ts # NEW
+```
+
+API client for all `/api/v1/sag/*` endpoints. Follows existing pattern from other API clients (linker.api.ts, optimizer.api.ts).
+
+---
+
+## 7. Phase 5: Blueprint-Aware Content Pipeline {#7-phase-5-blueprint-aware-content-pipeline}
+
+### 7.1 What This Phase Delivers
+
+The existing 7-stage automation pipeline becomes SAG-aware. Ideas generate from the blueprint, tasks carry cluster context, writer uses type-specific prompts, and content gets auto-assigned to correct taxonomies.
+
+### 7.2 Backend: Modified Automation Stages
+
+**Location:** `business/automation/` — modify existing stage handlers
+
+**Stage 0 (NEW): Blueprint Check**
+```python
+# business/automation/stages/stage_0_blueprint_check.py (NEW)
+# Before any pipeline run:
+# 1. Check if site has active SAG blueprint (site.sag_blueprint_id is not None)
+# 2. If yes: load blueprint, identify unfulfilled content needs
+# 3. If no: pipeline runs in legacy mode (no changes to current behavior)
+```
+
+**Stage 2: AI Cluster Keywords — ENHANCED**
+```python
+# business/automation/stages/ — modify existing Stage 2
+# If blueprint exists:
+# - Skip AI clustering (clusters already defined by blueprint)
+# - Instead: map any new user-added keywords to existing SAG clusters
+# - Flag keywords that don't match any cluster
+# If no blueprint:
+# - Run existing AutoClusterKeywords (unchanged)
+```
+
+**Stage 3: Generate Content Ideas — ENHANCED**
+```python
+# business/automation/stages/ — modify existing Stage 3
+# If blueprint exists:
+# - Call sag/ai_functions/content_planning.py instead of generic idea generation
+# - Each idea gets: correct Sector, Structure, Type, Cluster from blueprint
+# - idea_source = 'sag_blueprint'
+# If no blueprint:
+# - Run existing GenerateContentIdeas (unchanged)
+```
+
+**Stage 4: Create Writer Tasks — ENHANCED**
+```python
+# business/automation/stages/ — modify existing Stage 4
+# If blueprint exists:
+# - Tasks carry sag_cluster_id and blueprint_context
+# - blueprint_context includes: cluster_type, hub_title, attribute_terms, related_content
+# If no blueprint:
+# - Run existing task creation (unchanged)
+```
+
+**Stage 5: Generate Article Content — ENHANCED**
+```python
+# business/automation/stages/ — modify existing Stage 5
+# If task has blueprint_context:
+# - Select prompt template by Structure + Type (instead of generic)
+# - Include SAG context variables: {cluster_name}, {cluster_type}, {hub_title}, {attribute_terms}
+# - Content generation includes type-specific sections
+# If no blueprint_context:
+# - Run existing GenerateContent (unchanged)
+```
+
+**Stage 6 (NEW enhancement): Taxonomy Assignment**
+```python
+# After content generation, before image prompts:
+# If blueprint exists:
+# - Auto-assign content to correct custom taxonomies from blueprint
+# - Set sag_cluster_id on Content record
+# - Mark cluster status as 'partial' if first content piece
+```
+
+### 7.3 Backend: Enhanced Prompt Templates
+
+**Location:** Existing `PromptTemplate` model or defaults in code
+
+Add SAG-context prompt variants. These are stored in the same PromptTemplate system but selected based on content type:
+
+| Content Type | Structure | Prompt Template Key |
+|-------------|-----------|-------------------|
+| Cluster Hub Page | Guide Tutorial | `sag_hub_guide` |
+| Cluster Hub Page | Top Listicle | `sag_hub_listicle` |
+| Blog Post | Comparison | `sag_blog_comparison` |
+| Blog Post | Review | `sag_blog_review` |
+| Blog Post | How To | `sag_blog_howto` |
+| Blog Post | Question | `sag_blog_question` |
+| Attribute Term Page | Guide Tutorial | `sag_term_page` |
+| Product Page | Review | `sag_product_page` |
+| Service Page | Guide Tutorial | `sag_service_page` |
+
+Each prompt includes SAG context variables:
+```
+You are writing a {content_type} for the cluster "{cluster_name}".
+This cluster covers the intersection of {attribute_intersection}.
+The hub page for this cluster is: "{hub_page_title}" at {hub_page_url}.
+Related content in this cluster includes: {related_blogs}.
+This content should naturally reference these taxonomy terms: {attribute_terms}.
+```
+
+### 7.4 Frontend: Pipeline UI Shows Blueprint Context
+
+**Location:** `pages/Automation/` — existing pipeline monitoring view
+
+When a site has an active blueprint, the automation page shows:
+- Blueprint status badge: "SAG Blueprint Active (v1)"
+- Pipeline mode indicator: "Running in SAG Mode" vs "Running in Legacy Mode"
+- Stage 0 (Blueprint Check) appears as the first stage in the progress display
+
+**Location:** `pages/Writer/` — existing task and content views
+
+When viewing a task or content item that has `sag_cluster_id`:
+- Show cluster badge: "Cluster: Foot Massagers for Neuropathy"
+- Show type badge: "Type: Hub Page" or "Type: Supporting Blog"
+- Show blueprint context panel (collapsible): cluster type, attribute terms, related content links
+
+These are display-only enhancements to existing views — no new pages needed.
+
+---
+
+## 8. Phase 6: Taxonomy Creation Flow {#8-phase-6-taxonomy-creation-flow}
+
+### 8.1 What This Phase Delivers
+
+When a blueprint is confirmed, IGNY8 pushes taxonomy creation instructions to the WordPress plugin, which creates the actual WordPress custom taxonomies and terms.
+
+### 8.2 Backend: Taxonomy Payload Generator
+
+```
+sag/services/taxonomy_service.py # NEW
+```
+
+**Functions:**
+- `generate_taxonomy_payload(blueprint)` → JSON payload matching plugin's expected format
+- `send_taxonomy_payload(site, payload)` → POST to WordPress plugin endpoint
+- `handle_taxonomy_response(site, response)` → update SAGAttribute wp_sync_status
+- `check_taxonomy_status(site)` → GET current taxonomy state from plugin
+
+**Payload format:**
+```json
+{
+ "taxonomies": [
+ {
+ "slug": "target-area",
+ "label": "Target Area",
+ "description": "Primary body area the device targets",
+ "hierarchical": true,
+ "post_types": ["product", "post", "page"],
+ "terms": [
+ {"name": "Foot", "slug": "foot", "description": "Foot massagers and foot therapy devices"},
+ {"name": "Neck", "slug": "neck", "description": "Neck massagers and cervical therapy"}
+ ]
+ }
+ ]
+}
+```
+
+### 8.3 Plugin Side: Taxonomy Builder
+
+The WordPress plugin already has planned files for this:
+```
+igny8-plugin/includes/modules/sag/
+├── class-taxonomy-builder.php # Create WP taxonomies from payload
+├── class-term-builder.php # Create terms within taxonomies
+```
+
+Plugin endpoint: `POST /wp-json/igny8/v1/sag/create-taxonomies`
+- Receives payload from IGNY8 app
+- Registers taxonomies via `register_taxonomy()`
+- Creates terms via `wp_insert_term()`
+- Returns success with term IDs mapped to slugs
+- Stores taxonomy registrations in option for persistence across requests
+
+### 8.4 Backend: Integration with Existing Sync Architecture
+
+**Location:** `business/integration/` — extend existing sync services
+
+The taxonomy creation uses the same `Site.wp_api_key` authentication and webhook architecture that content publishing already uses. No new auth mechanism needed.
+
+**Flow:**
+```
+Blueprint confirmed
+ → sag/services/taxonomy_service.generate_taxonomy_payload()
+ → business/integration/sync_service.push_to_wordpress(site, '/sag/create-taxonomies', payload)
+ → Plugin creates taxonomies + terms
+ → Plugin POSTs response back to IGNY8 webhook
+ → sag/services/taxonomy_service.handle_taxonomy_response()
+ → SAGAttribute.wp_sync_status updated to 'synced'
+```
+
+### 8.5 Frontend: Taxonomy Sync Status
+
+**Location:** `pages/Settings/SiteSettings.tsx` — add SAG tab or extend existing integration tab
+
+Show:
+- List of attributes from blueprint
+- Each attribute: name, WP taxonomy slug, sync status (pending/synced/failed)
+- "Sync Taxonomies" button to retry failed syncs
+- This is visible after blueprint is confirmed (Phase 4) and site is connected to WordPress
+
+---
+
+## 9. Phase 7: Existing Site Analysis (Case 1) {#9-phase-7-existing-site-analysis}
+
+### 9.1 What This Phase Delivers
+
+For existing WordPress/WooCommerce sites, IGNY8 collects site data, AI extracts attributes from it, generates a gap analysis, and produces a blueprint.
+
+### 9.2 Backend: Extended Site Data Collection
+
+**Location:** Plugin already has site data collection:
+```
+igny8-plugin/data/site-collection.php # Collects post data, taxonomy data, product data
+igny8-plugin/data/semantic-mapping.php # Maps site content to semantic strategy
+```
+
+**Enhance plugin to collect additional data for SAG:**
+- All WooCommerce product attributes + values (pa_color, pa_size, custom attributes)
+- Product titles and descriptions (for AI attribute extraction)
+- Existing custom taxonomies with all terms
+- Navigation menu structure with hierarchy
+- Page templates in use
+
+**New plugin endpoint:** `GET /wp-json/igny8/v1/sag/site-analysis`
+Returns comprehensive site data package for AI analysis.
+
+### 9.3 Backend: AI Attribute Extraction (Case 1)
+
+**`sag/ai_functions/attribute_extraction.py` — `ExtractAttributes`**
+
+**Input:** raw site data (product titles, descriptions, categories, existing taxonomies, menu structure)
+**Output:** discovered attributes with values and confidence scores
+
+**Logic:**
+1. AI analyzes product/content titles for recurring patterns
+2. Cross-references against sector template (if exists) for validation
+3. Returns discovered attributes with frequency counts per value
+4. Flags low-confidence discoveries for user review
+
+### 9.4 Backend: Gap Analysis Service
+
+```
+sag/services/gap_analysis_service.py # NEW
+```
+
+**Functions:**
+- `analyze_gap(site_data, blueprint)` → comprehensive gap report
+- Gap report includes: missing cluster hubs, missing supporting content, products needing attribute enrichment, taxonomy terms without content, internal links missing
+
+### 9.5 Frontend: Case 1 Analysis UI
+
+**Location:** Accessed from Site Settings when a site is connected but has no blueprint
+
+```
+frontend/src/pages/Settings/
+└── components/
+ ├── SiteAnalysis.tsx # NEW — trigger and display site analysis
+ ├── DiscoveredAttributes.tsx # NEW — show AI-discovered attributes, user confirms/edits
+ ├── GapAnalysisReport.tsx # NEW — show gap analysis results
+ └── ProductAutoTagger.tsx # NEW — review and approve AI-generated product tags
+```
+
+**Flow:**
+1. User clicks "Analyze Site Structure" in Site Settings
+2. Loading state while plugin collects data and AI processes it
+3. DiscoveredAttributes screen: shows AI findings, user toggles/edits/confirms
+4. After confirmation → blueprint generates (same as Case 2 but with extracted data)
+5. GapAnalysisReport: shows what's missing vs what the blueprint recommends
+6. ProductAutoTagger: for e-commerce sites, review AI-suggested attribute assignments per product
+
+---
+
+## 10. Phase 8: Blueprint Health Monitoring {#10-phase-8-blueprint-health-monitoring}
+
+### 10.1 What This Phase Delivers
+
+Background monitoring that tracks blueprint completion, content coverage per cluster, link health, and overall SAG health score. Dashboard widgets surface this data.
+
+### 10.2 Backend: Health Service
+
+```
+sag/services/health_service.py # Already created in Phase 1, now implement
+```
+
+**`calculate_health_score(blueprint)`** returns 0-100 score based on:
+- Content completeness per cluster (hub exists? blogs published?) — 30 points
+- Taxonomy sync status (all taxonomies created?) — 15 points
+- Internal link coverage (from Linker module when active) — 20 points
+- Keyword coverage (keywords have matching content?) — 15 points
+- Unassigned content (pages/products not mapped to clusters) — 10 points
+- Overall structure balance (no cluster with 0 content while others have 5+) — 10 points
+
+### 10.3 Backend: Celery Tasks
+
+```
+sag/tasks.py # NEW
+```
+
+```python
+@shared_task
+def run_blueprint_health_check(site_id):
+ """Weekly health check for a site's active blueprint."""
+ site = Site.objects.get(id=site_id)
+ if not site.sag_blueprint_id:
+ return
+ blueprint = site.sag_blueprint
+ score = health_service.calculate_health_score(blueprint)
+ blueprint.sag_health_score = score
+ blueprint.last_health_check = now()
+ blueprint.save()
+
+@shared_task
+def check_blueprint_evolution_triggers(site_id):
+ """Check if blueprint needs evolution (new products, new keywords, etc.)."""
+ pass
+```
+
+**Register in Celery Beat schedule** (existing `celery.py` configuration):
+- `run_blueprint_health_check`: weekly for all sites with active blueprints
+- `check_blueprint_evolution_triggers`: weekly, same schedule
+
+### 10.4 Frontend: Dashboard Widgets
+
+**Location:** `components/dashboard/` — add new widgets alongside existing ones
+
+```
+frontend/src/components/dashboard/
+├── SAGHealthWidget.tsx # NEW — health score gauge, cluster completion bars
+├── BlueprintProgressWidget.tsx # NEW — content published vs planned per cluster
+```
+
+**SAGHealthWidget:**
+- Circular gauge showing overall health score (0-100)
+- Color: green (80+), yellow (50-79), red (<50)
+- Below gauge: quick stats (clusters complete, content published/planned, taxonomies synced)
+- Click → goes to blueprint detail page
+
+**BlueprintProgressWidget:**
+- Horizontal bar chart: each cluster as a row
+- Bar shows: published content / planned content
+- Color coding by cluster status: complete (green), partial (yellow), planned (gray)
+- Sorted by execution priority
+
+**Dashboard integration:**
+- Widgets only appear when site has an active blueprint
+- Add to existing dashboard grid alongside WorkflowPipelineWidget, AIOperationsWidget, etc.
+
+### 10.5 Frontend: Blueprint Management Page
+
+```
+frontend/src/pages/
+└── Blueprint/ # NEW page
+ ├── BlueprintOverview.tsx # Health score, cluster grid, quick actions
+ ├── ClusterDetail.tsx # Single cluster view: hub, supporting content, keywords, links
+ ├── AttributeManager.tsx # View/edit attributes, see taxonomy sync status
+ └── ExecutionPlan.tsx # Phase 1-4 execution plan, what to build next
+```
+
+**Sidebar addition:**
+```
+WORKFLOW
+ ├── Planner
+ ├── Writer
+ ├── Automation
+ ├── Blueprint (NEW — if site has active blueprint, always visible)
+ ├── Linker (if linker_enabled)
+ └── Optimizer (if optimizer_enabled)
+```
+
+---
+
+## 11. Phase 9: SAG Interlinking — Linker Module Evolution {#11-phase-9-sag-interlinking}
+
+### 11.1 What This Phase Delivers
+
+The existing Linker module (currently INACTIVE behind `linker_enabled` flag) evolves from generic content-similarity linking to SAG-aware deterministic linking. This implements Doc 3 — Interlinking Specification.
+
+### 11.2 Backend: New Models for Interlinking
+
+Add to `sag/models.py`:
+
+```python
+class SAGLink(AccountBaseModel):
+ """Individual internal link tracked by the SAG interlinking system."""
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ blueprint = models.ForeignKey(SAGBlueprint, on_delete=models.CASCADE, related_name='links')
+ source_content = models.ForeignKey('writer.Content', on_delete=models.CASCADE, related_name='outbound_sag_links')
+ target_content = models.ForeignKey('writer.Content', on_delete=models.CASCADE, null=True, blank=True, related_name='inbound_sag_links')
+ target_url = models.URLField(blank=True, help_text='For term pages or external targets')
+ link_type = models.CharField(max_length=30, choices=[
+ ('hub_upward', 'Supporting → Hub'),
+ ('hub_downward', 'Hub → Supporting'),
+ ('sibling', 'Sibling within cluster'),
+ ('cross_cluster', 'Cross-cluster hub ↔ hub'),
+ ('taxonomy_contextual', 'Term page → cluster hubs'),
+ ('breadcrumb', 'Breadcrumb structural'),
+ ('related_content', 'Related reading cross-cluster'),
+ ])
+ anchor_text = models.CharField(max_length=300)
+ placement_zone = models.CharField(max_length=30, choices=[
+ ('in_body', 'In Body'),
+ ('related_section', 'Related Section'),
+ ('breadcrumb', 'Breadcrumb'),
+ ('guide_contents', 'Guide Contents'),
+ ])
+ status = models.CharField(max_length=20, choices=[
+ ('planned', 'Planned'),
+ ('injected', 'Injected into content'),
+ ('published', 'Published on WordPress'),
+ ('broken', 'Broken'),
+ ('removed', 'Removed'),
+ ], default='planned')
+ score = models.FloatField(default=0.0)
+ injected_at = models.DateTimeField(null=True, blank=True)
+ created_at = models.DateTimeField(auto_now_add=True)
+
+class SAGLinkAudit(AccountBaseModel):
+ """Periodic link audit snapshot."""
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ blueprint = models.ForeignKey(SAGBlueprint, on_delete=models.CASCADE)
+ audit_date = models.DateTimeField(auto_now_add=True)
+ total_links = models.IntegerField(default=0)
+ missing_mandatory = models.IntegerField(default=0)
+ orphan_pages = models.IntegerField(default=0)
+ broken_links = models.IntegerField(default=0)
+ over_linked_pages = models.IntegerField(default=0)
+ cluster_scores = models.JSONField(default=dict)
+ recommendations = models.JSONField(default=list)
+```
+
+### 11.3 Backend: Linking Services
+
+```
+sag/services/linking_service.py # NEW
+```
+
+**Functions:**
+- `generate_links_for_content(content)` → creates SAGLink records for a newly generated content piece
+- `audit_cluster_links(cluster)` → score the cluster's link completeness (0-100)
+- `audit_site_links(blueprint)` → full site link audit
+- `find_missing_mandatory_links(blueprint)` → list of mandatory links that don't exist
+- `suggest_anchor_text(source_content, target_content, link_type)` → AI-generated anchor text variants
+
+**Link generation rules (from Doc 3):**
+
+| Link Type | Rule | Mandatory? | Max Count |
+|-----------|------|-----------|-----------|
+| hub_upward | Every supporting blog → its cluster hub | YES | 1 per blog |
+| hub_downward | Every hub → all its published supporting content | YES | All |
+| sibling | Supporting ↔ supporting within same cluster | No | 2 per article |
+| cross_cluster | Hub ↔ hub sharing attribute value | No | 2 per hub |
+| taxonomy_contextual | Term page → all hubs using that value | YES | All |
+| breadcrumb | Every page has breadcrumb path | YES | 1 chain |
+| related_content | Supporting → content in other clusters | No | 2-3 |
+
+### 11.4 Backend: Pipeline Integration (Stage 8)
+
+**Add Stage 8 to automation pipeline:**
+
+```python
+# business/automation/stages/stage_8_link_generation.py # NEW
+
+# After Stage 7 (images generated):
+# 1. Load blueprint context for this content
+# 2. Generate required SAGLink records per rules
+# 3. Inject link HTML into content body
+# 4. Content enters review queue with links already present
+```
+
+Modify `business/automation/pipeline.py` to include Stage 8 when `linker_enabled` AND blueprint exists.
+
+### 11.5 Frontend: Linker Page Evolution
+
+**Location:** `pages/Linker/` — existing but INACTIVE
+
+When `linker_enabled` is activated and blueprint exists, the Linker page shows:
+
+```
+frontend/src/pages/Linker/
+├── LinkerOverview.tsx # REPLACE existing — SAG link dashboard
+│ ├── ClusterLinkCoverage.tsx # Table: clusters × link scores
+│ ├── SiteLinkMap.tsx # Visual: clusters as nodes, links as edges
+│ ├── LinkAuditDashboard.tsx # Stats: total links, missing, broken, orphans
+│ └── GapAnalysisExport.tsx # Download link gap report
+├── LinkDetail.tsx # Single link view: source, target, anchor, status
+└── LinkAudit.tsx # Audit history with snapshots
+```
+
+### 11.6 Backend: Celery Tasks for Linking
+
+```python
+# sag/tasks.py — add:
+
+@shared_task
+def generate_links_for_published_content(content_id):
+ """After content publishes, generate/update SAG links."""
+ pass
+
+@shared_task
+def run_link_audit(blueprint_id):
+ """Weekly link audit for a blueprint."""
+ pass
+
+@shared_task
+def check_broken_links(blueprint_id):
+ """Check all published SAGLinks for broken targets."""
+ pass
+```
+
+---
+
+## 12. Phase 10: External Backlink Campaign Module {#12-phase-10-external-backlink-campaigns}
+
+### 12.1 What This Phase Delivers
+
+Automated backlink campaign generation from SAG blueprints. Implements Doc 4 — External Backlink Campaign Specification. New models, new UI, external API integrations (FatGrid, PR distribution).
+
+### 12.2 Backend: New Models
+
+Add to `sag/models.py`:
+
+```python
+class CountryMarketProfile(models.Model):
+ """Country-specific campaign parameters. Admin-editable."""
+ country_code = models.CharField(max_length=5, primary_key=True)
+ country_name = models.CharField(max_length=100)
+ competition_floor = models.CharField(max_length=20)
+ profile_data = models.JSONField(help_text='Full country profile: DR targets, budgets, link mix, anchor mix, velocity, quality thresholds, KPI milestones')
+ is_active = models.BooleanField(default=True)
+ updated_at = models.DateTimeField(auto_now=True)
+
+class SAGCampaign(AccountBaseModel):
+ """A backlink campaign generated from a SAG blueprint for a specific market."""
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ blueprint = models.ForeignKey(SAGBlueprint, on_delete=models.CASCADE, related_name='campaigns')
+ site = models.ForeignKey('auth.Site', on_delete=models.CASCADE)
+ country_code = models.CharField(max_length=5)
+ status = models.CharField(max_length=20, choices=[
+ ('draft', 'Draft'), ('active', 'Active'),
+ ('paused', 'Paused'), ('completed', 'Completed'),
+ ], default='draft')
+ tier_assignments = models.JSONField(default=dict, help_text='{content_id: tier}')
+ total_links_target = models.IntegerField(default=0)
+ total_budget_estimate = models.JSONField(default=dict, help_text='{min: X, max: Y}')
+ timeline_months = models.IntegerField(default=0)
+ monthly_plan = models.JSONField(default=list)
+ anchor_text_plan = models.JSONField(default=dict)
+ current_month = models.IntegerField(default=0)
+ kpi_data = models.JSONField(default=dict)
+ started_at = models.DateTimeField(null=True, blank=True)
+ completed_at = models.DateTimeField(null=True, blank=True)
+
+class SAGBacklink(AccountBaseModel):
+ """Individual backlink tracked within a campaign."""
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ blueprint = models.ForeignKey(SAGBlueprint, on_delete=models.CASCADE)
+ campaign = models.ForeignKey(SAGCampaign, on_delete=models.CASCADE, related_name='backlinks')
+ target_content = models.ForeignKey('writer.Content', on_delete=models.CASCADE, null=True, blank=True)
+ target_url = models.URLField()
+ target_tier = models.CharField(max_length=5)
+ source_url = models.URLField(blank=True)
+ source_domain = models.CharField(max_length=200, blank=True)
+ source_dr = models.IntegerField(null=True, blank=True)
+ source_traffic = models.IntegerField(null=True, blank=True)
+ anchor_text = models.CharField(max_length=300, blank=True)
+ anchor_type = models.CharField(max_length=30, blank=True)
+ link_type = models.CharField(max_length=30, blank=True)
+ marketplace = models.CharField(max_length=100, blank=True)
+ cost = models.DecimalField(max_digits=10, decimal_places=2, default=0)
+ quality_score = models.FloatField(default=0.0)
+ country_relevant = models.BooleanField(default=False)
+ date_built = models.DateField(null=True, blank=True)
+ date_live = models.DateField(null=True, blank=True)
+ date_last_checked = models.DateField(null=True, blank=True)
+ status = models.CharField(max_length=20, choices=[
+ ('ordered', 'Ordered'), ('pending', 'Pending'), ('live', 'Live'),
+ ('dead', 'Dead'), ('removed', 'Removed'), ('replaced', 'Replaced'),
+ ], default='ordered')
+ notes = models.TextField(blank=True)
+
+class SAGCampaignSnapshot(models.Model):
+ """Monthly KPI snapshot for a campaign."""
+ id = models.UUIDField(primary_key=True, default=uuid4)
+ campaign = models.ForeignKey(SAGCampaign, on_delete=models.CASCADE, related_name='snapshots')
+ snapshot_date = models.DateField()
+ kpi_values = models.JSONField(help_text='All 18+ KPI metrics for this month')
+ comparison_to_previous = models.JSONField(default=dict)
+```
+
+### 12.3 Backend: Campaign Services
+
+```
+sag/services/campaign_service.py # NEW
+```
+
+**Functions:**
+- `generate_campaign(blueprint, country_code, budget_override=None)` → creates SAGCampaign with full plan
+- `assign_tiers(blueprint, clusters)` → auto-classify pages into T1-T5
+- `generate_monthly_plan(campaign)` → month-by-month execution plan
+- `generate_anchor_text_plan(campaign)` → pre-generated anchors per target page
+- `calculate_budget(campaign)` → budget estimate from link counts × cost ranges
+- `detect_tipping_point(campaign)` → check if authority tipping point indicators are met
+
+### 12.4 Backend: External API Integrations
+
+```
+sag/integrations/ # NEW
+├── __init__.py
+├── fatgrid.py # FatGrid API client (publisher discovery, pricing)
+├── pr_distribution.py # PRNews.io / EIN Presswire / Linking News
+└── ahrefs.py # Ahrefs API (DR/DA tracking, lost links)
+```
+
+These integrations are optional — campaigns can be generated and tracked without them. The APIs enrich the campaign with real marketplace data and automated monitoring.
+
+### 12.5 Frontend: Campaign UI
+
+```
+frontend/src/pages/
+└── Campaigns/ # NEW page (or sub-page of Linker)
+ ├── CampaignOverview.tsx # Campaign dashboard: progress, budget, current month
+ ├── CampaignGenerator.tsx # Generate new campaign wizard
+ ├── MonthlyPlan.tsx # This month's targets vs actual
+ ├── LinkTracker.tsx # Filterable table of all backlinks
+ ├── TierBreakdown.tsx # T1-T5 progress visualization
+ ├── KPIDashboard.tsx # Monthly trend charts (DR, traffic, keywords)
+ ├── TippingPointDetector.tsx # Authority tipping point indicators
+ └── LinkOpportunities.tsx # FatGrid publisher search (if integrated)
+```
+
+**Sidebar addition:**
+```
+WORKFLOW
+ ├── Planner
+ ├── Writer
+ ├── Automation
+ ├── Blueprint
+ ├── Linker (internal links)
+ ├── Campaigns (NEW — external backlink campaigns, if campaign_enabled)
+ └── Optimizer
+```
+
+**Feature flag:** `campaign_enabled` — follows same pattern as `linker_enabled` via GlobalModuleSettings.
+
+---
+
+## 13. Frontend Navigation — Updated Sidebar {#13-frontend-navigation--ui-map}
+
+After all SAG phases are complete, the sidebar becomes:
+
+```
+Dashboard (with SAG health + blueprint progress widgets)
+SETUP
+ ├── Add Keywords (now shows "optional" when blueprint active)
+ ├── Content Settings
+ ├── Sites (setup wizard now includes Step 3 Site Builder)
+ └── Thinker (admin only)
+WORKFLOW
+ ├── Planner (Keywords → Clusters → Ideas — enhanced with blueprint source)
+ ├── Writer (Queue → Drafts → Images → Review → Published — shows cluster context)
+ ├── Automation (7→8 stages when linker active, SAG mode indicator)
+ ├── Blueprint (NEW — health, clusters, attributes, execution plan)
+ ├── Linker (SAG-aware internal linking — when linker_enabled)
+ ├── Campaigns (External backlink campaigns — when campaign_enabled)
+ └── Optimizer (when optimizer_enabled)
+ACCOUNT
+ ├── Account Settings
+ ├── Plans & Billing
+ ├── Usage
+ └── AI Models (admin only)
+ADMIN (admin only)
+ └── Sector Templates (manage attribute templates)
+HELP
+ └── Help & Docs
+```
+
+---
+
+## 14. API Endpoint Registry {#14-api-endpoint-registry}
+
+Complete list of new API endpoints introduced across all phases:
+
+### SAG Core (Phase 1-3)
+```
+GET /api/v1/sag/blueprints/ # List blueprints for current site
+POST /api/v1/sag/blueprints/ # Create blueprint (admin/internal)
+GET /api/v1/sag/blueprints/{id}/ # Blueprint detail with attributes + clusters
+POST /api/v1/sag/blueprints/{id}/confirm/ # Draft → Active
+POST /api/v1/sag/blueprints/{id}/archive/ # Active → Archived
+POST /api/v1/sag/blueprints/{id}/regenerate/ # Create new version
+GET /api/v1/sag/blueprints/{id}/health_check/ # Run health check
+GET /api/v1/sag/attributes/ # List attributes for current blueprint
+GET /api/v1/sag/clusters/ # List clusters for current blueprint
+GET /api/v1/sag/clusters/{id}/ # Cluster detail with keywords, content, links
+GET /api/v1/sag/templates/ # Admin: list sector templates
+POST /api/v1/sag/templates/ # Admin: create template
+PUT /api/v1/sag/templates/{id}/ # Admin: update template
+```
+
+### Site Builder Wizard (Phase 4)
+```
+POST /api/v1/sag/wizard/generate-attributes/ # Industry+Sectors → attribute framework
+POST /api/v1/sag/wizard/populate-attributes/ # Attributes+BusinessData → populated attributes
+POST /api/v1/sag/wizard/generate-blueprint/ # Populated attributes → full blueprint
+POST /api/v1/sag/wizard/confirm-blueprint/ # Blueprint → active, trigger taxonomy creation
+```
+
+### Existing Site Analysis (Phase 7)
+```
+POST /api/v1/sag/analysis/extract-attributes/ # Site data → discovered attributes
+POST /api/v1/sag/analysis/generate-gap-report/ # Blueprint + site data → gap report
+POST /api/v1/sag/analysis/auto-tag-products/ # AI product attribute assignment
+```
+
+### Interlinking (Phase 9)
+```
+GET /api/v1/sag/links/ # List all SAG links for blueprint
+POST /api/v1/sag/links/generate/ # Generate links for content
+GET /api/v1/sag/links/audit/ # Run link audit
+GET /api/v1/sag/links/audit/history/ # Audit snapshots
+GET /api/v1/sag/links/missing/ # Missing mandatory links
+```
+
+### Backlink Campaigns (Phase 10)
+```
+GET /api/v1/sag/campaigns/ # List campaigns
+POST /api/v1/sag/campaigns/generate/ # Generate campaign from blueprint + country
+GET /api/v1/sag/campaigns/{id}/ # Campaign detail
+PATCH /api/v1/sag/campaigns/{id}/ # Update status, adjust plan
+GET /api/v1/sag/campaigns/{id}/monthly/ # Current month plan
+GET /api/v1/sag/campaigns/{id}/kpi/ # KPI dashboard data
+GET /api/v1/sag/campaigns/{id}/tipping-point/ # Tipping point indicators
+GET /api/v1/sag/backlinks/ # List all backlinks for campaign
+POST /api/v1/sag/backlinks/ # Log new backlink
+PATCH /api/v1/sag/backlinks/{id}/ # Update backlink status
+GET /api/v1/sag/countries/ # List country market profiles
+GET /api/v1/sag/fatgrid/search/ # FatGrid publisher search (proxy)
+```
+
+---
+
+## 15. AI Function Registry {#15-ai-function-registry}
+
+New AI functions to register in `ai/registry.py`:
+
+| Function Key | Location | Input | Output |
+|-------------|----------|-------|--------|
+| `discover_sector_attributes` | `sag/ai_functions/attribute_discovery.py` | Industry, sector, site_type | Attribute framework JSON |
+| `extract_site_attributes` | `sag/ai_functions/attribute_extraction.py` | Raw site data | Discovered attributes with confidence |
+| `populate_attributes` | `sag/ai_functions/attribute_population.py` | Attributes + business data | Populated attribute values |
+| `form_clusters` | `sag/ai_functions/cluster_formation.py` | Populated attributes, sector | Clusters with types |
+| `generate_keywords` | `sag/ai_functions/keyword_generation.py` | Clusters + templates | Per-cluster keyword arrays |
+| `plan_content` | `sag/ai_functions/content_planning.py` | Clusters + keywords + existing content | Content ideas with Structure + Type |
+| `generate_anchor_text` | `sag/ai_functions/anchor_text.py` | Source, target, link_type, cluster | Anchor text variants |
+
+All functions use the existing `AIEngine → Function → Provider` pattern. They're registered the same way as `AutoClusterKeywords` and `GenerateContentIdeas`.
+
+---
+
+## 16. Celery Task Registry {#16-celery-task-registry}
+
+New periodic and on-demand tasks:
+
+| Task | Schedule | Trigger | Location |
+|------|----------|---------|----------|
+| `run_blueprint_health_check` | Weekly (Celery Beat) | Also manual from dashboard | `sag/tasks.py` |
+| `check_blueprint_evolution_triggers` | Weekly (Celery Beat) | — | `sag/tasks.py` |
+| `generate_links_for_published_content` | On demand | After content publishes | `sag/tasks.py` |
+| `run_link_audit` | Weekly (Celery Beat) | Also manual from Linker | `sag/tasks.py` |
+| `check_broken_links` | Weekly (Celery Beat) | — | `sag/tasks.py` |
+| `check_backlink_status` | Weekly (Celery Beat) | — | `sag/tasks.py` |
+| `generate_campaign_snapshot` | Monthly (Celery Beat) | — | `sag/tasks.py` |
+| `detect_tipping_point` | Monthly (Celery Beat) | After snapshot | `sag/tasks.py` |
+
+---
+
+## 17. Feature Flag Registry {#17-feature-flag-registry}
+
+| Flag | Controls | Default | Phase |
+|------|---------|---------|-------|
+| `sag_enabled` | Blueprint generation, wizard Step 3, blueprint-aware pipeline | `False` | Phase 1 |
+| `linker_enabled` | Linker module, SAG link generation, link audit | `False` (exists) | Phase 9 |
+| `campaign_enabled` | External backlink campaigns, FatGrid integration | `False` | Phase 10 |
+
+All flags follow existing pattern: `GlobalModuleSettings` (platform-wide) + `ModuleEnableSettings` (per-account). Checked in sidebar rendering and API permission classes.
+
+When `sag_enabled` is `False`:
+- Setup wizard skips Step 3 (current behavior preserved)
+- Pipeline runs in legacy mode (current behavior preserved)
+- Blueprint page hidden from sidebar
+- All SAG API endpoints return 403
+
+---
+
+## 18. Cross-Reference: What Feeds What {#18-cross-reference}
+
+```
+SectorAttributeTemplate
+ └── feeds → Blueprint generation (Layer 1 attributes)
+
+SAGBlueprint
+ ├── feeds → Content pipeline (idea generation, task context, type-specific prompts)
+ ├── feeds → Taxonomy creation (plugin creates WP taxonomies)
+ ├── feeds → Linker module (link rules derived from cluster structure)
+ ├── feeds → Campaign module (tier assignments from cluster types + keyword volumes)
+ └── feeds → Health monitoring (completeness tracking)
+
+SAGCluster
+ ├── feeds → Content Ideas (hub + supporting content per cluster)
+ ├── feeds → Keywords (auto-generated from attribute intersections)
+ ├── feeds → Internal links (hub↔supporting, cross-cluster, taxonomy contextual)
+ └── feeds → Backlink tiers (T1-T5 assignment based on cluster type + volume)
+
+SAGLink
+ ├── feeds → Content HTML (links injected before publish)
+ ├── feeds → Link audit (health scores, gap analysis)
+ └── feeds → Blueprint health score (link coverage component)
+
+SAGCampaign
+ ├── feeds → KPI dashboard (monthly snapshots, trend charts)
+ ├── feeds → Tipping point detection (compares metrics vs country thresholds)
+ └── feeds → Blueprint health score (backlink coverage component)
+
+GSC Data (from Consolidated Module Plans — separate implementation)
+ ├── feeds → Campaign KPI dashboard (organic traffic, keywords, impressions)
+ ├── feeds → Tipping point detection (pages ranking without backlinks)
+ └── feeds → Blueprint health (indexed pages, crawl status)
+```
+
+---
+
+## Reference Documents
+
+This guide draws from and should be used alongside:
+
+| Document | Purpose | Location |
+|----------|---------|----------|
+| **SAG-Master-Document.md** | Pure SAG methodology — clustering rules, dimensional philosophy | Project knowledge |
+| **SAG-IGNY8-Implementation.md** | Three-layer architecture, two entry scenarios, data models, pipeline integration | Project knowledge |
+| **SAG-Doc3-Interlinking-Specification-PLAN.md** | Internal linking rules, 7 link types, authority flow, scoring | Project knowledge |
+| **SAG-Doc4-External-Backlink-Campaign-PLAN.md** | Campaign generation, country profiles, FatGrid/PR integration, KPI tracking | Project knowledge |
+| **IGNY8-Current-State.md** | Complete current platform state — all file paths, models, modules, navigation | Project knowledge |
+| **SAG-Niche-Definition-Process.docx** | Cluster formation rules, max 50 clusters, hub + supporting structure | Project knowledge |
+| **IGNY8-Industry-Sector-Master-List.md** | All industries and sectors in IGNY8 | Project knowledge |
+| **SAGIndustry01HealthcareMedical.xlsx** | Reference template format for sector attribute frameworks | Project knowledge |
+
+---
+
+*End of Doc A — SAG Architecture Development Guide*
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocB-Platform-Modules-Dev-Guide.md b/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocB-Platform-Modules-Dev-Guide.md
new file mode 100644
index 00000000..04385add
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocB-Platform-Modules-Dev-Guide.md
@@ -0,0 +1,1700 @@
+# Doc B — IGNY8 Platform Modules: Development Guide for Claude Code
+
+**Version:** 1.0
+**Date:** March 2026
+**For:** Claude Code (Opus 4.6) in VSCode on IGNY8 repo
+**Purpose:** Step-by-step implementation guide for all IGNY8 platform module enhancements — Content Types Writing, Taxonomy & Term Content, Optimizer, GSC Integration, Rich Schema & SERP Enhancement, Socializer, and Video Creator
+**Rule:** Nothing currently working breaks. All new functionality uses the existing pipeline pattern. All new modules use feature flags. Existing Writer/Planner/Automation pages are enhanced, not replaced.
+**Dependency:** Doc A (SAG Architecture) provides the blueprint, cluster, and attribute data that several modules here consume. Content Types Writing and Taxonomy & Term Content should ideally complete before Optimizer, but GSC and Rich Schema can run in parallel.
+
+---
+
+## Table of Contents
+
+1. [System Context — Current Pipeline & Module Structure](#1-system-context)
+2. [Implementation Sequence](#2-implementation-sequence)
+3. [Module 1: Content Types Writing](#3-content-types-writing)
+4. [Module 2: Taxonomy & Term Content](#4-taxonomy--term-content)
+5. [Module 3: Optimizer Module](#5-optimizer-module)
+6. [Module 4: GSC Integration](#6-gsc-integration)
+7. [Module 5: Rich Schema & SERP Enhancement](#7-rich-schema)
+8. [Module 6: Socializer](#8-socializer)
+9. [Module 7: Video Creator](#9-video-creator)
+10. [Updated Automation Pipeline — All Stages](#10-updated-automation-pipeline)
+11. [Updated Navigation & Sidebar](#11-updated-navigation)
+12. [Complete API Endpoint Registry](#12-api-endpoints)
+13. [Complete AI Function Registry](#13-ai-functions)
+14. [Complete Celery Task Registry](#14-celery-tasks)
+15. [Feature Flag Registry](#15-feature-flags)
+16. [Credit Cost Summary](#16-credit-costs)
+17. [Cross-Module Dependencies](#17-cross-dependencies)
+
+---
+
+## 1. System Context — Current Pipeline & Module Structure {#1-system-context}
+
+### 1.1 Current Content Pipeline (What Exists)
+
+```
+Stage 1: Process New Keywords → modules/planner/ + business/planning/
+Stage 2: AI Cluster Keywords → ai/functions/auto_cluster.py
+Stage 3: Generate Content Ideas → ai/functions/generate_ideas.py + modules/planner/
+Stage 4: Create Writer Tasks → modules/writer/
+Stage 5: Generate Article Content → ai/functions/generate_content.py + business/content/
+Stage 6: Extract Image Prompts → ai/functions/generate_image_prompts.py
+Stage 7: Generate Images → ai/functions/generate_images.py → Review Queue
+```
+
+All stages execute via Celery tasks defined in `tasks/`. Automation orchestration lives in `business/automation/`. Configuration per site is in `AutomationConfig`.
+
+### 1.2 Current Content Model Fields (Relevant)
+
+```python
+# modules/writer/models.py — Content model (simplified)
+class Content(SiteSectorBaseModel):
+ task = ForeignKey(Tasks)
+ title = CharField()
+ slug = SlugField()
+ content = TextField() # Full HTML
+ meta_title = CharField()
+ meta_description = TextField()
+ status = CharField() # queue, draft, review, published
+ content_type = CharField() # Currently: 'post', 'page'
+ word_count = IntegerField()
+ # ... images, keywords, publishing fields
+```
+
+### 1.3 Current Inactive Modules
+
+| Module | Backend | API | Frontend | Flag |
+|--------|---------|-----|----------|------|
+| Linker | `business/linking/` | `modules/linker/` | `pages/Linker/`, `api/linker.api.ts` | `linker_enabled` |
+| Optimizer | `business/optimization/` | `modules/optimizer/` | `pages/Optimizer/`, `api/optimizer.api.ts` | `optimizer_enabled` |
+
+### 1.4 Existing Prompt System
+
+Prompts are stored in `PromptTemplate` model or defaults in code. Templates exist for: `auto_cluster`, `generate_ideas`, `generate_content`, `generate_image_prompts`, `optimize_content` (pending). Users customize via Settings → Prompts (Thinker module).
+
+### 1.5 Existing Integration Architecture
+
+WordPress communication uses:
+- `Site.wp_api_key` for authentication
+- Webhook endpoints for sync (plugin → IGNY8 and IGNY8 → plugin)
+- `business/integration/` for sync services
+- `modules/integration/` for API endpoints
+- Plugin file: `data/site-collection.php` for data gathering
+
+### 1.6 Existing Credit System
+
+All AI operations deduct credits via `CreditService.check_credits()` → execute → `CreditService.deduct_credits_for_operation()`. Costs configured per model in `AIModelConfig`.
+
+---
+
+## 2. Implementation Sequence {#2-implementation-sequence}
+
+```
+MODULE 1 ─── Content Types Writing (FIRST — foundation for all others)
+ │ Extends Writer pipeline with new content types and structures.
+ │ No new module — enhances existing Planner + Writer + Publisher.
+ │
+MODULE 2 ─── Taxonomy & Term Content
+ │ Depends on Module 1 for content structures.
+ │ Requires taxonomy sync restoration.
+ │ Enhances Planner + Writer + Publisher + Integration.
+ │
+MODULE 3 ─── Optimizer (activate existing module)
+ │ Depends on Module 1+2 for content type support.
+ │ Benefits from SAG cluster mapping (Doc A Phase 5).
+ │ Activates optimizer_enabled flag.
+ │
+MODULE 4 ─── GSC Integration (CAN PARALLEL with 1-3)
+ │ Independent of content pipeline changes.
+ │ New module entirely: OAuth, URL Inspection, metrics.
+ │
+MODULE 5 ─── Rich Schema & SERP Enhancement (CAN PARALLEL with 4)
+ │ Enhances content pipeline Stage 5 + adds retroactive engine.
+ │ Benefits from Module 1 (content type classification).
+ │
+MODULE 6 ─── Socializer
+ │ Depends on published content (any type from Module 1+2).
+ │ New module: OAuth, platform connections, scheduling.
+ │ New automation Stage 8.
+ │
+MODULE 7 ─── Video Creator
+ Depends on Module 6 infrastructure (OAuth, scheduling, media storage).
+ New module: script generation, TTS, video assembly.
+ New automation Stage 9.
+```
+
+**Parallel tracks:**
+- GSC (Module 4) is fully independent — start anytime
+- Rich Schema (Module 5) can start alongside GSC
+- Socializer OAuth/platform connections can start while earlier modules finish
+
+---
+
+## 3. Module 1: Content Types Writing {#3-content-types-writing}
+
+### 3.1 What This Module Delivers
+
+IGNY8 currently writes blog posts (`content_type='post'`). This module extends the Writer to produce pages, products (WooCommerce), services, company pages, taxonomy landing pages, and cluster hub pages — all through the same pipeline.
+
+### 3.2 Backend: Content Type Expansion
+
+**Modify:** `modules/writer/models.py` — extend `content_type` choices on Content model
+
+```python
+# Add new choices to Content.content_type:
+CONTENT_TYPE_CHOICES = [
+ ('post', 'Blog Post'), # Existing
+ ('page', 'Page'), # Existing (limited use)
+ ('product', 'Product Page'), # NEW
+ ('service', 'Service Page'), # NEW
+ ('company_page', 'Company Page'), # NEW
+ ('taxonomy_landing', 'Taxonomy Landing'), # NEW
+ ('cluster_hub', 'Cluster Hub Page'), # NEW
+ ('comparison', 'Comparison Page'), # NEW
+ ('brand_page', 'Brand Page'), # NEW
+]
+```
+
+**Add new field:** `content_structure` on Content model (or extend existing structure field)
+
+```python
+# Add to Content model:
+content_structure = models.CharField(
+ max_length=30, null=True, blank=True,
+ choices=[
+ # Blog structures (existing, now explicit)
+ ('guide_tutorial', 'Guide/Tutorial'),
+ ('comparison', 'Comparison'),
+ ('review', 'Review'),
+ ('how_to', 'How To'),
+ ('question', 'Question/Answer'),
+ ('top_listicle', 'Top Listicle'),
+ # Page structures (NEW)
+ ('landing_page', 'Landing Page'),
+ ('about_page', 'About Page'),
+ ('contact_page', 'Contact Page'),
+ # Product structures (NEW)
+ ('product_single', 'Single Product'),
+ ('product_collection', 'Product Collection'),
+ # Service structures (NEW)
+ ('service_single', 'Single Service'),
+ ('service_area', 'Service Area Page'),
+ # Company structures (NEW)
+ ('company_about', 'Company About'),
+ ('company_team', 'Company Team'),
+ ('company_careers', 'Company Careers'),
+ # Taxonomy structures (NEW)
+ ('category_archive', 'Category Archive'),
+ ('tag_archive', 'Tag Archive'),
+ ('attribute_archive', 'Attribute Archive'),
+ ('cluster_hub', 'Cluster Hub'),
+ ]
+)
+```
+
+**Modify:** `modules/planner/models.py` — extend ContentIdea model with same fields
+
+```python
+# Add to ContentIdea model:
+content_type = models.CharField(max_length=30, null=True, blank=True) # Same choices as Content
+content_structure = models.CharField(max_length=30, null=True, blank=True)
+```
+
+**Modify:** `modules/writer/models.py` — extend Tasks model
+
+```python
+# Add to Tasks model:
+content_type = models.CharField(max_length=30, default='post')
+content_structure = models.CharField(max_length=30, null=True, blank=True)
+```
+
+### 3.3 Backend: Type-Specific Prompt Templates
+
+**Location:** Add to existing PromptTemplate system or as defaults in `ai/functions/generate_content.py`
+
+Each content_type × content_structure combination gets a distinct prompt. The prompt includes type-specific section requirements:
+
+| Content Type | Required Sections in Prompt |
+|-------------|---------------------------|
+| **product** | Features/benefits, specs table, comparison to alternatives, FAQs, CTA, product schema placeholders |
+| **service** | Service overview, process steps, outcomes/results, FAQs, local SEO sections (if location-based), CTA |
+| **company_page** | Brand mission/values, history, team bios (if team page), FAQ, media/press block |
+| **taxonomy_landing** | Intro + topical definition, key subtopics with internal link placeholders, related items, FAQ section |
+| **cluster_hub** | Comprehensive guide introduction, section per supporting topic, product/service roundup, FAQ, internal linking sections |
+| **comparison** | Head-to-head comparison table, pros/cons per item, winner recommendation, FAQ |
+
+**Register new prompt templates:**
+```python
+# In PromptTemplate seeding or defaults:
+'generate_content_product' # Product page prompt
+'generate_content_service' # Service page prompt
+'generate_content_company' # Company page prompt
+'generate_content_taxonomy_landing' # Taxonomy landing prompt
+'generate_content_cluster_hub' # Cluster hub prompt
+'generate_content_comparison' # Comparison page prompt
+```
+
+### 3.4 Backend: Type-Specific Idea Generation
+
+**Modify:** `ai/functions/generate_ideas.py` — enhance `GenerateContentIdeas`
+
+When generating ideas, the system now considers content_type:
+- Product ideas: features/specs/benefits angle, "Best X for Y" format
+- Service ideas: process/outcomes angle, "How [Service] Works" format
+- Company page ideas: mission/team/careers angle
+- Taxonomy landing ideas: topical overview, "Complete Guide to [Term]" format
+
+The existing function stays but gets an additional parameter: `target_content_type`. If provided, idea generation is type-aware. If not provided (legacy), defaults to blog post ideas.
+
+### 3.5 Backend: Publishing Enhancement
+
+**Modify:** `business/publishing/` — extend publishing to handle content types
+
+```python
+# business/publishing/wordpress_publisher.py — extend publish logic:
+
+def publish_content(content):
+ if content.content_type == 'post':
+ # Existing: publish as WordPress post
+ pass
+ elif content.content_type == 'page':
+ # Publish as WordPress page
+ pass
+ elif content.content_type == 'product':
+ # Publish as WooCommerce product (requires WooCommerce API)
+ pass
+ elif content.content_type == 'service':
+ # Publish as custom post type 'service' (requires theme/plugin CPT)
+ pass
+ elif content.content_type == 'taxonomy_landing':
+ # Publish as term description content (Module 2 handles this)
+ pass
+ elif content.content_type == 'cluster_hub':
+ # Publish as WordPress page with hub template
+ pass
+```
+
+**Plugin side:** The IGNY8 Bridge plugin needs enhanced content receiving:
+```
+igny8-plugin/includes/modules/content-sync/
+├── class-content-mapper.php # MODIFY: map IGNY8 content_type to WP post type
+```
+
+Mapping:
+| IGNY8 content_type | WordPress post_type | Template |
+|-------------------|--------------------|---------|
+| post | post | Standard |
+| page | page | Default page |
+| product | product (WooCommerce) | Product template |
+| service | service (CPT from theme) | Service template |
+| company_page | page | Company page template |
+| taxonomy_landing | term description | Term archive template |
+| cluster_hub | page | Hub page template |
+| comparison | post | Standard (with comparison CSS) |
+
+### 3.6 Frontend: Writer UI Enhancement
+
+**Location:** `pages/Writer/` — enhance existing views
+
+**Task Creation — Add content type selector:**
+```
+pages/Writer/
+├── components/
+│ ├── TaskCreationForm.tsx # MODIFY: add content_type dropdown + content_structure dropdown
+│ └── ContentTypeSelector.tsx # NEW: visual card selector for content type
+```
+
+When creating a new task (manual mode), user sees:
+- Content Type dropdown: Blog Post, Page, Product, Service, Company Page, Taxonomy Landing, Cluster Hub, Comparison
+- Content Structure dropdown: dynamically filtered based on content_type selection
+- Existing fields (title, keywords, cluster, sector) remain unchanged
+
+**Content List — Show type badge:**
+```
+pages/Writer/
+├── components/
+│ └── ContentListItem.tsx # MODIFY: add content_type badge next to title
+```
+
+Each content item in Queue/Drafts/Review/Published shows a small badge: "Post", "Product", "Hub", "Service", etc.
+
+**Ideas List — Show type:**
+```
+pages/Planner/
+├── components/
+│ └── IdeaListItem.tsx # MODIFY: show content_type and content_structure
+```
+
+### 3.7 Frontend: No New Pages
+
+Module 1 adds NO new pages to the sidebar. Everything happens within existing Planner and Writer pages. The changes are:
+- Dropdowns added to task creation
+- Badges added to list items
+- Type-specific preview in content review
+
+---
+
+## 4. Module 2: Taxonomy & Term Content {#4-taxonomy--term-content}
+
+### 4.1 What This Module Delivers
+
+Every taxonomy term (WordPress categories, tags, WooCommerce product categories/attributes, custom taxonomies from SAG) becomes a rich SEO landing page generated through the same pipeline as posts.
+
+### 4.2 Backend: Restore Taxonomy Sync
+
+**Current state:** Taxonomy sync was partially implemented then removed ("legacy removed"). `ContentTaxonomy` model exists. WordPress client knows how to fetch categories/tags/WooCommerce attributes.
+
+**Restore and enhance in:** `business/integration/`
+
+```python
+# business/integration/taxonomy_sync_service.py # RESTORE/REWRITE
+
+class TaxonomySyncService:
+ def sync_taxonomies(self, site):
+ """Fetch all taxonomies + terms from WordPress and sync to ContentTaxonomy."""
+ # 1. Fetch via plugin API: categories, tags, WooCommerce product_cat,
+ # product_tag, all pa_* attributes, custom taxonomies (from SAG)
+ # 2. Create/update ContentTaxonomy records
+ # 3. Map terms to clusters where possible (using SAG blueprint if active)
+ pass
+
+ def publish_term_content(self, content_taxonomy, content):
+ """Push generated content back to WordPress term description."""
+ # 1. Content → term description HTML
+ # 2. POST to plugin endpoint: /wp-json/igny8/v1/terms/{term_id}/content
+ # 3. Update ContentTaxonomy sync status
+ pass
+```
+
+**Plugin endpoint needed:**
+```
+POST /wp-json/igny8/v1/terms/{term_id}/content
+Body: {description: "HTML content", meta: {igny8_term_content, igny8_term_faq, ...}}
+```
+
+### 4.3 Backend: Term-to-Cluster Mapping Service
+
+```python
+# business/planning/cluster_mapping_service.py # NEW
+
+class ClusterMappingService:
+ def map_term_to_cluster(self, term_name, term_description, site):
+ """Match a taxonomy term to the best SAG cluster."""
+ # If SAG blueprint active: match term to cluster by attribute value overlap
+ # If no blueprint: use AI semantic similarity to existing clusters
+ # Return: cluster_id, confidence_score
+ pass
+
+ def bulk_map_terms(self, terms, site):
+ """Map all terms for a site to clusters."""
+ pass
+```
+
+### 4.4 Backend: Term Content Generation
+
+The key insight: term content generation follows the SAME pipeline as post content. The difference is in content_type and publishing destination.
+
+**Idea generation for terms:**
+```python
+# business/planning/ — extend idea generation
+
+def generate_term_ideas(site, terms):
+ """For each taxonomy term without content, create a ContentIdea."""
+ for term in terms:
+ idea = ContentIdea(
+ title=f"Complete Guide to {term.name}",
+ content_type='taxonomy_landing',
+ content_structure='category_archive', # or tag_archive, attribute_archive
+ cluster=term.mapped_cluster,
+ idea_source='sag_blueprint' if site.sag_blueprint_id else 'keyword_clustering',
+ # ... sector, keywords
+ )
+```
+
+**Task creation and content generation** use the same pipeline as Module 1 — the content_type='taxonomy_landing' selects the appropriate prompt template.
+
+**Publishing** goes to term description instead of post content (handled by `TaxonomySyncService.publish_term_content()`).
+
+### 4.5 Backend: ContentTaxonomy Model Enhancement
+
+**Modify:** existing `ContentTaxonomy` model (if it exists) or create:
+
+```python
+# modules/planner/models.py or modules/integration/models.py
+
+class ContentTaxonomy(SiteSectorBaseModel):
+ # Existing fields...
+ external_taxonomy = models.CharField(max_length=100) # 'category', 'post_tag', 'pa_color', etc.
+ external_term_id = models.IntegerField()
+ name = models.CharField(max_length=200)
+ slug = models.SlugField(max_length=200)
+ description = models.TextField(blank=True)
+ parent_term_id = models.IntegerField(null=True, blank=True)
+ post_count = models.IntegerField(default=0)
+
+ # NEW fields:
+ mapped_cluster_id = models.ForeignKey('sag.SAGCluster', null=True, blank=True, on_delete=models.SET_NULL)
+ has_generated_content = models.BooleanField(default=False)
+ generated_content_id = models.ForeignKey('writer.Content', null=True, blank=True, on_delete=models.SET_NULL)
+ content_sync_status = models.CharField(max_length=20, default='pending',
+ choices=[('pending','Pending'),('synced','Synced'),('failed','Failed')])
+ last_synced_at = models.DateTimeField(null=True, blank=True)
+```
+
+### 4.6 Frontend: Taxonomy Management UI
+
+**Location:** Add to Planner section
+
+```
+frontend/src/pages/Planner/
+├── Taxonomies.tsx # NEW — list all synced taxonomies + terms
+├── components/
+│ ├── TaxonomyList.tsx # Taxonomy groups with term counts
+│ ├── TermList.tsx # Terms within a taxonomy with content status
+│ ├── TermClusterMapper.tsx # Assign/reassign cluster per term
+│ └── TermContentStatus.tsx # Content generated? Published? Sync status?
+```
+
+**Sidebar integration:** Add "Taxonomies" as a sub-item under Planner:
+```
+WORKFLOW
+ ├── Planner
+ │ ├── Keywords
+ │ ├── Clusters
+ │ ├── Ideas
+ │ └── Taxonomies (NEW)
+ ├── Writer
+ ...
+```
+
+**Taxonomy List view:**
+- Shows all synced taxonomies grouped: WordPress Default (categories, tags), WooCommerce (product_cat, product_tag, pa_*), Custom/SAG (from blueprint)
+- Per taxonomy: term count, terms with content, terms without content
+- "Sync Taxonomies" button to trigger fresh sync from WordPress
+- "Generate All Term Content" button to batch-create ideas for all unmapped terms
+
+**Term Detail view:**
+- Term name, slug, description, post count
+- Cluster mapping: current cluster (or "Unmapped"), dropdown to change
+- Content status: Not generated / Draft / Review / Published
+- "Generate Content" button for individual term
+- Preview of generated content
+
+### 4.7 Frontend: Automation Integration
+
+When automation runs with taxonomy content enabled:
+- Stage 3 (Idea Generation) includes term ideas alongside post ideas
+- Ideas list in Planner shows term ideas with "Taxonomy Landing" badge
+- Writer Queue/Drafts show term content alongside post content
+- Publishing routes term content to term description instead of creating a new post
+
+---
+
+## 5. Module 3: Optimizer Module {#5-optimizer-module}
+
+### 5.1 What This Module Delivers
+
+Activates the existing `optimizer_enabled` module. Analyzes and optimizes existing published content: maps to clusters, rewrites structure for intent alignment, refreshes SEO metadata, generates schema markup.
+
+### 5.2 Backend: Implement OptimizeContent AI Function
+
+**Location:** `ai/functions/optimize_content.py` — currently PENDING, implement it
+
+```python
+class OptimizeContent:
+ """
+ Takes existing content and produces an optimized version:
+ - Maps to best-matching cluster
+ - Rewrites structure for intent alignment
+ - Refreshes meta title/description
+ - Adds missing sections (FAQs, comparisons, etc.)
+ - Generates schema JSON-LD
+ """
+
+ def execute(self, content, cluster=None, optimization_config=None):
+ # 1. If no cluster provided, call ClusterMappingService to find best match
+ # 2. Analyze current content: heading structure, keyword density, missing sections
+ # 3. Generate optimized version with SAG context
+ # 4. Generate before/after scores
+ # 5. Return: optimized_content, meta, schema, scores, diff_summary
+ pass
+```
+
+### 5.3 Backend: Optimizer Service
+
+```python
+# business/optimization/optimizer_service.py # IMPLEMENT (file exists, logic pending)
+
+class OptimizerService:
+ def analyze_content(self, content):
+ """Score content against its cluster targets. Return analysis report."""
+ # Keyword coverage score
+ # Heading structure score
+ # Content length assessment
+ # Missing sections detection
+ # Internal link opportunities
+ # Schema coverage
+ pass
+
+ def optimize_content(self, content, apply_mode='manual'):
+ """Generate optimized version. apply_mode: 'manual' (review first) or 'auto'."""
+ pass
+
+ def batch_optimize(self, site, content_ids):
+ """Queue batch optimization as Celery tasks."""
+ pass
+
+ def generate_schema(self, content):
+ """Generate appropriate JSON-LD schema based on content_type."""
+ pass
+```
+
+### 5.4 Backend: Optimizer Models
+
+**Modify/create in:** `modules/optimizer/models.py`
+
+```python
+class OptimizationJob(SiteSectorBaseModel):
+ """Tracks a single optimization operation."""
+ content = models.ForeignKey('writer.Content', on_delete=models.CASCADE)
+ status = models.CharField(max_length=20, choices=[
+ ('pending', 'Pending'),
+ ('analyzing', 'Analyzing'),
+ ('optimized', 'Optimized'),
+ ('applied', 'Applied'),
+ ('rejected', 'Rejected'),
+ ], default='pending')
+ original_score = models.FloatField(null=True, blank=True)
+ optimized_score = models.FloatField(null=True, blank=True)
+ cluster_match = models.ForeignKey('sag.SAGCluster', null=True, blank=True, on_delete=models.SET_NULL)
+ cluster_confidence = models.FloatField(null=True, blank=True)
+ optimized_content = models.TextField(blank=True)
+ optimized_meta_title = models.CharField(max_length=300, blank=True)
+ optimized_meta_description = models.TextField(blank=True)
+ generated_schema = models.JSONField(default=dict, blank=True)
+ diff_summary = models.JSONField(default=dict, blank=True)
+ created_at = models.DateTimeField(auto_now_add=True)
+ applied_at = models.DateTimeField(null=True, blank=True)
+```
+
+### 5.5 Backend: Optimizer API
+
+**Enhance:** `modules/optimizer/views.py`
+
+```python
+# POST /api/v1/optimizer/analyze/
+# Input: {content_id}
+# Output: {score, cluster_match, recommendations}
+
+# POST /api/v1/optimizer/optimize/
+# Input: {content_id, cluster_id (optional override)}
+# Output: {job_id, optimized_preview}
+
+# POST /api/v1/optimizer/apply/{job_id}/
+# Input: {job_id}
+# Output: {success, updated_content}
+
+# POST /api/v1/optimizer/batch/
+# Input: {content_ids: [...]}
+# Output: {jobs: [{content_id, job_id}]}
+
+# GET /api/v1/optimizer/jobs/
+# List all optimization jobs with status
+```
+
+### 5.6 Frontend: Optimizer Page
+
+**Location:** `pages/Optimizer/` — existing but INACTIVE, implement UI
+
+```
+frontend/src/pages/Optimizer/
+├── OptimizerDashboard.tsx # IMPLEMENT — overview of optimization opportunities
+│ ├── ContentScoreList.tsx # All content sorted by optimization score (lowest first)
+│ ├── ClusterCoverage.tsx # Which clusters have optimized vs unoptimized content
+│ └── OptimizationQueue.tsx # Active/pending optimization jobs
+├── OptimizeContent.tsx # IMPLEMENT — single content optimization view
+│ ├── BeforeAfterView.tsx # Side-by-side original vs optimized
+│ ├── ScoreComparison.tsx # Score breakdown: before vs after
+│ ├── ClusterMatcher.tsx # Show matched cluster, allow override
+│ ├── SchemaPreview.tsx # Preview generated JSON-LD
+│ └── ApplyRejectButtons.tsx # Apply optimization or reject
+└── BatchOptimize.tsx # IMPLEMENT — select multiple, batch optimize
+```
+
+**Sidebar:** Optimizer appears under WORKFLOW when `optimizer_enabled = True` (existing behavior, now with actual UI).
+
+### 5.7 Settings Integration
+
+**Location:** `pages/Settings/` — add Optimizer settings tab
+
+Settings for Optimizer module:
+- Enable/disable Optimizer
+- Default schema type per content type (Article, Product, FAQ, etc.)
+- Keyword density targets (percentage range)
+- Content length guidelines (min/max per content type)
+- Auto-apply vs manual review toggle
+- Exclude content from optimization (by ID or date range)
+
+---
+
+## 6. Module 4: GSC Integration {#6-gsc-integration}
+
+### 6.1 What This Module Delivers
+
+Google Search Console integration: OAuth connection, URL Inspection API, auto-indexing pipeline, search metrics dashboard, plugin status sync.
+
+### 6.2 Backend: New Django App
+
+```
+backend/igny8_core/
+├── gsc/ # NEW Django app
+│ ├── __init__.py
+│ ├── apps.py
+│ ├── models.py # GSCConnection, URLTrackingRecord, SearchMetric
+│ ├── serializers.py
+│ ├── views.py # OAuth flow, inspection, metrics endpoints
+│ ├── urls.py # /api/v1/gsc/*
+│ ├── admin.py
+│ ├── services/
+│ │ ├── __init__.py
+│ │ ├── oauth_service.py # Google OAuth token management
+│ │ ├── site_mapping_service.py # Map IGNY8 sites to GSC properties
+│ │ ├── inspection_service.py # URL Inspection API calls
+│ │ ├── indexing_service.py # Auto-indexing queue + pipeline
+│ │ ├── metrics_service.py # Search Analytics API data fetch
+│ │ └── quota_service.py # Daily quota tracking (2,000/day)
+│ ├── tasks.py # Celery tasks for queue processing
+│ └── migrations/
+```
+
+### 6.3 Backend: Models
+
+```python
+# gsc/models.py
+
+class GSCConnection(AccountBaseModel):
+ """One Google OAuth connection per account. Manages all sites."""
+ google_email = models.EmailField()
+ access_token = models.TextField()
+ refresh_token = models.TextField()
+ token_expiry = models.DateTimeField()
+ scopes = models.JSONField(default=list)
+ is_active = models.BooleanField(default=True)
+ connected_at = models.DateTimeField(auto_now_add=True)
+ last_refreshed = models.DateTimeField(null=True, blank=True)
+
+class GSCSiteMapping(models.Model):
+ """Maps an IGNY8 site to a GSC property."""
+ site = models.OneToOneField('auth.Site', on_delete=models.CASCADE, related_name='gsc_mapping')
+ gsc_property = models.CharField(max_length=300, help_text='e.g., sc-domain:example.com')
+ property_type = models.CharField(max_length=20, choices=[
+ ('domain', 'Domain Property'),
+ ('url_prefix', 'URL Prefix'),
+ ])
+ status = models.CharField(max_length=20, choices=[
+ ('matched', 'Auto-Matched'),
+ ('manual', 'Manually Mapped'),
+ ('not_found', 'Not Found in GSC'),
+ ])
+ verified = models.BooleanField(default=False)
+ mapped_at = models.DateTimeField(auto_now_add=True)
+
+class URLTrackingRecord(SiteSectorBaseModel):
+ """Tracks indexing status for each URL."""
+ url = models.URLField()
+ content = models.ForeignKey('writer.Content', null=True, blank=True, on_delete=models.SET_NULL)
+ is_igny8_content = models.BooleanField(default=True)
+
+ # Inspection results
+ index_status = models.CharField(max_length=30, choices=[
+ ('unknown', 'Unknown'),
+ ('indexed', 'Indexed'),
+ ('not_indexed', 'Not Indexed'),
+ ('indexing_requested', 'Indexing Requested'),
+ ('error', 'Error'),
+ ('noindex', 'Noindex Detected'),
+ ], default='unknown')
+ coverage_state = models.CharField(max_length=100, blank=True)
+ last_crawl_time = models.DateTimeField(null=True, blank=True)
+ crawl_status = models.CharField(max_length=50, blank=True)
+
+ # Queue management
+ queue_priority = models.IntegerField(default=50)
+ next_check_at = models.DateTimeField(null=True, blank=True)
+ check_count = models.IntegerField(default=0)
+ max_checks = models.IntegerField(default=4)
+
+ last_inspected_at = models.DateTimeField(null=True, blank=True)
+ indexing_requested_at = models.DateTimeField(null=True, blank=True)
+ created_at = models.DateTimeField(auto_now_add=True)
+
+class SearchMetricSnapshot(SiteSectorBaseModel):
+ """Daily/weekly search metrics from GSC Search Analytics API."""
+ date = models.DateField()
+ dimension = models.CharField(max_length=20, choices=[
+ ('page', 'Page'), ('query', 'Query'),
+ ('country', 'Country'), ('device', 'Device'),
+ ])
+ dimension_value = models.CharField(max_length=500)
+ clicks = models.IntegerField(default=0)
+ impressions = models.IntegerField(default=0)
+ ctr = models.FloatField(default=0.0)
+ position = models.FloatField(default=0.0)
+ is_igny8_content = models.BooleanField(default=False)
+```
+
+### 6.4 Backend: Queue Processing
+
+```python
+# gsc/tasks.py
+
+@shared_task
+def process_indexing_queue():
+ """Process URL inspection/indexing queue. Runs every 5 minutes."""
+ # 1. Check daily quota (2,000 inspections, resets midnight PT)
+ # 2. Pick next item from queue by priority
+ # 3. Call URL Inspection API
+ # 4. Parse response: indexed? → done. Not indexed? → request indexing
+ # 5. Schedule re-inspection (24h, 3d, 6d, 13d)
+ # 6. Wait 3 seconds between calls
+ # 7. Sync status to WordPress plugin
+ pass
+
+@shared_task
+def fetch_search_metrics(site_id):
+ """Fetch search analytics data from GSC. Runs daily."""
+ pass
+
+@shared_task
+def auto_index_published_content(content_id):
+ """Triggered when content is published to WordPress. Adds to indexing queue."""
+ pass
+
+@shared_task
+def sync_index_status_to_plugin(site_id):
+ """Batch sync index statuses to WordPress plugin. Runs every 5 min."""
+ pass
+```
+
+### 6.5 Backend: API Endpoints
+
+```python
+# gsc/urls.py
+
+# OAuth
+POST /api/v1/gsc/connect/ # Initiate OAuth flow
+GET /api/v1/gsc/callback/ # OAuth callback
+DELETE /api/v1/gsc/disconnect/ # Revoke connection
+GET /api/v1/gsc/status/ # Connection status
+
+# Site mapping
+GET /api/v1/gsc/sites/ # List GSC properties + mapping status
+POST /api/v1/gsc/sites/map/ # Manually map IGNY8 site to GSC property
+POST /api/v1/gsc/sites/auto-map/ # Auto-detect and map
+
+# URL Inspection
+GET /api/v1/gsc/urls/ # List tracked URLs with index status
+POST /api/v1/gsc/urls/inspect/ # Manual inspect a URL
+POST /api/v1/gsc/urls/request-index/ # Manual request indexing
+GET /api/v1/gsc/urls/queue/ # Queue status (pending, quota remaining)
+
+# Search Metrics
+GET /api/v1/gsc/metrics/ # Search metrics with date range + dimensions
+GET /api/v1/gsc/metrics/top-pages/ # Top pages by clicks
+GET /api/v1/gsc/metrics/top-queries/ # Top queries
+GET /api/v1/gsc/metrics/igny8-only/ # IGNY8-published content metrics only
+```
+
+### 6.6 Frontend: GSC Pages
+
+```
+frontend/src/pages/
+└── SearchConsole/ # NEW page
+ ├── GSCConnect.tsx # OAuth connection flow + welcome screen
+ ├── SiteMapping.tsx # Map IGNY8 sites to GSC properties
+ ├── IndexingDashboard.tsx # URL list, index status, queue status
+ │ ├── IndexStatusTable.tsx # Filterable URL table
+ │ ├── QueueStatus.tsx # Quota remaining, items in queue
+ │ └── ManualInspect.tsx # Inspect any URL manually
+ ├── PerformanceMetrics.tsx # Search analytics dashboard
+ │ ├── MetricsSummary.tsx # Clicks, impressions, CTR, position cards
+ │ ├── TopPages.tsx # Top pages table with IGNY8 star markers
+ │ ├── TopQueries.tsx # Top queries table
+ │ └── DateRangePicker.tsx # Date range selector
+ └── components/
+ └── IndexStatusBadge.tsx # Reusable status badge component
+```
+
+**Sidebar addition:**
+```
+WORKFLOW
+ ├── Planner
+ ├── Writer
+ ├── Automation
+ ├── Blueprint (if SAG active)
+ ├── Linker (if linker_enabled)
+ ├── Campaigns (if campaign_enabled)
+ ├── Search Console (NEW — if gsc_enabled)
+ └── Optimizer (if optimizer_enabled)
+```
+
+**Feature flag:** `gsc_enabled`
+
+### 6.7 Plugin Side Enhancement
+
+```
+igny8-plugin/includes/modules/gsc/
+├── class-gsc-module.php # Module entry
+├── class-gsc-status-display.php # Index status column in WP admin content list
+├── class-gsc-metabox.php # Edit screen metabox showing index status
+└── views/
+ └── gsc-metabox.php # Metabox template
+```
+
+Plugin receives index status updates from IGNY8 app via:
+```
+POST /wp-json/igny8/v1/gsc/status-sync
+Body: {urls: [{url, index_status, last_inspected, coverage_state}]}
+```
+
+---
+
+## 7. Module 5: Rich Schema & SERP Enhancement {#7-rich-schema}
+
+### 7.1 What This Module Delivers
+
+Automated JSON-LD schema injection and on-page SERP elements (TL;DR boxes, TOC, definition blocks, comparison tables, PAA subheadings) into content — both during generation and retroactively for existing pages.
+
+### 7.2 Backend: Schema Service
+
+```
+backend/igny8_core/
+├── schema/ # NEW (or extend within modules/writer/)
+│ ├── __init__.py
+│ ├── services/
+│ │ ├── schema_generator.py # Core: content → schema JSON-LD
+│ │ ├── content_classifier.py # Classify content type for schema mapping
+│ │ ├── faq_generator.py # AI: extract/generate FAQ pairs
+│ │ ├── howto_extractor.py # AI: detect procedural content → HowTo
+│ │ ├── review_analyzer.py # AI: sentiment analysis → Review schema
+│ │ ├── proscons_generator.py # AI: generate pros/cons from content
+│ │ ├── toc_generator.py # Parse H2/H3 → TOC with jump links
+│ │ ├── tldr_generator.py # AI: generate TL;DR summary
+│ │ ├── definition_extractor.py # AI: extract key terms → definition blocks
+│ │ ├── paa_integrator.py # AI: generate PAA-style subheadings
+│ │ └── validator.py # JSON-LD structural validation
+│ └── ai_functions/
+│ ├── generate_schema_elements.py # Combined AI function for all schema/SERP elements
+│ └── retroactive_analyzer.py # AI: analyze existing page → what's missing
+```
+
+### 7.3 Backend: Content Type → Schema Mapping
+
+This is the core decision engine. For each content classification, determine which schemas and elements apply:
+
+```python
+# schema/services/schema_generator.py
+
+SCHEMA_MAP = {
+ 'blog_article': {
+ 'schemas': ['faq', 'article', 'author_person', 'breadcrumb'],
+ 'elements': ['tldr', 'toc', 'definition_blocks', 'paa_subheadings'],
+ },
+ 'tutorial_guide': {
+ 'schemas': ['faq', 'howto', 'article', 'author_person', 'breadcrumb'],
+ 'elements': ['tldr', 'toc', 'definition_blocks', 'paa_subheadings'],
+ },
+ 'product_review': {
+ 'schemas': ['faq', 'review_rating', 'pros_cons', 'article', 'author_person', 'breadcrumb'],
+ 'elements': ['tldr', 'toc', 'paa_subheadings'],
+ },
+ 'service_page': {
+ 'schemas': ['faq', 'breadcrumb', 'service'],
+ 'elements': ['definition_blocks'],
+ },
+ 'comparison_post': {
+ 'schemas': ['faq', 'review_rating', 'pros_cons', 'article', 'author_person', 'breadcrumb'],
+ 'elements': ['tldr', 'toc', 'comparison_table', 'paa_subheadings'],
+ },
+ 'product_page': {
+ 'schemas': ['faq', 'product', 'review_rating', 'breadcrumb'],
+ 'elements': [],
+ },
+}
+```
+
+### 7.4 Backend: Pipeline Integration
+
+**Enhance Stage 5 (Content Generation):**
+
+After AI generates content body, a post-processing step generates schema and on-page elements:
+
+```python
+# business/content/ — extend content generation flow
+
+def post_process_content(content):
+ """After content body is generated, add schema and SERP elements."""
+ # 1. Classify content type
+ content_class = content_classifier.classify(content)
+
+ # 2. Get applicable schemas and elements from SCHEMA_MAP
+ applicable = SCHEMA_MAP.get(content_class, {})
+
+ # 3. Generate each applicable schema
+ schemas = {}
+ if 'faq' in applicable['schemas']:
+ schemas['faq'] = faq_generator.generate(content)
+ if 'howto' in applicable['schemas']:
+ schemas['howto'] = howto_extractor.extract(content)
+ # ... etc
+
+ # 4. Generate on-page elements
+ elements = {}
+ if 'tldr' in applicable['elements']:
+ elements['tldr'] = tldr_generator.generate(content)
+ if 'toc' in applicable['elements']:
+ elements['toc'] = toc_generator.generate(content)
+ # ... etc
+
+ # 5. Store on Content model
+ content.schema_data = schemas # NEW JSON field
+ content.serp_elements = elements # NEW JSON field
+ content.save()
+```
+
+**New fields on Content model:**
+```python
+# Add to modules/writer/models.py — Content model:
+schema_data = models.JSONField(null=True, blank=True, help_text='Generated JSON-LD schemas')
+serp_elements = models.JSONField(null=True, blank=True, help_text='Generated SERP elements (TL;DR, TOC, etc.)')
+```
+
+### 7.5 Backend: Retroactive Enhancement Engine
+
+```python
+# schema/services/retroactive_engine.py
+
+class RetroactiveEngine:
+ def scan_site(self, site):
+ """Fetch all published pages via plugin, classify, identify missing schemas."""
+ # 1. GET site inventory from plugin
+ # 2. For each page: classify content type, check existing schema
+ # 3. Return: [{url, content_type, missing_schemas, missing_elements}]
+ pass
+
+ def generate_enhancements(self, site, pages):
+ """For each page with missing schemas, generate them."""
+ # AI analyzes page content → generates applicable schemas + elements
+ # Returns review-ready enhancement set
+ pass
+
+ def push_enhancements(self, site, approved_enhancements):
+ """Push approved schemas to WordPress via plugin bulk endpoint."""
+ # POST /wp-json/igny8/v1/schema/bulk-update
+ pass
+```
+
+### 7.6 Backend: Validation Pipeline
+
+```python
+# schema/services/validator.py
+
+class SchemaValidator:
+ def validate_structural(self, schema_json):
+ """Check JSON-LD syntax and schema.org conformance."""
+ pass
+
+ def validate_rich_results(self, url, schema_json):
+ """Check against Google Rich Results Test API."""
+ pass
+```
+
+### 7.7 Frontend: Schema Module UI
+
+```
+frontend/src/pages/
+└── Schema/ # NEW page (or sub-section of Optimizer)
+ ├── SchemaOverview.tsx # Site-wide schema coverage dashboard
+ │ ├── SchemaCoverage.tsx # % of pages with each schema type
+ │ ├── MissingSchemaList.tsx # Pages missing applicable schemas
+ │ └── ValidationStatus.tsx # Schema validation results
+ ├── RetroactiveEnhancer.tsx # Scan existing site, review/approve enhancements
+ │ ├── SiteScanResults.tsx # Classified pages with enhancement recommendations
+ │ ├── EnhancementPreview.tsx # Preview schema + elements per page
+ │ └── BulkApprove.tsx # Approve all / select and approve
+ └── SchemaSettings.tsx # Per-content-type schema defaults
+```
+
+**Sidebar:** Can be a sub-page under Optimizer or a standalone item if `schema_enabled` flag is set.
+
+### 7.8 Plugin Side Enhancement
+
+```
+igny8-plugin/includes/modules/schema/ # Already planned in Plugin Build Plan
+├── class-schema-module.php
+├── class-schema-generator.php # JSON-LD output in
+├── class-schema-renderer.php # On-page element renderer (shortcodes/blocks)
+```
+
+Plugin stores schemas in post meta (`igny8_schema_faq`, `igny8_schema_howto`, etc.) and renders them in `wp_head` hook.
+
+On-page elements (FAQ section, TOC, TL;DR box) rendered via shortcodes or automatic injection based on content type.
+
+**Bulk update endpoint:**
+```
+POST /wp-json/igny8/v1/schema/bulk-update
+Body: {pages: [{post_id, schemas: {faq: {...}, article: {...}}, elements: {tldr: "...", toc: [...]}}]}
+```
+
+---
+
+## 8. Module 6: Socializer {#8-socializer}
+
+### 8.1 What This Module Delivers
+
+Adapts published content into social posts and schedules across 5 platforms: LinkedIn, Twitter/X, Facebook, Instagram, TikTok.
+
+### 8.2 Backend: New Django App
+
+```
+backend/igny8_core/
+├── socializer/ # NEW Django app
+│ ├── __init__.py
+│ ├── apps.py
+│ ├── models.py # SocialAccount, SocialPost, SocialSchedule
+│ ├── serializers.py
+│ ├── views.py
+│ ├── urls.py # /api/v1/socializer/*
+│ ├── admin.py
+│ ├── services/
+│ │ ├── __init__.py
+│ │ ├── oauth_service.py # OAuth2 flows per platform
+│ │ ├── content_adapter.py # AI: adapt content for each platform
+│ │ ├── image_resizer.py # Resize/crop per platform specs
+│ │ ├── publisher.py # Publish to platform APIs
+│ │ ├── scheduler.py # Schedule management, best-time slots
+│ │ └── metrics_service.py # Fetch engagement metrics
+│ ├── platforms/ # Platform-specific API clients
+│ │ ├── __init__.py
+│ │ ├── linkedin.py
+│ │ ├── twitter.py
+│ │ ├── facebook.py
+│ │ ├── instagram.py
+│ │ └── tiktok.py
+│ ├── ai_functions/
+│ │ ├── adapt_for_social.py # AI: content → platform-specific post
+│ │ └── generate_hashtags.py # AI: generate relevant hashtags
+│ ├── tasks.py # Celery tasks for scheduled posting + metrics
+│ └── migrations/
+```
+
+### 8.3 Backend: Models
+
+```python
+# socializer/models.py
+
+class SocialAccount(AccountBaseModel):
+ """Connected social media account/page."""
+ platform = models.CharField(max_length=20, choices=[
+ ('linkedin', 'LinkedIn'), ('twitter', 'Twitter/X'),
+ ('facebook', 'Facebook'), ('instagram', 'Instagram'),
+ ('tiktok', 'TikTok'),
+ ])
+ account_name = models.CharField(max_length=200)
+ account_id = models.CharField(max_length=200)
+ access_token = models.TextField()
+ refresh_token = models.TextField(blank=True)
+ token_expiry = models.DateTimeField(null=True, blank=True)
+ page_id = models.CharField(max_length=200, blank=True, help_text='For Facebook Pages, LinkedIn Company Pages')
+ is_active = models.BooleanField(default=True)
+ connected_at = models.DateTimeField(auto_now_add=True)
+
+class SocialPost(SiteSectorBaseModel):
+ """A social post generated from IGNY8 content."""
+ source_content = models.ForeignKey('writer.Content', on_delete=models.CASCADE, related_name='social_posts')
+ platform = models.CharField(max_length=20)
+ social_account = models.ForeignKey(SocialAccount, on_delete=models.CASCADE)
+ post_type = models.CharField(max_length=30, choices=[
+ ('announcement', 'Announcement'),
+ ('highlight', 'Key Highlights'),
+ ('quote_card', 'Quote Card'),
+ ('faq_snippet', 'FAQ Snippet'),
+ ('thread', 'Thread (Twitter)'),
+ ])
+ text_content = models.TextField()
+ hashtags = models.JSONField(default=list)
+ image_url = models.URLField(blank=True)
+ link_url = models.URLField(blank=True)
+
+ # Scheduling
+ status = models.CharField(max_length=20, choices=[
+ ('draft', 'Draft'), ('scheduled', 'Scheduled'),
+ ('published', 'Published'), ('failed', 'Failed'),
+ ], default='draft')
+ scheduled_at = models.DateTimeField(null=True, blank=True)
+ published_at = models.DateTimeField(null=True, blank=True)
+ platform_post_id = models.CharField(max_length=200, blank=True)
+
+ # Metrics
+ clicks = models.IntegerField(default=0)
+ likes = models.IntegerField(default=0)
+ shares = models.IntegerField(default=0)
+ comments = models.IntegerField(default=0)
+ impressions = models.IntegerField(default=0)
+ metrics_updated_at = models.DateTimeField(null=True, blank=True)
+
+ created_at = models.DateTimeField(auto_now_add=True)
+```
+
+### 8.4 Backend: Automation Pipeline Stage 8
+
+```python
+# business/automation/stages/stage_8_socializer.py # NEW
+
+# After content is published to WordPress (Stage 7 + publish):
+# 1. Check if socializer_enabled for this site
+# 2. Load connected social accounts
+# 3. For each active platform:
+# a. AI adapts content for platform (tone, length, format)
+# b. Resize image for platform specs
+# c. Generate hashtags
+# d. Create SocialPost (status=scheduled)
+# e. Queue for scheduled publishing
+```
+
+Add to `AutomationConfig` choices:
+```python
+# Stage 8: Socializer (if socializer_enabled)
+```
+
+### 8.5 Backend: Celery Tasks
+
+```python
+# socializer/tasks.py
+
+@shared_task
+def publish_scheduled_posts():
+ """Every 5 min: check for posts due for publishing, publish them."""
+ pass
+
+@shared_task
+def fetch_engagement_metrics():
+ """Every 6 hours: fetch metrics for recently published posts."""
+ pass
+
+@shared_task
+def refresh_social_tokens():
+ """Daily: refresh OAuth tokens approaching expiry."""
+ pass
+```
+
+### 8.6 Frontend: Socializer Pages
+
+```
+frontend/src/pages/
+└── Socializer/ # NEW page
+ ├── SocialAccounts.tsx # Connected accounts management
+ │ ├── ConnectAccount.tsx # OAuth connect flow per platform
+ │ └── AccountList.tsx # List connected accounts with status
+ ├── SocialPosts.tsx # All social posts with status
+ │ ├── PostList.tsx # Filterable by platform, status, date
+ │ ├── PostPreview.tsx # Platform-specific preview card
+ │ └── PostEditor.tsx # Edit text/image before scheduling
+ ├── SocialCalendar.tsx # Calendar view of scheduled posts
+ └── SocialAnalytics.tsx # Engagement metrics per platform/post
+```
+
+**Sidebar addition:**
+```
+WORKFLOW
+ ├── ...
+ ├── Socializer (NEW — if socializer_enabled)
+ └── ...
+```
+
+**Feature flag:** `socializer_enabled`
+
+---
+
+## 9. Module 7: Video Creator {#9-video-creator}
+
+### 9.1 What This Module Delivers
+
+Converts published articles into video content and publishes to YouTube, Instagram Reels, TikTok, YouTube Shorts.
+
+### 9.2 Backend: New Django App
+
+```
+backend/igny8_core/
+├── video/ # NEW Django app
+│ ├── __init__.py
+│ ├── apps.py
+│ ├── models.py # VideoProject, VideoScript, VideoAsset, VideoRender
+│ ├── serializers.py
+│ ├── views.py
+│ ├── urls.py # /api/v1/video/*
+│ ├── admin.py
+│ ├── services/
+│ │ ├── __init__.py
+│ │ ├── script_service.py # AI script generation from content
+│ │ ├── tts_service.py # Text-to-speech (OpenAI, ElevenLabs, self-hosted)
+│ │ ├── asset_service.py # Stock footage/image fetching (Pexels, Pixabay)
+│ │ ├── composer_service.py # FFmpeg + MoviePy video assembly
+│ │ ├── subtitle_service.py # SRT caption generation
+│ │ ├── thumbnail_service.py # AI thumbnail generation
+│ │ ├── seo_service.py # Video titles, descriptions, tags per platform
+│ │ └── publisher_service.py # Publish to YouTube, Instagram, TikTok
+│ ├── platforms/
+│ │ ├── youtube.py # YouTube Data API v3
+│ │ ├── instagram.py # Instagram Graph API (Reels)
+│ │ └── tiktok.py # TikTok Content Posting API
+│ ├── ai_functions/
+│ │ ├── generate_script.py # AI: content → VideoScript
+│ │ ├── generate_video_seo.py # AI: script → platform-specific SEO
+│ │ └── generate_thumbnail.py # AI: content → thumbnail image
+│ ├── tasks.py # Celery tasks (separate queue for rendering)
+│ └── migrations/
+```
+
+### 9.3 Backend: Models
+
+```python
+# video/models.py
+
+class VideoProject(SiteSectorBaseModel):
+ """A video project generated from IGNY8 content."""
+ source_content = models.ForeignKey('writer.Content', on_delete=models.CASCADE, related_name='video_projects')
+ video_type = models.CharField(max_length=20, choices=[
+ ('short', 'Short Form (30-90s)'),
+ ('medium', 'Medium (60-180s)'),
+ ('long', 'Long Form (5-15 min)'),
+ ])
+ status = models.CharField(max_length=20, choices=[
+ ('script_draft', 'Script Draft'),
+ ('script_approved', 'Script Approved'),
+ ('rendering', 'Rendering'),
+ ('rendered', 'Rendered'),
+ ('published', 'Published'),
+ ('failed', 'Failed'),
+ ], default='script_draft')
+ target_platforms = models.JSONField(default=list, help_text='["youtube", "instagram", "tiktok"]')
+ render_preset = models.CharField(max_length=30, choices=[
+ ('youtube_long', '1920×1080 3-15min'),
+ ('youtube_short', '1080×1920 30-60s'),
+ ('instagram_reel', '1080×1920 30-90s'),
+ ('tiktok', '1080×1920 30-180s'),
+ ])
+ created_at = models.DateTimeField(auto_now_add=True)
+
+class VideoScript(models.Model):
+ """AI-generated narration script for a video project."""
+ project = models.OneToOneField(VideoProject, on_delete=models.CASCADE, related_name='script')
+ sections = models.JSONField(help_text='[{type: "hook"|"intro"|"point"|"cta", text, visual_cue, duration_seconds}]')
+ total_duration_seconds = models.IntegerField(default=0)
+ voice_id = models.CharField(max_length=100, blank=True)
+ voice_provider = models.CharField(max_length=30, blank=True)
+ seo_title = models.JSONField(default=dict, help_text='{youtube: "...", instagram: "...", tiktok: "..."}')
+ seo_description = models.JSONField(default=dict)
+ seo_tags = models.JSONField(default=list)
+ chapter_markers = models.JSONField(default=list, help_text='For YouTube chapters')
+ created_at = models.DateTimeField(auto_now_add=True)
+
+class VideoRender(models.Model):
+ """A rendered video file for a specific platform."""
+ project = models.ForeignKey(VideoProject, on_delete=models.CASCADE, related_name='renders')
+ platform = models.CharField(max_length=20)
+ file_url = models.URLField(blank=True, help_text='S3/storage URL')
+ file_size_bytes = models.BigIntegerField(default=0)
+ duration_seconds = models.IntegerField(default=0)
+ resolution = models.CharField(max_length=20)
+ thumbnail_url = models.URLField(blank=True)
+ subtitle_url = models.URLField(blank=True, help_text='SRT file URL')
+ status = models.CharField(max_length=20, choices=[
+ ('queued', 'Queued'), ('rendering', 'Rendering'),
+ ('complete', 'Complete'), ('failed', 'Failed'),
+ ], default='queued')
+ platform_video_id = models.CharField(max_length=200, blank=True)
+ published_at = models.DateTimeField(null=True, blank=True)
+ render_started_at = models.DateTimeField(null=True, blank=True)
+ render_completed_at = models.DateTimeField(null=True, blank=True)
+```
+
+### 9.4 Backend: Celery Tasks (Separate Queue)
+
+Video rendering is CPU/memory intensive — use a separate Celery queue.
+
+```python
+# video/tasks.py
+
+@shared_task(queue='video_render')
+def render_video(project_id, platform):
+ """Heavy task: assemble and render video. Runs on dedicated worker."""
+ # 1. Load script + assets
+ # 2. TTS: generate voiceover audio
+ # 3. Fetch stock footage/images for visual cues
+ # 4. Compose video with FFmpeg/MoviePy
+ # 5. Add subtitles
+ # 6. Upload to S3/storage
+ # 7. Update VideoRender record
+ pass
+
+@shared_task
+def publish_video(render_id):
+ """Publish rendered video to platform."""
+ pass
+
+@shared_task
+def generate_video_thumbnail(project_id):
+ """AI-generate thumbnail from content."""
+ pass
+```
+
+**Celery config addition:**
+```python
+# celery.py — add video_render queue
+CELERY_TASK_ROUTES = {
+ 'igny8_core.video.tasks.render_video': {'queue': 'video_render'},
+}
+```
+
+### 9.5 Backend: Automation Pipeline Stage 9
+
+```python
+# business/automation/stages/stage_9_video.py # NEW
+
+# After socializer (Stage 8) or after publish:
+# 1. Check if video_enabled for this site
+# 2. If auto-video enabled: generate script → queue for rendering
+# 3. If manual: create project in script_draft status for user review
+```
+
+### 9.6 Frontend: Video Creator Pages
+
+```
+frontend/src/pages/
+└── VideoCreator/ # NEW page
+ ├── VideoProjects.tsx # List all video projects with status
+ ├── ScriptEditor.tsx # View/edit AI-generated script
+ │ ├── ScriptSections.tsx # Section-by-section editor
+ │ ├── VoiceSelector.tsx # Choose TTS voice + preview
+ │ └── VisualCueEditor.tsx # Edit visual cues per section
+ ├── VideoPreview.tsx # Preview rendered video
+ ├── VideoPublisher.tsx # Select platforms + publish
+ └── VideoAnalytics.tsx # View/engagement metrics per video
+```
+
+**Sidebar addition:**
+```
+WORKFLOW
+ ├── ...
+ ├── Socializer (if socializer_enabled)
+ ├── Video Creator (NEW — if video_enabled)
+ └── ...
+```
+
+**Feature flag:** `video_enabled`
+
+---
+
+## 10. Updated Automation Pipeline — All Stages {#10-updated-automation-pipeline}
+
+After all modules are implemented, the full pipeline becomes:
+
+```
+Stage 0: Blueprint Check (if SAG active — from Doc A)
+Stage 1: Process New Keywords
+Stage 2: AI Cluster Keywords (or SAG cluster mapping)
+Stage 3: Generate Content Ideas (type-aware, blueprint-guided)
+Stage 4: Create Writer Tasks (with content_type + content_structure)
+Stage 5: Generate Article Content (type-specific prompts + schema/SERP post-processing)
+Stage 6: Extract Image Prompts
+Stage 7: Generate Images → Review Queue
+--- After publish to WordPress ---
+Stage 7.5: Auto-Index via GSC (if gsc_enabled)
+Stage 8: Linker — Generate SAG links (if linker_enabled — from Doc A)
+Stage 9: Socializer — Generate social posts (if socializer_enabled)
+Stage 10: Video Creator — Generate video project (if video_enabled)
+```
+
+Each stage beyond 7 is independently enabled/disabled. The pipeline gracefully skips disabled stages.
+
+**AutomationConfig** model extends to include stage enable/disable per site:
+```python
+# Add to AutomationConfig or AutomationSettings:
+gsc_auto_index = models.BooleanField(default=True)
+auto_generate_links = models.BooleanField(default=True)
+auto_generate_social = models.BooleanField(default=False)
+auto_generate_video = models.BooleanField(default=False)
+```
+
+---
+
+## 11. Updated Navigation & Sidebar {#11-updated-navigation}
+
+After all modules implemented:
+
+```
+Dashboard (with GSC indexing widget, social metrics widget, video status widget)
+SETUP
+ ├── Add Keywords (optional when SAG active)
+ ├── Content Settings
+ ├── Sites
+ └── Thinker (admin only)
+WORKFLOW
+ ├── Planner
+ │ ├── Keywords
+ │ ├── Clusters
+ │ ├── Ideas
+ │ └── Taxonomies (if taxonomy sync active — Module 2)
+ ├── Writer (Queue → Drafts → Images → Review → Published, all content types)
+ ├── Automation (Stages 1-10 visualization, per-stage toggle)
+ ├── Blueprint (if SAG active — from Doc A)
+ ├── Linker (if linker_enabled — from Doc A)
+ ├── Campaigns (if campaign_enabled — from Doc A)
+ ├── Search Console (if gsc_enabled — Module 4)
+ ├── Optimizer (if optimizer_enabled — Module 3)
+ ├── Schema (if schema_enabled — Module 5, or nested under Optimizer)
+ ├── Socializer (if socializer_enabled — Module 6)
+ └── Video Creator (if video_enabled — Module 7)
+ACCOUNT
+ ├── Account Settings
+ ├── Plans & Billing
+ ├── Usage
+ └── AI Models (admin only)
+ADMIN (admin only)
+ └── Sector Templates
+HELP
+ └── Help & Docs
+```
+
+---
+
+## 12. Complete API Endpoint Registry {#12-api-endpoints}
+
+### Content Types Writing (Module 1 — no new endpoints, enhances existing)
+```
+Existing writer/tasks/ and writer/content/ endpoints — now accept content_type and content_structure fields
+```
+
+### Taxonomy & Term Content (Module 2)
+```
+GET /api/v1/planner/taxonomies/ # List synced taxonomies
+POST /api/v1/planner/taxonomies/sync/ # Trigger taxonomy sync from WordPress
+GET /api/v1/planner/taxonomies/{id}/terms/ # List terms within taxonomy
+POST /api/v1/planner/taxonomies/terms/{id}/map/ # Map term to cluster
+POST /api/v1/planner/taxonomies/terms/{id}/generate/ # Generate content for term
+POST /api/v1/planner/taxonomies/bulk-generate/ # Batch generate term content
+```
+
+### Optimizer (Module 3)
+```
+POST /api/v1/optimizer/analyze/ # Analyze content
+POST /api/v1/optimizer/optimize/ # Generate optimized version
+POST /api/v1/optimizer/apply/{job_id}/ # Apply optimization
+POST /api/v1/optimizer/reject/{job_id}/ # Reject optimization
+POST /api/v1/optimizer/batch/ # Batch optimize
+GET /api/v1/optimizer/jobs/ # List optimization jobs
+GET /api/v1/optimizer/settings/ # Module settings
+PUT /api/v1/optimizer/settings/ # Update settings
+```
+
+### GSC Integration (Module 4)
+```
+POST /api/v1/gsc/connect/ # OAuth initiate
+GET /api/v1/gsc/callback/ # OAuth callback
+DELETE /api/v1/gsc/disconnect/ # Revoke
+GET /api/v1/gsc/status/ # Connection status
+GET /api/v1/gsc/sites/ # GSC properties
+POST /api/v1/gsc/sites/map/ # Manual mapping
+POST /api/v1/gsc/sites/auto-map/ # Auto-detect
+GET /api/v1/gsc/urls/ # Tracked URLs
+POST /api/v1/gsc/urls/inspect/ # Manual inspect
+POST /api/v1/gsc/urls/request-index/ # Manual index request
+GET /api/v1/gsc/urls/queue/ # Queue status
+GET /api/v1/gsc/metrics/ # Search metrics
+GET /api/v1/gsc/metrics/top-pages/ # Top pages
+GET /api/v1/gsc/metrics/top-queries/ # Top queries
+GET /api/v1/gsc/metrics/igny8-only/ # IGNY8 content only
+```
+
+### Rich Schema (Module 5)
+```
+GET /api/v1/schema/coverage/ # Site-wide schema coverage stats
+POST /api/v1/schema/generate/{content_id}/ # Generate schema for content
+POST /api/v1/schema/scan-site/ # Retroactive: scan site
+POST /api/v1/schema/generate-bulk/ # Retroactive: generate for multiple pages
+POST /api/v1/schema/push-bulk/ # Push approved schemas to WordPress
+POST /api/v1/schema/validate/{content_id}/ # Validate schema
+GET /api/v1/schema/settings/ # Schema settings
+PUT /api/v1/schema/settings/ # Update settings
+```
+
+### Socializer (Module 6)
+```
+GET /api/v1/socializer/accounts/ # List connected accounts
+POST /api/v1/socializer/accounts/connect/{platform}/ # OAuth initiate
+DELETE /api/v1/socializer/accounts/{id}/ # Disconnect
+GET /api/v1/socializer/posts/ # List social posts
+POST /api/v1/socializer/posts/generate/ # Generate posts from content
+PATCH /api/v1/socializer/posts/{id}/ # Edit post text/schedule
+POST /api/v1/socializer/posts/{id}/publish/ # Publish now
+DELETE /api/v1/socializer/posts/{id}/ # Delete draft
+GET /api/v1/socializer/calendar/ # Calendar view data
+GET /api/v1/socializer/analytics/ # Engagement metrics
+GET /api/v1/socializer/settings/ # Scheduling rules, defaults
+PUT /api/v1/socializer/settings/ # Update settings
+```
+
+### Video Creator (Module 7)
+```
+GET /api/v1/video/projects/ # List video projects
+POST /api/v1/video/projects/create/ # Create project from content
+GET /api/v1/video/projects/{id}/ # Project detail
+PATCH /api/v1/video/projects/{id}/script/ # Edit script
+POST /api/v1/video/projects/{id}/approve-script/ # Approve script, start render
+POST /api/v1/video/projects/{id}/render/ # Queue rendering
+GET /api/v1/video/projects/{id}/renders/ # List renders per platform
+POST /api/v1/video/projects/{id}/publish/ # Publish to platforms
+GET /api/v1/video/analytics/ # Video metrics
+GET /api/v1/video/voices/ # Available TTS voices
+```
+
+---
+
+## 13. Complete AI Function Registry {#13-ai-functions}
+
+| Function Key | Module | Location | Input | Output |
+|-------------|--------|----------|-------|--------|
+| `generate_content_product` | 1 | `ai/functions/generate_content.py` (extend) | Task + product context | Product page HTML |
+| `generate_content_service` | 1 | same | Task + service context | Service page HTML |
+| `generate_content_taxonomy` | 1 | same | Task + term context | Term landing HTML |
+| `generate_content_hub` | 1 | same | Task + cluster context | Hub page HTML |
+| `optimize_content` | 3 | `ai/functions/optimize_content.py` (implement) | Content + cluster | Optimized content + schema |
+| `generate_faq_pairs` | 5 | `schema/ai_functions/` | Content body | FAQ Q&A pairs |
+| `extract_howto_steps` | 5 | `schema/ai_functions/` | Content body | HowTo steps |
+| `generate_pros_cons` | 5 | `schema/ai_functions/` | Content body | Pros and cons lists |
+| `generate_tldr` | 5 | `schema/ai_functions/` | Content body | TL;DR summary |
+| `adapt_for_social` | 6 | `socializer/ai_functions/adapt_for_social.py` | Content + platform | Platform-adapted text |
+| `generate_hashtags` | 6 | `socializer/ai_functions/generate_hashtags.py` | Content + platform | Hashtag list |
+| `generate_video_script` | 7 | `video/ai_functions/generate_script.py` | Content + video_type | VideoScript sections |
+| `generate_video_seo` | 7 | `video/ai_functions/generate_video_seo.py` | Script + platform | SEO title/desc/tags |
+| `generate_thumbnail` | 7 | `video/ai_functions/generate_thumbnail.py` | Content | Thumbnail image prompt |
+
+---
+
+## 14. Complete Celery Task Registry {#14-celery-tasks}
+
+| Task | Module | Schedule | Queue |
+|------|--------|----------|-------|
+| `process_indexing_queue` | GSC | Every 5 min | default |
+| `fetch_search_metrics` | GSC | Daily | default |
+| `auto_index_published_content` | GSC | On demand (after publish) | default |
+| `sync_index_status_to_plugin` | GSC | Every 5 min | default |
+| `refresh_gsc_token` | GSC | Daily | default |
+| `publish_scheduled_posts` | Socializer | Every 5 min | default |
+| `fetch_engagement_metrics` | Socializer | Every 6 hours | default |
+| `refresh_social_tokens` | Socializer | Daily | default |
+| `render_video` | Video | On demand | video_render (separate) |
+| `publish_video` | Video | On demand | default |
+| `generate_video_thumbnail` | Video | On demand | default |
+
+---
+
+## 15. Feature Flag Registry {#15-feature-flags}
+
+| Flag | Module | Controls | Default |
+|------|--------|---------|---------|
+| `optimizer_enabled` | Optimizer | Optimizer page, optimization API, automation integration | `False` (exists) |
+| `gsc_enabled` | GSC | Search Console page, OAuth, auto-indexing | `False` |
+| `schema_enabled` | Rich Schema | Schema generation in pipeline, retroactive engine | `False` |
+| `socializer_enabled` | Socializer | Socializer page, OAuth, social posting, Stage 9 | `False` |
+| `video_enabled` | Video Creator | Video Creator page, rendering, Stage 10 | `False` |
+
+Content Types Writing and Taxonomy & Term Content have **no feature flags** — they extend existing pipeline capabilities and are always available once deployed.
+
+---
+
+## 16. Credit Cost Summary {#16-credit-costs}
+
+| Operation | Module | Credits |
+|-----------|--------|---------|
+| Generate product/service/hub content | Content Types | Same as articles (5 per 100 words) |
+| Generate taxonomy landing content | Taxonomy | Same as articles |
+| Analyze content for optimization | Optimizer | 2 |
+| Optimize content (rewrite) | Optimizer | 5 per 100 words |
+| Generate schema elements | Rich Schema | 2 per page |
+| Retroactive scan + generate | Rich Schema | 1 per page scanned + 2 per page enhanced |
+| Adapt content for 1 platform | Socializer | 1 |
+| Generate hashtags | Socializer | 0.5 |
+| Generate Twitter thread | Socializer | 2 |
+| Generate social image | Socializer | 3-10 |
+| Full social suite (5 platforms) | Socializer | 15-25 per content item |
+| Generate video script | Video | 5 |
+| TTS voiceover | Video | 10/min (standard), 20/min (HD), 2/min (self-hosted) |
+| Visual assets per video | Video | 15-50 |
+| Thumbnail generation | Video | 3-10 |
+| Video composition (render) | Video | 5 per render |
+| Video SEO metadata | Video | 1 per platform |
+| Full short-form video | Video | ~40-80 total |
+| Full long-form video | Video | ~100-250 total |
+
+---
+
+## 17. Cross-Module Dependencies {#17-cross-dependencies}
+
+```
+Content Types Writing (Module 1)
+ └── feeds → Taxonomy & Term Content (content structures for term pages)
+ └── feeds → Optimizer (supports all content types)
+ └── feeds → Rich Schema (content type classification drives schema mapping)
+ └── feeds → Socializer (any content type can be socialized)
+ └── feeds → Video Creator (any content type can become a video)
+
+Taxonomy & Term Content (Module 2)
+ └── feeds → Optimizer (term pages can be optimized)
+ └── feeds → Rich Schema (term pages get schema)
+ └── depends on → Content Types Writing (Module 1)
+ └── depends on → SAG Blueprint (Doc A) for cluster mapping
+
+Optimizer (Module 3)
+ └── feeds → Rich Schema (schema generation is part of optimization)
+ └── depends on → Content Types Writing (Module 1)
+ └── depends on → SAG clusters (Doc A) for cluster matching
+
+GSC Integration (Module 4)
+ └── feeds → SAG Backlink Campaigns (Doc A Phase 10) for KPI data
+ └── feeds → Blueprint Health (Doc A Phase 8) for indexed page tracking
+ └── INDEPENDENT — no dependencies on other modules
+
+Rich Schema (Module 5)
+ └── feeds → WordPress plugin (schema storage + rendering)
+ └── depends on → Content Types Writing (Module 1) for type classification
+ └── benefits from → GSC (Module 4) for schema error monitoring
+
+Socializer (Module 6)
+ └── depends on → Published content (any module)
+ └── shares OAuth patterns with → Video Creator (Module 7)
+
+Video Creator (Module 7)
+ └── depends on → Published content (any module)
+ └── depends on → Socializer (Module 6) for shared infrastructure
+ └── requires → S3/media storage, FFmpeg, separate Celery queue
+```
+
+---
+
+## Reference Documents
+
+| Document | Purpose |
+|----------|---------|
+| **IGNY8-Consolidated-Module-Plans.md** | Strategic plans for all modules — source for this guide |
+| **IGNY8-Rich-Schema-SERP-Enhancement-Module.docx** | Detailed schema types, mapping matrix, rollout plan |
+| **IGNY8-Current-State.md** | Current platform state — all file paths, models, modules |
+| **Doc A — SAG Architecture Dev Guide** | SAG models, blueprint, clusters — consumed by Modules 2, 3, 5 |
+
+---
+
+*End of Doc B — IGNY8 Platform Modules Development Guide*
diff --git a/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocC-WordPress-Ecosystem-Dev-Guide.md b/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocC-WordPress-Ecosystem-Dev-Guide.md
new file mode 100644
index 00000000..0175c6d6
--- /dev/null
+++ b/v2/Live Docs on Server/igny8-app-docs/plans/final-dev-guides-of-futute-implementation/DocC-WordPress-Ecosystem-Dev-Guide.md
@@ -0,0 +1,820 @@
+# Doc C — WordPress Ecosystem: Development Guide for Claude Code
+
+**Version:** 1.0
+**Date:** March 2026
+**For:** Claude Code (Opus 4.6) in VSCode
+**Purpose:** Step-by-step implementation guide for the IGNY8 WordPress Plugin (free + connected), Companion Theme, and Toolkit Plugin — where every file goes, what it does, build sequence, and how it connects to the IGNY8 SaaS platform
+**Scope:** Plugin (14 modules, 10 build phases), Theme (7 CPTs, 9 taxonomies, 15 landing sections, 50+ block patterns, 5 starters, WooCommerce), Toolkit Plugin (5 modules)
+**Rule:** Plugin works with ANY theme. Theme works WITHOUT the plugin. Both work WITHOUT the IGNY8 SaaS platform. Connected mode enhances both but is never required.
+**Dependency:** Doc A (SAG Architecture) defines the blueprint/cluster data the plugin receives in connected mode. Doc B (Platform Modules) defines the IGNY8 SaaS features that push content/schemas/links to the plugin.
+
+---
+
+## Table of Contents
+
+1. [Architecture Overview — Three Deliverables](#1-architecture-overview)
+2. [Build Sequence — What Comes First](#2-build-sequence)
+3. [IGNY8 Plugin — Foundation & Infrastructure](#3-plugin-foundation)
+4. [IGNY8 Plugin — Module 1: SEO Core](#4-seo-core)
+5. [IGNY8 Plugin — Module 2: Schema](#5-schema)
+6. [IGNY8 Plugin — Module 3: Sitemap](#6-sitemap)
+7. [IGNY8 Plugin — Module 4: Redirects](#7-redirects)
+8. [IGNY8 Plugin — Module 5: Site Intelligence](#8-site-intelligence)
+9. [IGNY8 Plugin — Module 6: Internal Linking](#9-internal-linking)
+10. [IGNY8 Plugin — Module 7: GSC](#10-gsc)
+11. [IGNY8 Plugin — Module 8: Socializer](#11-socializer)
+12. [IGNY8 Plugin — Module 9: Analytics + SMTP](#12-analytics-smtp)
+13. [IGNY8 Plugin — Module 10: Content Sync (Connected)](#13-content-sync)
+14. [IGNY8 Plugin — Module 11: SAG Structure (Connected)](#14-sag-structure)
+15. [IGNY8 Plugin — Setup Wizard & Import](#15-setup-wizard)
+16. [IGNY8 Plugin — Data Architecture](#16-data-architecture)
+17. [IGNY8 Plugin — REST API Endpoints](#17-rest-api)
+18. [IGNY8 Plugin — Performance Rules](#18-performance)
+19. [Theme — CPTs, Taxonomies, Meta Fields](#19-theme-structure)
+20. [Theme — Term Landing Pages & SAG Templates](#20-term-templates)
+21. [Theme — Landing Page Builder](#21-landing-pages)
+22. [Theme — Block Patterns & Starter Templates](#22-patterns-starters)
+23. [Theme — Interlinking Display Components](#23-interlinking-display)
+24. [Theme — WooCommerce Integration](#24-woocommerce)
+25. [Theme — Design System & Build Plan](#25-design-build)
+26. [Toolkit Plugin — All 5 Modules](#26-toolkit)
+27. [Free vs Premium Split](#27-free-premium)
+28. [Theme ↔ Plugin Contract](#28-theme-plugin-contract)
+29. [Plugin ↔ IGNY8 SaaS Communication](#29-saas-communication)
+
+---
+
+## 1. Architecture Overview — Three Deliverables {#1-architecture-overview}
+
+```
+┌────────────────────────────────────────────────────────────┐
+│ IGNY8 PLUGIN │
+│ SEO Core, Schema, Sitemap, Redirects, Analytics, GSC, │
+│ Site Intelligence, Internal Linking, Socializer, SMTP │
+│ + Connected: Content Sync, SAG Structure │
+│ │
+│ Distribution: Free on WordPress.org │
+│ Connected premium features via IGNY8 SaaS subscription │
+│ Works with ANY theme │
+└──────────────────────┬─────────────────────────────────────┘
+ │ reads plugin data via igny8() API
+┌──────────────────────┴─────────────────────────────────────┐
+│ COMPANION THEME │
+│ 7 CPTs, 9 custom taxonomies, meta fields, SAG templates, │
+│ term landing pages, landing page builder, 50+ patterns, │
+│ 5 site-type starters, WooCommerce templates, design system │
+│ │
+│ Distribution: Free on WordPress.org (limited), Premium │
+│ Works WITHOUT the plugin (graceful degradation) │
+└──────────────────────┬─────────────────────────────────────┘
+ │ extends theme with infrastructure
+┌──────────────────────┴─────────────────────────────────────┐
+│ TOOLKIT PLUGIN │
+│ Performance/Caching, Forms, Security, SMTP, WooCommerce │
+│ │
+│ Distribution: Free on WordPress.org (limited), Premium │
+│ Works with ANY theme │
+└────────────────────────────────────────────────────────────┘
+```
+
+**Key principle:** Each piece works independently. Together they create the full SAG-optimized WordPress experience.
+
+---
+
+## 2. Build Sequence — What Comes First {#2-build-sequence}
+
+```
+PHASE 1 (Days 1-3) ─── Plugin Foundation
+ │ Skeleton, module manager, admin menu, REST API base,
+ │ setup wizard, database installer, compatibility layer
+
+PHASE 2 (Days 4-7) ─── SEO Core Module
+ │ Meta box, title tags, meta description, content analysis,
+ │ OG tags, breadcrumbs, robots.txt, verification codes
+
+PHASE 3 (Days 8-10) ─── Schema + Sitemap + Redirects
+ │ JSON-LD schemas, XML sitemap, redirect manager, 404 monitor
+
+PHASE 4 (Days 11-13) ── Site Intelligence
+ │ Site audit, orphan detection, thin content, cannibalization,
+ │ cluster detection, intelligence dashboard
+
+PHASE 5 (Days 14-15) ── Internal Linking
+ │ Link crawl, link audit, suggestions, link graph
+
+PHASE 6 (Days 16-18) ── Socializer + Analytics + SMTP
+ │ Share buttons, social profiles, GA/GTM connector,
+ │ pixel manager, SMTP override, GSC OAuth + dashboard
+
+PHASE 7 (Days 19-20) ── SEO Import
+ │ Yoast, RankMath, AIOSEO importers
+
+PHASE 8 (Days 21-23) ── Connected Mode — Content Sync
+ │ API client, content puller, mapper, sync queue, scheduler
+
+PHASE 9 (Days 24-27) ── Connected Mode — SAG Structure
+ │ Blueprint sync, taxonomy builder, term builder,
+ │ cluster manager, structure visualizer
+
+PHASE 10 (Days 28-30) ─ Polish + Package
+ Cross-module testing, performance audit, WP.org compliance
+
+--- THEME BUILD (30 days, can overlap with plugin Phases 6+) ---
+
+THEME PHASE 1 (Days 1-3) Foundation (templates, design system, CSS)
+THEME PHASE 2 (Days 4-6) CPTs + Taxonomies + Meta Boxes
+THEME PHASE 3 (Days 7-9) Term Landing Page Templates
+THEME PHASE 4 (Days 10-11) Interlinking Display Components
+THEME PHASE 5 (Days 12-14) Landing Page Builder
+THEME PHASE 6 (Days 15-16) Single Templates (service, portfolio, docs)
+THEME PHASE 7 (Days 17-19) Custom Blocks + 50+ Patterns
+THEME PHASE 8 (Days 20-22) Site-Type Starters + WooCommerce
+THEME PHASE 9 (Days 23-27) Toolkit Plugin (all 5 modules)
+THEME PHASE 10 (Days 28-30) Setup Wizard + Polish
+
+--- THEME CAN START after Plugin Phase 5 (interlinking data contract defined) ---
+```
+
+---
+
+## 3. IGNY8 Plugin — Foundation & Infrastructure {#3-plugin-foundation}
+
+### 3.1 Complete File Structure
+
+```
+igny8/
+├── igny8.php # Plugin header, bootstrap, constants
+├── readme.txt # WordPress.org readme
+├── uninstall.php # Full cleanup on uninstall
+│
+├── includes/
+│ ├── class-igny8.php # Main singleton class
+│ ├── class-module-manager.php # Register, activate, deactivate modules
+│ ├── class-api-client.php # IGNY8 SaaS API client (connected mode)
+│ ├── class-connection.php # API key validation, connection status
+│ ├── class-utils.php # Shared utilities
+│ ├── class-ajax.php # Shared AJAX handler
+│ ├── class-rest-api.php # Plugin REST endpoints (for theme + external)
+│ ├── class-compatibility.php # Detect conflicting plugins, show notices
+│ │
+│ ├── modules/ # 14 modules (see sections 4-14)
+│ │ ├── seo/ # SEO Core (Phase 2)
+│ │ ├── schema/ # Schema (Phase 3)
+│ │ ├── sitemap/ # Sitemap (Phase 3)
+│ │ ├── redirects/ # Redirects (Phase 3)
+│ │ ├── analytics/ # Analytics (Phase 6)
+│ │ ├── site-intelligence/ # Site Intelligence (Phase 4)
+│ │ ├── linking/ # Internal Linking (Phase 5)
+│ │ ├── gsc/ # Google Search Console (Phase 6)
+│ │ ├── socializer/ # Social sharing + posting (Phase 6)
+│ │ ├── smtp/ # Email delivery (Phase 6)
+│ │ ├── content-sync/ # [Connected] Content from IGNY8 (Phase 8)
+│ │ └── sag/ # [Connected] SAG structure (Phase 9)
+│ │
+│ ├── admin/ # Admin UI infrastructure
+│ │ ├── class-admin-menu.php # Menu registration (top-level "IGNY8" menu)
+│ │ ├── class-dashboard.php # Main plugin dashboard page
+│ │ ├── class-setup-wizard.php # First-run wizard (6 steps)
+│ │ ├── class-compatibility-notice.php # Admin notices for conflicts
+│ │ ├── views/ # PHP templates for admin pages
+│ │ │ ├── dashboard.php
+│ │ │ ├── wizard/step-1 through step-6.php
+│ │ │ └── connect-prompt.php
+│ │ └── assets/
+│ │ ├── admin.css, admin.js
+│ │ └── meta-box.css, meta-box.js
+│ │
+│ ├── frontend/
+│ │ ├── class-head-output.php # ALL output (meta, schema, OG) in single hook
+│ │ ├── class-share-output.php # Share button HTML/CSS/JS (conditional)
+│ │ └── assets/
+│ │ ├── share-buttons.css # <3KB, loaded only if share enabled
+│ │ └── share-buttons.js # <2KB, loaded only if share enabled
+│ │
+│ ├── data/
+│ │ ├── class-installer.php # Create all custom DB tables on activation
+│ │ ├── class-migrator.php # Version-based migration handler
+│ │ └── class-importer.php # Import from Yoast/RankMath/AIOSEO
+│ │
+│ └── integrations/
+│ ├── class-woocommerce.php # WooCommerce-specific SEO/schema
+│ └── class-theme-bridge.php # Data passing to companion theme
+│
+└── languages/
+ └── igny8.pot # Translation template
+```
+
+### 3.2 Module Manager Pattern
+
+Every module follows the same lifecycle:
+
+```php
+// class-module-manager.php pattern
+
+class ModuleManager {
+ private $modules = [];
+
+ public function register($slug, $class, $options = []) {
+ // Register module with slug, class path, free/connected flag
+ }
+
+ public function activate($slug) {
+ // Enable module, call module's activate() method
+ }
+
+ public function deactivate($slug) {
+ // Disable module, call module's deactivate() method
+ }
+
+ public function is_active($slug) {
+ // Check igny8_active_modules option
+ }
+
+ public function boot_active_modules() {
+ // Called on plugins_loaded — instantiate all active modules
+ }
+}
+
+// Each module extends:
+abstract class IGNY8_Module {
+ abstract public function get_slug();
+ abstract public function get_name();
+ abstract public function init(); // Hook registration
+ public function activate() {} // On module enable
+ public function deactivate() {} // On module disable
+ public function is_connected_only() { return false; }
+}
+```
+
+### 3.3 Admin Menu Structure
+
+```
+IGNY8 (top-level menu, dashicons-chart-area)
+├── Dashboard # Plugin overview + connect prompt
+├── SEO # SEO settings page
+├── Schema # Schema settings
+├── Sitemaps # Sitemap configuration
+├── Redirects # Redirect manager + 404 log
+├── Site Intelligence # Audit dashboard
+├── Internal Links # Link audit + suggestions
+├── Search Console # GSC connection + metrics
+├── Socializer # Share buttons + accounts
+├── Analytics # GA/GTM/pixel settings
+├── SMTP # Mail settings
+├── Settings # Global plugin settings
+│
+└── (Connected only, appear after connection):
+ ├── Content Sync # Sync dashboard
+ └── SAG Structure # Blueprint + structure visualizer
+```
+
+### 3.4 Public API Class
+
+The plugin exposes a global function for themes and other plugins:
+
+```php
+function igny8() {
+ return IGNY8::instance();
+}
+
+// Usage by theme:
+if (function_exists('igny8')) {
+ $title = igny8()->seo->get_title($post_id);
+ $schema = igny8()->schema->get_json_ld($post_id);
+ $breadcrumbs = igny8()->seo->get_breadcrumbs();
+ $related = igny8()->linking->get_related_links($post_id);
+ $cluster_nav = igny8()->linking->get_cluster_navigation($post_id);
+ $term_content = igny8()->seo->get_term_content($term_id);
+ $share = igny8()->socializer->render_share_buttons($post_id);
+}
+```
+
+---
+
+## 4-12. Plugin Modules — Build Reference {#4-seo-core}
+
+Each module section below specifies: files to create, what each file does, which hooks it uses, what data it reads/writes, and how it connects to the IGNY8 SaaS platform in connected mode.
+
+### Module 1: SEO Core (Phase 2, Days 4-7)
+
+**Files:** `modules/seo/` — 9 PHP files + 2 view templates (see file structure above)
+
+**What it does:**
+- `class-meta-box.php` — Adds SEO meta box below editor on all post types. Fields: focus keyword, SEO title (with SERP preview), meta description (with character counter), canonical URL, robots index/follow toggles. Saves to `_igny8_*` post meta keys. Connected enhancement: multi-keyword fields, cluster-aware scoring.
+- `class-title-tag.php` — Manages `` tag output. Template system: `{site_title} {separator} {page_title}`. Customizable per post type. Filters: `igny8_title_parts`, `igny8_title_separator`.
+- `class-meta-tags.php` — Outputs ` `, ` `, ` ` in ``. Single `wp_head` hook at priority 1.
+- `class-content-analysis.php` — Real-time JavaScript analysis in editor: keyword density, heading check (H1 count, H2 usage), readability score (Flesch), internal link count, image alt text check, meta length check. Outputs score 0-100 stored in `_igny8_seo_score`.
+- `class-breadcrumbs.php` — Generates breadcrumb HTML. Shortcode `[igny8_breadcrumbs]`. Also outputs BreadcrumbList schema. SAG-aware: when connected, breadcrumbs follow dimensional path (Home → Attribute → Term → Post).
+- `class-opengraph.php` — OG title, description, image, type, URL. Twitter Card meta. Per-post overrides via meta box.
+- `class-robots-txt.php` — Virtual robots.txt manager. Adds sitemap URL, custom rules.
+- `class-verification.php` — Google, Bing, Pinterest, Yandex verification meta tags.
+
+**WP Hooks used:** `wp_head` (priority 1), `add_meta_boxes`, `save_post`, `wp_title`, `document_title_parts`, `the_content` (for breadcrumb auto-insertion option).
+
+### Module 2: Schema (Phase 3, Days 8-9)
+
+**Files:** `modules/schema/` — 12 PHP files
+
+**What it does:** Generates JSON-LD for all schema types and outputs as a single `