Remove obsolete migration and workflow files; delete Site Builder Wizard references and related components. Update documentation to reflect the removal of the WorkflowState model and streamline the site building process.

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-21 00:59:34 +00:00
parent 6bb918bad6
commit c8adfe06d1
23 changed files with 1914 additions and 3493 deletions

View File

@@ -139,30 +139,23 @@ Each entry must include:
### Documentation Files Structure
```
docs/
master-docs/ # Master documentation (permanent reference)
├── 00-DOCUMENTATION-MANAGEMENT.md # This file (management guide)
├── 01-TECH-STACK-AND-INFRASTRUCTURE.md
├── 02-APPLICATION-ARCHITECTURE.md
├── 03-FRONTEND-ARCHITECTURE.md
├── 04-BACKEND-IMPLEMENTATION.md
├── 05-AI-FRAMEWORK-IMPLEMENTATION.md
├── 06-FUNCTIONAL-BUSINESS-LOGIC.md
├── 06-FUNCTIONAL-BUSINESS-LOGIC.md # Includes complete workflow documentation
├── API-COMPLETE-REFERENCE.md
── WORDPRESS-PLUGIN-INTEGRATION.md
├── planning/ # Architecture & implementation planning
│ ├── IGNY8-HOLISTIC-ARCHITECTURE-PLAN.md
│ ├── IGNY8-IMPLEMENTATION-PLAN.md
│ ├── Igny8-phase-2-plan.md
│ ├── CONTENT-WORKFLOW-DIAGRAM.md
│ ├── ARCHITECTURE_CONTEXT.md
│ └── sample-usage-limits-credit-system
└── refactor/ # Refactoring plans and documentation
├── README.md
├── routes/
├── folder-structure/
└── migrations/
── WORDPRESS-PLUGIN-INTEGRATION.md
active-workflow-docs/ # Current state and active work (single file)
└── CURRENT_WORKFLOW_STATUS.md # Single source of truth for current system state
```
**Note:** The `refactor-plan/` folder has been removed after consolidating relevant content into master docs.
### Documentation Update Checklist
- [ ] Identify which documentation file(s) need updating
@@ -405,7 +398,7 @@ This system is finalized and should not be changed without explicit user approva
---
**Last Updated:** 2025-01-XX
**Last Updated:** 2025-01-XX (Documentation structure updated)
**Version:** 1.0.0
**Status:** Locked

View File

@@ -1,6 +1,6 @@
# IGNY8 Technology Stack & Infrastructure
**Last Updated:** 2025-01-XX
**Last Updated:** 2025-01-XX (Added Sites Renderer container, updated module count, fixed React Router versions)
**Purpose:** Complete technology stack, infrastructure setup, Docker deployment, and fresh installation guide for the IGNY8 platform.
---
@@ -32,7 +32,7 @@
- **Deployment**: Docker-based containerization
- **Reverse Proxy**: Caddy (HTTPS termination)
- **AI Functions**: 5 primary AI operations
- **Modules**: 5 core modules (Planner, Writer, Thinker, System, Billing)
- **Modules**: 10 backend modules (Planner, Writer, System, Billing, Automation, Integration, Linker, Optimizer, Publisher, Site Builder)
---
@@ -68,7 +68,8 @@
| **Build Tool** | Vite | 6.1.0 | Build tool & dev server |
| **Styling** | Tailwind CSS | 4.0.8 | Utility-first CSS |
| **State Management** | Zustand | 5.0.8 | Lightweight state |
| **Routing** | React Router | v7.9.5 | Client-side routing |
| **Routing** | react-router | ^7.1.5 | Core routing library |
| **Routing** | react-router-dom | ^7.9.5 | DOM bindings for React Router |
| **HTTP Client** | Fetch API | Native | API communication |
| **SEO** | react-helmet-async | 2.0.5 | Dynamic head management |
@@ -304,12 +305,17 @@
**Principle**: Clear module boundaries with shared utilities.
**Modules**:
**Backend Modules**:
- **Planner**: Keywords, Clusters, Ideas
- **Writer**: Tasks, Content, Images
- **Thinker**: Prompts, Author Profiles, Strategies, Image Testing
- **System**: Settings, Integrations, AI Configuration
- **Billing**: Credits, Transactions, Usage
- **Automation**: Automation workflows
- **Integration**: External integrations
- **Linker**: Internal linking
- **Optimizer**: Content optimization
- **Publisher**: Publishing workflows
- **Site Builder**: Site blueprint management
- **Auth**: Accounts, Users, Sites, Sectors
---
@@ -341,6 +347,7 @@ The system uses a two-stack Docker architecture:
| **Backend** | `igny8_backend` | 8011:8010 | Django REST API |
| **Frontend** | `igny8_frontend` | 8021:5173 | React application (main app) |
| **Marketing Dev** | `igny8_marketing_dev` | 8023:5174 | Marketing site (dev server) |
| **Sites Renderer** | `igny8_sites` | 8024:5176 | Serves deployed public sites (sites.igny8.com) |
| **Celery Worker** | `igny8_celery_worker` | - | Async task processing |
| **Celery Beat** | `igny8_celery_beat` | - | Scheduled tasks |
@@ -376,6 +383,7 @@ The system uses a two-stack Docker architecture:
| **Backend** | 8011 | 8010 | http://localhost:8011 |
| **Frontend** | 8021 | 5173 | http://localhost:8021 |
| **Marketing Dev** | 8023 | 5174 | http://localhost:8023 |
| **Sites Renderer** | 8024 | 5176 | http://localhost:8024 |
---
@@ -809,6 +817,18 @@ docker images | grep igny8-frontend
docker images | grep igny8-marketing
```
#### 7.3 Build Sites Renderer Image
```bash
cd /data/app/igny8/sites
# Build sites renderer dev image
docker build -t igny8-sites-dev:latest -f Dockerfile.dev .
# Verify image
docker images | grep igny8-sites
```
**Note**: For production, also build production images:
```bash
# Production frontend image
@@ -857,6 +877,7 @@ VITE_BACKEND_URL=https://api.igny8.com/api
**Edit Caddyfile** for domain routing:
- `igny8.com` → Marketing site
- `app.igny8.com` → Main application
- `sites.igny8.com` → Sites renderer (deployed public sites)
- `api.igny8.com` → Backend API
---
@@ -960,9 +981,10 @@ docker compose -f docker-compose.app.yml -p igny8-app ps
1. **Marketing Site**: `https://igny8.com` (or `http://your-ip:8023` for dev)
2. **Main App**: `https://app.igny8.com` (or `http://your-ip:8021` for dev)
3. **Backend API**: `https://api.igny8.com/api/v1/system/status/`
4. **Portainer**: `http://your-ip:9000`
5. **pgAdmin**: `http://your-ip:5050`
3. **Sites Renderer**: `https://sites.igny8.com` (or `http://your-ip:8024` for dev)
4. **Backend API**: `https://api.igny8.com/api/v1/system/status/`
5. **Portainer**: `http://your-ip:9000`
6. **pgAdmin**: `http://your-ip:5050`
#### 12.3 Check Logs
@@ -976,6 +998,9 @@ docker logs igny8_frontend
# Marketing logs
docker logs igny8_marketing_dev
# Sites renderer logs
docker logs igny8_sites
# Check for errors
docker logs igny8_backend 2>&1 | grep -i error
```
@@ -1094,6 +1119,8 @@ git pull
# Rebuild images
docker build -t igny8-backend:latest -f backend/Dockerfile ./backend
docker build -t igny8-frontend-dev:latest -f frontend/Dockerfile.dev ./frontend
docker build -t igny8-marketing-dev:latest -f frontend/Dockerfile.marketing.dev ./frontend
docker build -t igny8-sites-dev:latest -f sites/Dockerfile.dev ./sites
# Restart services
docker compose -f docker-compose.app.yml -p igny8-app up -d

View File

@@ -1,6 +1,6 @@
# IGNY8 Application Architecture
**Last Updated:** 2025-01-XX
**Last Updated:** 2025-01-XX (Added 6 missing modules: Linker, Optimizer, Publisher, Site Builder, Automation, Integration)
**Purpose:** Complete application architecture documentation covering system hierarchy, user roles, access control, modules, workflows, data models, multi-tenancy, API architecture, and security.
---
@@ -34,6 +34,12 @@
| **Content Generation** | AI-powered blog post and article generation | Writer |
| **Image Generation** | AI-powered image generation (DALL-E, Runware) | Writer |
| **WordPress Integration** | Direct publishing to WordPress sites | Writer |
| **Internal Linking** | AI-powered internal linking suggestions | Linker |
| **Content Optimization** | Content scoring and optimization suggestions | Optimizer |
| **Site Publishing** | Publishing records and site deployment | Publisher |
| **Site Blueprints** | Site structure and page blueprint management | Site Builder |
| **Automation** | Automation rules and scheduled tasks | Automation |
| **Site Integration** | External platform integrations and sync | Integration |
| **Account Management** | Multi-account SaaS with user roles | Auth |
| **Billing & Credits** | Credit-based billing system | Billing |
| **AI Configuration** | Customizable AI prompts and settings | System |
@@ -145,7 +151,13 @@ Task (1) ──< (N) Images
| Module | Purpose | Models | ViewSets | Celery Tasks |
|--------|---------|--------|----------|--------------|
| **Planner** | Keyword management & content planning | Keywords, Clusters, ContentIdeas | KeywordViewSet, ClusterViewSet, ContentIdeasViewSet | auto_cluster_keywords_task, auto_generate_ideas_task |
| **Writer** | Content generation & management | Tasks, Content, Images | TasksViewSet, ImagesViewSet | auto_generate_content_task, auto_generate_images_task |
| **Writer** | Content generation & management | Tasks, Content, Images | TasksViewSet, ContentViewSet, ImagesViewSet | auto_generate_content_task, auto_generate_images_task |
| **Linker** | Internal linking operations | - | LinkerViewSet | - |
| **Optimizer** | Content optimization & scoring | - | OptimizerViewSet | - |
| **Publisher** | Publishing records & site deployment | PublishingRecord, DeploymentRecord | PublishingRecordViewSet, DeploymentRecordViewSet, PublisherViewSet | - |
| **Site Builder** | Site blueprint management | SiteBlueprint, PageBlueprint, SiteBlueprintCluster, SiteBlueprintTaxonomy | SiteBlueprintViewSet, PageBlueprintViewSet, SiteAssetView, SiteBuilderMetadataView | - |
| **Automation** | Automation rules & scheduled tasks | AutomationRule, ScheduledTask | AutomationRuleViewSet, ScheduledTaskViewSet | - |
| **Integration** | External platform integrations | SiteIntegration | IntegrationViewSet | - |
| **System** | Settings, prompts, integrations | AIPrompt, IntegrationSettings, AuthorProfile, Strategy | AIPromptViewSet, IntegrationSettingsViewSet, AuthorProfileViewSet | - |
| **Billing** | Credits, transactions, usage | CreditTransaction, CreditUsageLog | CreditTransactionViewSet, CreditUsageLogViewSet | - |
| **Auth** | Multi-tenancy, users, accounts | Account, User, Plan, Site, Sector | AccountViewSet, UserViewSet, SiteViewSet, SectorViewSet | - |
@@ -156,6 +168,12 @@ Task (1) ──< (N) Images
Auth (Core)
├── Planner (depends on Auth)
├── Writer (depends on Auth, Planner)
├── Linker (depends on Auth, Writer)
├── Optimizer (depends on Auth, Writer)
├── Publisher (depends on Auth, Writer, Site Builder)
├── Site Builder (depends on Auth, Planner)
├── Automation (depends on Auth, Planner, Writer)
├── Integration (depends on Auth, Writer)
├── System (depends on Auth)
└── Billing (depends on Auth)
```
@@ -213,6 +231,117 @@ Auth (Core)
- `AuthorProfile`: Writing style profiles
- `Strategy`: Content strategies
#### Linker Module
**Purpose**: Internal linking operations for content
**Features**:
- AI-powered internal linking suggestions
- Content-to-content link analysis
- Cluster-based link recommendations
- Batch linking operations
- Link validation and management
**ViewSets**:
- `LinkerViewSet`: Process content for internal linking
#### Optimizer Module
**Purpose**: Content optimization and scoring
**Features**:
- Content analysis and scoring
- SEO optimization suggestions
- Readability improvements
- Content quality metrics
- Batch optimization operations
**ViewSets**:
- `OptimizerViewSet`: Optimize and analyze content
#### Publisher Module
**Purpose**: Publishing records and site deployment
**Features**:
- Publishing record tracking
- Deployment record management
- Site definition management
- Publishing status tracking
- Multi-destination publishing support
**Models**:
- `PublishingRecord`: Records of content publishing
- `DeploymentRecord`: Site deployment records
**ViewSets**:
- `PublishingRecordViewSet`: Manage publishing records
- `DeploymentRecordViewSet`: Manage deployment records
- `PublisherViewSet`: Publishing operations
#### Site Builder Module
**Purpose**: Site blueprint and structure management
**Features**:
- Site blueprint creation and management
- Page blueprint management
- Cluster attachment to blueprints
- Taxonomy management
- Site structure generation
- Page content generation
- Site asset management
**Models**:
- `SiteBlueprint`: Site structure blueprints
- `PageBlueprint`: Individual page blueprints
- `SiteBlueprintCluster`: Cluster-to-blueprint links
- `SiteBlueprintTaxonomy`: Taxonomy definitions
**ViewSets**:
- `SiteBlueprintViewSet`: Manage site blueprints
- `PageBlueprintViewSet`: Manage page blueprints
- `SiteAssetView`: File management for site assets
- `SiteBuilderMetadataView`: Metadata for site builder
**Note**: Site Builder Wizard UI has been removed. Blueprints can be managed via API.
#### Automation Module
**Purpose**: Automation rules and scheduled tasks
**Features**:
- Automation rule creation and management
- Scheduled task management
- Rule execution tracking
- Trigger-based automation
- Conditional automation workflows
**Models**:
- `AutomationRule`: Automation rule definitions
- `ScheduledTask`: Scheduled task records
**ViewSets**:
- `AutomationRuleViewSet`: Manage automation rules
- `ScheduledTaskViewSet`: Manage scheduled tasks
#### Integration Module
**Purpose**: External platform integrations and synchronization
**Features**:
- Site integration management (WordPress, etc.)
- Integration connection testing
- Content synchronization
- Sync health monitoring
- Multi-platform publishing support
**Models**:
- `SiteIntegration`: Site-to-platform integration records
**ViewSets**:
- `IntegrationViewSet`: Manage site integrations
#### Billing Module
**Purpose**: Credit management and usage tracking
@@ -634,6 +763,12 @@ Results (Account-Isolated)
- `/api/v1/auth/` - Accounts, users, sites, sectors, plans
- `/api/v1/planner/` - Keywords, clusters, ideas
- `/api/v1/writer/` - Tasks, content, images
- `/api/v1/linker/` - Internal linking operations
- `/api/v1/optimizer/` - Content optimization operations
- `/api/v1/publisher/` - Publishing records, deployment records
- `/api/v1/site-builder/` - Site blueprints, page blueprints, assets
- `/api/v1/automation/` - Automation rules, scheduled tasks
- `/api/v1/integration/` - Site integrations, sync operations
- `/api/v1/system/` - Prompts, integrations, author-profiles, strategies
- `/api/v1/billing/` - Credits, transactions, usage
@@ -783,13 +918,18 @@ The IGNY8 application architecture provides:
1. **Multi-Tenancy**: Complete account isolation with automatic filtering
2. **Hierarchical Organization**: Account > Site > Sector > Content structure
3. **Role-Based Access**: Granular permissions for different user roles
4. **Module-Based Design**: Clear separation of concerns across modules
4. **Module-Based Design**: Clear separation of concerns across 10 backend modules
5. **Complete Workflows**: End-to-end workflows from keyword import to publishing
6. **AI Integration**: Unified AI framework for all AI operations
7. **WordPress Integration**: Direct publishing to WordPress sites
8. **Credit System**: Credit-based billing and usage tracking
9. **Security First**: JWT auth, RBAC, data isolation
10. **Scalable Design**: Supports multiple accounts, sites, and users
7. **Content Optimization**: Internal linking and content optimization tools
8. **Publishing System**: Multi-destination publishing with deployment tracking
9. **Site Builder**: Site blueprint and structure management (API-based)
10. **Automation**: Rule-based automation and scheduled tasks
11. **Integration**: External platform integrations and synchronization
12. **WordPress Integration**: Direct publishing to WordPress sites
13. **Credit System**: Credit-based billing and usage tracking
14. **Security First**: JWT auth, RBAC, data isolation
15. **Scalable Design**: Supports multiple accounts, sites, and users
This architecture ensures scalability, maintainability, and extensibility while providing a robust foundation for the IGNY8 platform.

View File

@@ -1,6 +1,6 @@
# IGNY8 Frontend Architecture Documentation
**Last Updated:** 2025-01-XX
**Last Updated:** 2025-01-XX (Added Sites Renderer application, updated routing with Linker/Optimizer/Sites modules, fixed React Router versions)
**Version:** 1.0
**Purpose:** Master-level architecture and functional documentation for the IGNY8 frontend application, covering structure, routing, state management, build system, and all functional details.
@@ -30,12 +30,13 @@
## Executive Summary
The IGNY8 frontend is a modern, dual-application React-based system consisting of:
The IGNY8 frontend is a modern, triple-application React-based system consisting of:
1. **Main Application** (`app.igny8.com`): A full-featured SaaS platform for SEO content management with authentication, multi-tenancy, and complex workflows
2. **Marketing Site** (`igny8.com`): A public-facing marketing website with SEO-optimized pages
3. **Sites Renderer** (`sites.igny8.com`): A public-facing site renderer that serves deployed IGNY8-hosted sites
Both applications share the same codebase but are built and deployed separately, using different entry points, routing, and build configurations.
All three applications share components and utilities but are built and deployed separately, using different entry points, routing, and build configurations.
### Key Characteristics
@@ -67,7 +68,8 @@ Both applications share the same codebase but are built and deployed separately,
|------------|---------|---------|
| **React** | 19.0.0 | UI library |
| **React DOM** | 19.0.0 | DOM rendering |
| **React Router** | 7.9.5 | Client-side routing |
| **react-router** | ^7.1.5 | Core routing library |
| **react-router-dom** | ^7.9.5 | DOM bindings for React Router |
| **Zustand** | 5.0.8 | State management |
| **Vite** | 6.1.0 | Build tool & dev server |
@@ -87,6 +89,7 @@ Both applications share the same codebase but are built and deployed separately,
{
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7.1.5",
"react-router-dom": "^7.9.5",
"zustand": "^5.0.8",
"typescript": "~5.7.2"
@@ -144,15 +147,15 @@ Both applications share the same codebase but are built and deployed separately,
│ Frontend Application │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────────┐ ┌──────────────────────┐ │
│ │ Main Application │ │ Marketing Site │ │
│ │ (app.igny8.com) │ │ (igny8.com) │ │
│ ├──────────────────────┤ ├──────────────────────┤ │
│ │ • Authentication │ │ • Public Pages │ │
│ │ • Multi-tenant │ │ • SEO Optimized │ │
│ │ • Protected Routes │ │ • No Authentication │ │
│ │ • Complex Workflows │ │ • Static Content │ │
│ └──────────────────────┘ └──────────────────────┘ │
│ ┌──────────────────────┐ ┌──────────────────────┐ ┌──────────────────────┐
│ │ Main Application │ │ Marketing Site │ │ Sites Renderer │ │
│ │ (app.igny8.com) │ │ (igny8.com) │ │ (sites.igny8.com) │ │
│ ├──────────────────────┤ ├──────────────────────┤ ├──────────────────────┤
│ │ • Authentication │ │ • Public Pages │ │ • Public Sites │ │
│ │ • Multi-tenant │ │ • SEO Optimized │ │ • Dynamic Content │ │
│ │ • Protected Routes │ │ • No Authentication │ │ • No Authentication │ │
│ │ • Complex Workflows │ │ • Static Content │ │ • Site Blueprints │ │
│ └──────────────────────┘ └──────────────────────┘ └──────────────────────┘
│ │ │ │
│ └──────────┬───────────────────┘ │
│ │ │
@@ -187,6 +190,13 @@ Both applications share the same codebase but are built and deployed separately,
- **Port**: 5174 (dev), 8023 (Docker)
- **Domain**: `igny8.com`
#### Sites Renderer Entry
- **File**: `sites/src/main.tsx` (separate repository/package)
- **HTML**: `sites/index.html`
- **Port**: 5176 (dev), 8024 (Docker)
- **Domain**: `sites.igny8.com`
- **Purpose**: Renders deployed public sites from Site Blueprints
---
## Project Structure
@@ -274,12 +284,18 @@ frontend/
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript config
├── package.json # Dependencies
── Dockerfile* # Docker files
── Dockerfile* # Docker files
└── sites/ # Sites Renderer (separate app)
├── src/ # Sites renderer source
├── index.html # Sites renderer HTML
├── vite.config.ts # Sites Vite config
├── package.json # Sites dependencies
└── Dockerfile.dev # Sites dev Dockerfile
```
---
## Dual Application Architecture
## Triple Application Architecture
### Main Application (`app.igny8.com`)
@@ -358,6 +374,42 @@ frontend/
- Open Graph tags
- Twitter Card tags
### Sites Renderer (`sites.igny8.com`)
**Purpose**: Public-facing site renderer for deployed IGNY8-hosted sites
**Characteristics**:
- No authentication required
- Dynamic content from Site Blueprints
- Public access to deployed sites
- Separate codebase (`sites/` directory)
- React Router for site navigation
- API integration for blueprint data
**Entry Point**: `sites/src/main.tsx``sites/src/App.tsx`
**Technology Stack**:
- React 19.2.0
- React Router DOM 7.9.6
- TypeScript 5.9.3
- Vite 7.2.2
- Zustand 5.0.8
- Axios 1.13.2
**Features**:
- Loads site definitions from backend API
- Renders pages from Page Blueprints
- Dynamic routing based on site structure
- SEO-optimized pages
- Responsive design
**Data Flow**:
1. Site slug extracted from URL
2. API call to fetch Site Blueprint
3. Page Blueprints loaded
4. Content rendered from blueprints
5. Navigation generated from site structure
---
## Routing Architecture
@@ -411,10 +463,34 @@ frontend/
<Route path="/reference/seed-keywords" element={<SeedKeywords />} />
<Route path="/reference/industries" element={<ReferenceIndustries />} />
{/* Linker Module */}
<Route path="/linker" element={<Navigate to="/linker/content" replace />} />
<Route path="/linker/content" element={<LinkerContent />} />
{/* Optimizer Module */}
<Route path="/optimizer" element={<Navigate to="/optimizer/content" replace />} />
<Route path="/optimizer/content" element={<OptimizerContent />} />
<Route path="/optimizer/analyze/:id" element={<OptimizerAnalyze />} />
{/* Automation */}
<Route path="/automation" element={<AutomationDashboard />} />
{/* Note: Schedules functionality is integrated into Automation Dashboard */}
{/* Sites Module */}
<Route path="/sites" element={<SiteList />} />
<Route path="/sites/manage" element={<SiteManage />} />
<Route path="/sites/:id" element={<SiteDashboard />} />
<Route path="/sites/:id/content" element={<SiteContent />} />
<Route path="/sites/:id/editor" element={<SiteEditor />} />
<Route path="/sites/:id/pages" element={<PageManager />} />
<Route path="/sites/:id/pages/new" element={<PageManager />} />
<Route path="/sites/:id/pages/:pageId/edit" element={<PageManager />} />
<Route path="/sites/:id/posts/:postId" element={<PostEditor />} />
<Route path="/sites/:id/preview" element={<SitePreview />} />
<Route path="/sites/:id/settings" element={<SiteSettings />} />
<Route path="/sites/:id/sync" element={<SyncDashboard />} />
<Route path="/sites/:id/deploy" element={<DeploymentPanel />} />
{/* Settings */}
<Route path="/settings" element={<GeneralSettings />} />
<Route path="/settings/users" element={<Users />} />
@@ -458,6 +534,26 @@ frontend/
- Reduces initial bundle size
- Improves time-to-interactive
### Sites Renderer Routing
**Router**: React Router v7 (`BrowserRouter`)
**Structure**:
- Dynamic routing based on Site Blueprint structure
- Routes generated from Page Blueprints
- Public access (no authentication)
- SEO-friendly URLs
**Key Routes**:
- `/:siteSlug` - Site home page
- `/:siteSlug/:pageSlug` - Individual pages
- Dynamic navigation from site structure
**Data Loading**:
- Site Blueprint loaded on mount
- Page Blueprints loaded per route
- Content rendered from blueprint data
### Marketing Site Routing
**Router**: React Router v7 (`BrowserRouter`)
@@ -1051,6 +1147,12 @@ build: {
- Marketing-specific configuration
- SEO-friendly development
**Sites Renderer** (Port 5176):
- Separate Vite configuration (`sites/vite.config.ts`)
- Public site rendering
- API integration for blueprints
- Dynamic routing from site structure
#### 4. Custom Plugins
**bypassHostCheck**:
@@ -1128,6 +1230,13 @@ npm run dev:marketing
# Runs on http://localhost:5174
```
**Sites Renderer**:
```bash
cd sites
npm run dev
# Runs on http://localhost:5176
```
#### 3. Build for Production
**Main Application**:
@@ -1142,6 +1251,13 @@ npm run build:marketing
# Output: dist/marketing.html
```
**Sites Renderer**:
```bash
cd sites
npm run build
# Output: sites/dist/
```
### Docker Development
#### Main App Container
@@ -1177,6 +1293,8 @@ docker run -p 8023:5174 \
| `dev:marketing` | `PORT=5174 vite --port 5174` | Start marketing dev server |
| `build` | `vite build` | Build main app |
| `build:marketing` | `vite build --mode marketing` | Build marketing site |
| `sites:dev` | `cd sites && npm run dev` | Start sites renderer dev server (Port 5176) |
| `sites:build` | `cd sites && npm run build` | Build sites renderer |
| `type-check` | `tsc -b --noEmit` | Type checking |
| `lint` | `eslint .` | Lint code |
@@ -1206,6 +1324,25 @@ dist/
- Static file serving
- SPA routing fallback
#### Sites Renderer
**Build Output**:
```
sites/dist/
├── index.html
├── assets/
│ ├── js/
│ │ └── [hash].js
│ └── css/
│ └── [hash].css
```
**Deployment**:
- Separate Docker container (`igny8_sites`)
- Served via Caddy reverse proxy
- Dynamic routing from Site Blueprints
- Public access (no authentication)
#### Marketing Site
**Build Output**:
@@ -1277,6 +1414,21 @@ CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
}
```
#### Sites Renderer (`Caddyfile.sites`)
```caddy
sites.igny8.com {
reverse_proxy igny8_sites:5176
encode gzip zstd
}
```
**Features**:
- Public access (no authentication)
- Dynamic routing from Site Blueprints
- SEO-friendly URLs
- HTTPS via Caddy
#### Marketing Site (`Caddyfile.marketing`)
```caddy

View File

@@ -1,6 +1,6 @@
# IGNY8 Backend Implementation Reference
**Last Updated:** 2025-01-XX
**Last Updated:** 2025-01-XX (Added 6 missing modules: Linker, Optimizer, Publisher, Site Builder, Automation, Integration)
**Purpose:** Complete backend implementation reference covering project structure, models, ViewSets, serializers, Celery tasks, API endpoints, base classes, middleware, and utilities.
---
@@ -67,26 +67,56 @@ backend/igny8_core/
│ └── urls.py # Auth module URLs
├── modules/ # Feature modules
│ ├── planner/ # Keywords, Clusters, Ideas
│ │ ├── models.py # Keywords, Clusters, ContentIdeas models
│ │ ├── views.py # KeywordViewSet, ClusterViewSet, ContentIdeasViewSet
│ │ ├── tasks.py # Celery tasks for AI operations
│ │ ├── serializers.py # Model serializers
│ │ └── urls.py # Planner module URLs
│ ├── writer/ # Tasks, Content, Images
│ │ ├── models.py # Tasks, Content, Images models
│ │ ├── views.py # TasksViewSet, ImagesViewSet
│ │ ├── tasks.py # Celery tasks for content/image generation
│ │ ├── views.py # TasksViewSet, ContentViewSet, ImagesViewSet
│ │ ├── serializers.py # Model serializers
│ │ └── urls.py # Writer module URLs
│ ├── linker/ # Internal linking
│ │ ├── views.py # LinkerViewSet
│ │ ├── serializers.py # Link serializers
│ │ └── urls.py # Linker module URLs
│ ├── optimizer/ # Content optimization
│ │ ├── views.py # OptimizerViewSet
│ │ ├── serializers.py # Optimizer serializers
│ │ └── urls.py # Optimizer module URLs
│ ├── publisher/ # Publishing & deployment
│ │ ├── views.py # PublishingRecordViewSet, DeploymentRecordViewSet, PublisherViewSet
│ │ └── urls.py # Publisher module URLs
│ ├── site_builder/ # Site blueprint management
│ │ ├── views.py # SiteBlueprintViewSet, PageBlueprintViewSet, SiteAssetView
│ │ ├── serializers.py # Site builder serializers
│ │ └── urls.py # Site Builder module URLs
│ ├── automation/ # Automation rules
│ │ ├── views.py # AutomationRuleViewSet, ScheduledTaskViewSet
│ │ ├── serializers.py # Automation serializers
│ │ └── urls.py # Automation module URLs
│ ├── integration/ # External integrations
│ │ ├── views.py # IntegrationViewSet
│ │ └── urls.py # Integration module URLs
│ ├── system/ # Settings, Prompts, Integration
│ │ ├── models.py # AIPrompt, IntegrationSettings, AuthorProfile, Strategy
│ │ ├── views.py # AIPromptViewSet, AuthorProfileViewSet
│ │ ├── settings_views.py # SystemSettingsViewSet, AccountSettingsViewSet
│ │ ├── integration_views.py # IntegrationSettingsViewSet, task_progress
│ │ ├── utils.py # Default prompts, prompt loading
│ │ └── urls.py # System module URLs
│ └── billing/ # Credits, Transactions, Usage
│ ├── models.py # CreditTransaction, CreditUsageLog models
│ ├── views.py # Billing ViewSets
│ └── services.py # CreditService
│ ├── views.py # CreditTransactionViewSet, CreditBalanceViewSet, CreditUsageViewSet
│ ├── services.py # CreditService
│ └── urls.py # Billing module URLs
├── business/ # Business logic layer
│ ├── planning/ # Planner models (Keywords, Clusters, ContentIdeas)
│ ├── content/ # Writer models (Tasks, Content, Images)
│ ├── linking/ # Linker services
│ ├── optimization/ # Optimizer services
│ ├── publishing/ # Publisher models (PublishingRecord, DeploymentRecord)
│ ├── site_building/ # Site Builder models (SiteBlueprint, PageBlueprint, etc.)
│ ├── automation/ # Automation models (AutomationRule, ScheduledTask)
│ ├── integration/ # Integration models (SiteIntegration)
│ └── billing/ # Billing models (CreditTransaction, CreditUsageLog)
├── api/ # API base classes
│ ├── base.py # AccountModelViewSet, SiteSectorModelViewSet
│ └── pagination.py # CustomPageNumberPagination
@@ -489,6 +519,17 @@ backend/igny8_core/
- Filters: `status`, `cluster_id`, `content_type`, `content_structure`
- Ordering: `title`, `created_at`, `word_count`, `status`
#### ContentViewSet
**Inherits**: `SiteSectorModelViewSet`
**Actions**:
- `list()`: List content
- `create()`: Create content
- `retrieve()`: Get content details
- `update()`: Update content
- `destroy()`: Delete content
- `publish_to_wordpress()`: Publish content to WordPress
#### ImagesViewSet
**Inherits**: `SiteSectorModelViewSet`
@@ -500,6 +541,150 @@ backend/igny8_core/
- `destroy()`: Delete image
- `generate_images()`: Generate images using AI
### Linker ViewSets
#### LinkerViewSet
**Inherits**: `viewsets.ViewSet`
**Actions**:
- `process()`: Process a single content item for internal linking
- `batch_process()`: Process multiple content items for internal linking
**Purpose**: AI-powered internal linking suggestions based on cluster matches
### Optimizer ViewSets
#### OptimizerViewSet
**Inherits**: `viewsets.ViewSet`
**Actions**:
- `optimize()`: Optimize content (auto-detects entry point)
- `batch_optimize()`: Batch optimize multiple content items
- `analyze()`: Analyze content without optimization
**Purpose**: Content optimization and scoring
### Publisher ViewSets
#### PublishingRecordViewSet
**Inherits**: `SiteSectorModelViewSet`
**Actions**:
- `list()`: List publishing records
- `create()`: Create publishing record
- `retrieve()`: Get publishing record details
- `update()`: Update publishing record
- `destroy()`: Delete publishing record
#### DeploymentRecordViewSet
**Inherits**: `SiteSectorModelViewSet`
**Actions**:
- `list()`: List deployment records
- `create()`: Create deployment record
- `retrieve()`: Get deployment record details
- `update()`: Update deployment record
- `destroy()`: Delete deployment record
#### PublisherViewSet
**Inherits**: `viewsets.ViewSet`
**Actions**:
- `publish()`: Publish content to destination
- `deploy()`: Deploy site blueprint
- `check_readiness()`: Check deployment readiness
#### SiteDefinitionView
**Inherits**: `APIView`
**Purpose**: Public endpoint for Sites Renderer to fetch site definitions
### Site Builder ViewSets
#### SiteBlueprintViewSet
**Inherits**: `SiteSectorModelViewSet`
**Actions**:
- `list()`: List site blueprints
- `create()`: Create site blueprint
- `retrieve()`: Get site blueprint details
- `update()`: Update site blueprint
- `destroy()`: Delete site blueprint
- `generate_structure()`: Generate site structure using AI
- `generate_all_pages()`: Generate all pages for blueprint
- `create_tasks()`: Create Writer tasks for pages
- `progress()`: Get cluster-level completion status
- `attach_clusters()`: Attach planner clusters to blueprint
- `detach_clusters()`: Detach clusters from blueprint
- `list_taxonomies()`: List taxonomies for blueprint
- `create_taxonomy()`: Create taxonomy for blueprint
- `import_taxonomies()`: Import taxonomies from external source
- `bulk_delete()`: Bulk delete blueprints
#### PageBlueprintViewSet
**Inherits**: `SiteSectorModelViewSet`
**Actions**:
- `list()`: List page blueprints
- `create()`: Create page blueprint
- `retrieve()`: Get page blueprint details
- `update()`: Update page blueprint
- `destroy()`: Delete page blueprint
- `generate_content()`: Generate content for page
- `regenerate()`: Regenerate page content
#### SiteAssetView
**Inherits**: `APIView`
**Actions**:
- `GET`: List files for site
- `POST`: Upload file
- `DELETE`: Delete file
#### SiteBuilderMetadataView
**Inherits**: `APIView`
**Actions**:
- `GET`: Get metadata (business types, audience profiles, brand personalities, hero imagery)
### Automation ViewSets
#### AutomationRuleViewSet
**Inherits**: `SiteSectorModelViewSet`
**Actions**:
- `list()`: List automation rules
- `create()`: Create automation rule
- `retrieve()`: Get automation rule details
- `update()`: Update automation rule
- `destroy()`: Delete automation rule
- `execute()`: Manually execute automation rule
#### ScheduledTaskViewSet
**Inherits**: `AccountModelViewSet`
**Actions**:
- `list()`: List scheduled tasks
- `create()`: Create scheduled task
- `retrieve()`: Get scheduled task details
- `update()`: Update scheduled task
- `destroy()`: Delete scheduled task
### Integration ViewSets
#### IntegrationViewSet
**Inherits**: `SiteSectorModelViewSet`
**Actions**:
- `list()`: List site integrations
- `create()`: Create site integration
- `retrieve()`: Get integration details
- `update()`: Update integration
- `destroy()`: Delete integration
- `test_connection()`: Test connection to integrated platform
- `sync()`: Sync content with integrated platform
- `sync_health()`: Check sync health status
### System ViewSets
#### IntegrationSettingsViewSet
@@ -575,6 +760,57 @@ backend/igny8_core/
#### IntegrationSettingsSerializer
**Fields**: All IntegrationSettings model fields
### Linker Serializers
#### LinkContentSerializer
**Fields**: `content_id`
#### BatchLinkContentSerializer
**Fields**: `content_ids` (array)
### Optimizer Serializers
#### OptimizeContentSerializer
**Fields**: `content_id`, `entry_point` (optional)
#### BatchOptimizeContentSerializer
**Fields**: `content_ids` (array), `entry_point` (optional)
#### AnalyzeContentSerializer
**Fields**: `content_id`
### Publisher Serializers
#### PublishingRecordSerializer
**Fields**: All PublishingRecord model fields
#### DeploymentRecordSerializer
**Fields**: All DeploymentRecord model fields
### Site Builder Serializers
#### SiteBlueprintSerializer
**Fields**: All SiteBlueprint model fields, includes nested `pages`
#### PageBlueprintSerializer
**Fields**: All PageBlueprint model fields
#### SiteBuilderMetadataSerializer
**Fields**: `business_types`, `audience_profiles`, `brand_personalities`, `hero_imagery_directions`
### Automation Serializers
#### AutomationRuleSerializer
**Fields**: All AutomationRule model fields
#### ScheduledTaskSerializer
**Fields**: All ScheduledTask model fields
### Integration Serializers
#### SiteIntegrationSerializer
**Fields**: All SiteIntegration model fields
---
## Celery Tasks
@@ -675,9 +911,77 @@ backend/igny8_core/
### Writer Endpoints
- `GET /api/v1/writer/tasks/` - List tasks
- `POST /api/v1/writer/tasks/` - Create task
- `GET /api/v1/writer/tasks/{id}/` - Get task details
- `POST /api/v1/writer/tasks/auto_generate_content/` - Auto-generate content
- `GET /api/v1/writer/content/` - List content
- `GET /api/v1/writer/content/{id}/` - Get content details
- `POST /api/v1/writer/images/generate_images/` - Generate images
### Linker Endpoints
- `POST /api/v1/linker/process/` - Process content for internal linking
- `POST /api/v1/linker/batch_process/` - Batch process content for linking
### Optimizer Endpoints
- `POST /api/v1/optimizer/optimize/` - Optimize content
- `POST /api/v1/optimizer/batch_optimize/` - Batch optimize content
- `POST /api/v1/optimizer/analyze/` - Analyze content
### Publisher Endpoints
- `GET /api/v1/publisher/publishing-records/` - List publishing records
- `POST /api/v1/publisher/publishing-records/` - Create publishing record
- `GET /api/v1/publisher/deployments/` - List deployment records
- `POST /api/v1/publisher/deployments/` - Create deployment record
- `POST /api/v1/publisher/publish/` - Publish content
- `POST /api/v1/publisher/deploy/` - Deploy site blueprint
- `GET /api/v1/publisher/sites/{site_id}/definition/` - Get site definition (public)
### Site Builder Endpoints
- `GET /api/v1/site-builder/blueprints/` - List site blueprints
- `POST /api/v1/site-builder/blueprints/` - Create site blueprint
- `GET /api/v1/site-builder/blueprints/{id}/` - Get blueprint details
- `POST /api/v1/site-builder/blueprints/{id}/generate_structure/` - Generate structure
- `POST /api/v1/site-builder/blueprints/{id}/generate_all_pages/` - Generate all pages
- `POST /api/v1/site-builder/blueprints/{id}/create_tasks/` - Create tasks for pages
- `GET /api/v1/site-builder/blueprints/{id}/progress/` - Get progress
- `POST /api/v1/site-builder/blueprints/{id}/clusters/attach/` - Attach clusters
- `POST /api/v1/site-builder/blueprints/{id}/clusters/detach/` - Detach clusters
- `GET /api/v1/site-builder/blueprints/{id}/taxonomies/` - List taxonomies
- `POST /api/v1/site-builder/blueprints/{id}/taxonomies/` - Create taxonomy
- `POST /api/v1/site-builder/blueprints/{id}/taxonomies/import/` - Import taxonomies
- `POST /api/v1/site-builder/blueprints/bulk_delete/` - Bulk delete blueprints
- `GET /api/v1/site-builder/pages/` - List page blueprints
- `POST /api/v1/site-builder/pages/` - Create page blueprint
- `GET /api/v1/site-builder/pages/{id}/` - Get page details
- `POST /api/v1/site-builder/pages/{id}/generate_content/` - Generate content
- `POST /api/v1/site-builder/pages/{id}/regenerate/` - Regenerate page
- `GET /api/v1/site-builder/assets/` - List assets
- `POST /api/v1/site-builder/assets/` - Upload asset
- `DELETE /api/v1/site-builder/assets/` - Delete asset
- `GET /api/v1/site-builder/metadata/` - Get metadata
### Automation Endpoints
- `GET /api/v1/automation/rules/` - List automation rules
- `POST /api/v1/automation/rules/` - Create automation rule
- `GET /api/v1/automation/rules/{id}/` - Get rule details
- `POST /api/v1/automation/rules/{id}/execute/` - Execute rule
- `GET /api/v1/automation/scheduled-tasks/` - List scheduled tasks
- `POST /api/v1/automation/scheduled-tasks/` - Create scheduled task
### Integration Endpoints
- `GET /api/v1/integration/integrations/` - List site integrations
- `POST /api/v1/integration/integrations/` - Create integration
- `GET /api/v1/integration/integrations/{id}/` - Get integration details
- `POST /api/v1/integration/integrations/{id}/test_connection/` - Test connection
- `POST /api/v1/integration/integrations/{id}/sync/` - Sync content
- `GET /api/v1/integration/integrations/{id}/sync_health/` - Get sync health
### System Endpoints
- `GET /api/v1/system/settings/integrations/{pk}/` - Get integration settings
@@ -772,29 +1076,170 @@ backend/igny8_core/
**Purpose**: Content generation and management
**Models**: Tasks, Content, Images
**Models** (in `business/content/`):
- `Tasks`: Content generation tasks
- `Content`: Generated content pieces
- `Images`: Generated images
- `ContentClusterMap`: Content-to-cluster mapping
- `ContentTaxonomyMap`: Content taxonomy mapping
- `ContentAttributeMap`: Content attribute mapping
**ViewSets**: TasksViewSet, ImagesViewSet
**ViewSets**:
- `TasksViewSet`: CRUD + auto-generate content, bulk operations
- `ContentViewSet`: CRUD + publish to WordPress
- `ImagesViewSet`: CRUD + generate images
**Tasks**: Auto-generate content, Generate images
**URLs**: `/api/v1/writer/`
### Linker Module
**Purpose**: Internal linking operations
**ViewSets**:
- `LinkerViewSet`: Process content for internal linking
**Actions**:
- `process()`: Process single content item
- `batch_process()`: Process multiple content items
**URLs**: `/api/v1/linker/`
### Optimizer Module
**Purpose**: Content optimization and scoring
**ViewSets**:
- `OptimizerViewSet`: Content optimization operations
**Actions**:
- `optimize()`: Optimize content (auto-detects entry point)
- `batch_optimize()`: Batch optimize content
- `analyze()`: Analyze content without optimization
**URLs**: `/api/v1/optimizer/`
### Publisher Module
**Purpose**: Publishing records and site deployment
**Models** (in `business/publishing/`):
- `PublishingRecord`: Records of content publishing
- `DeploymentRecord`: Records of site deployments
**ViewSets**:
- `PublishingRecordViewSet`: CRUD for publishing records
- `DeploymentRecordViewSet`: CRUD for deployment records
- `PublisherViewSet`: Publishing and deployment actions
- `SiteDefinitionView`: Public endpoint for Sites Renderer
**Actions**:
- `publish()`: Publish content to destination
- `deploy()`: Deploy site blueprint
- `check_readiness()`: Check deployment readiness
**URLs**: `/api/v1/publisher/`
### Site Builder Module
**Purpose**: Site blueprint management
**Models** (in `business/site_building/`):
- `SiteBlueprint`: Site structure definitions
- `PageBlueprint`: Page structure definitions
- `SiteBlueprintCluster`: Cluster-to-blueprint mapping
- `SiteBlueprintTaxonomy`: Taxonomy definitions
- `SiteBuilderOption`: Site builder configuration options
**ViewSets**:
- `SiteBlueprintViewSet`: CRUD + structure generation, cluster management
- `PageBlueprintViewSet`: CRUD + content generation
- `SiteAssetView`: Asset management
- `SiteBuilderMetadataView`: Metadata retrieval
**Actions**:
- `generate_structure()`: Generate site structure using AI
- `generate_all_pages()`: Generate all pages for blueprint
- `create_tasks()`: Create Writer tasks for pages
- `progress()`: Get cluster-level completion status
- `attach_clusters()`: Attach planner clusters
- `detach_clusters()`: Detach clusters
- `generate_content()`: Generate content for page
- `regenerate()`: Regenerate page content
**URLs**: `/api/v1/site-builder/`
**Note**: Site Builder Wizard UI has been removed. Only API-based blueprint management remains.
### Automation Module
**Purpose**: Automation rules and scheduled tasks
**Models** (in `business/automation/`):
- `AutomationRule`: Rule-based automation definitions
- `ScheduledTask`: Scheduled task definitions
**ViewSets**:
- `AutomationRuleViewSet`: CRUD + execute rule
- `ScheduledTaskViewSet`: CRUD for scheduled tasks
**Actions**:
- `execute()`: Manually execute automation rule
**URLs**: `/api/v1/automation/`
### Integration Module
**Purpose**: External platform integrations
**Models** (in `business/integration/`):
- `SiteIntegration`: Site-level integration configurations
**ViewSets**:
- `IntegrationViewSet`: CRUD + sync operations
**Actions**:
- `test_connection()`: Test connection to integrated platform
- `sync()`: Sync content with integrated platform
- `sync_health()`: Check sync health status
**URLs**: `/api/v1/integration/`
### System Module
**Purpose**: System configuration and AI settings
**Models**: AIPrompt, IntegrationSettings, AuthorProfile, Strategy
**Models**:
- `AIPrompt`: AI prompt templates
- `IntegrationSettings`: Account-level integration settings
- `AuthorProfile`: Author profile definitions
- `Strategy`: Content strategy definitions
**ViewSets**: AIPromptViewSet, IntegrationSettingsViewSet, AuthorProfileViewSet
**ViewSets**:
- `AIPromptViewSet`: CRUD + reset to default
- `IntegrationSettingsViewSet`: Integration settings management
- `AuthorProfileViewSet`: CRUD for author profiles
- `SystemSettingsViewSet`: System settings management
- `AccountSettingsViewSet`: Account settings management
**URLs**: `/api/v1/system/`
### Billing Module
**Purpose**: Credit management and usage tracking
**Models**: CreditTransaction, CreditUsageLog
**Models** (in `business/billing/`):
- `CreditTransaction`: Credit transaction records
- `CreditUsageLog`: Credit usage logging
**ViewSets**: CreditTransactionViewSet, CreditUsageLogViewSet
**ViewSets**:
- `CreditTransactionViewSet`: CRUD for transactions
- `CreditBalanceViewSet`: Credit balance retrieval
- `CreditUsageViewSet`: Credit usage tracking
**Services**: CreditService (check, deduct, add, calculate credits)
**Services**:
- `CreditService`: Credit operations (check, deduct, add, calculate)
**URLs**: `/api/v1/billing/`
---
@@ -808,10 +1253,16 @@ The IGNY8 backend provides:
4. **Hierarchical Organization**: Account > Site > Sector > Content structure
5. **AI Framework**: Unified AI framework for all AI operations
6. **Progress Tracking**: Real-time progress updates for Celery tasks
7. **Module-Based Design**: Clear separation of concerns
7. **Module-Based Design**: Clear separation of concerns across 10 modules
8. **Base Classes**: Reusable ViewSets for common patterns
9. **Middleware**: Account context and resource tracking
10. **Utilities**: Content processing and AI integration
11. **Internal Linking**: AI-powered internal linking suggestions
12. **Content Optimization**: Content optimization and scoring
13. **Publishing System**: Multi-destination publishing with deployment tracking
14. **Site Builder**: Site blueprint and structure management (API-based)
15. **Automation**: Rule-based automation and scheduled tasks
16. **Integration**: External platform integrations and synchronization
This architecture ensures scalability, maintainability, and extensibility while providing a robust foundation for the IGNY8 platform.
This architecture ensures scalability, maintainability, and extensibility while providing a robust foundation for the IGNY8 platform with 10 backend modules covering the complete content workflow from planning to publishing.

View File

@@ -1,7 +1,7 @@
# IGNY8 AI Framework Implementation Reference
**Last Updated:** 2025-01-XX
**Purpose:** Complete AI framework implementation reference covering architecture, code structure, all 5 AI functions, execution flow, progress tracking, cost tracking, prompt management, and model configuration.
**Last Updated:** 2025-01-XX (Added 3 missing AI functions: generate_site_structure, optimize_content, generate_page_content)
**Purpose:** Complete AI framework implementation reference covering architecture, code structure, all 8 AI functions, execution flow, progress tracking, cost tracking, prompt management, and model configuration.
---
@@ -39,6 +39,9 @@ The IGNY8 AI framework provides a unified interface for all AI operations. All A
3. **Generate Content**: Generate blog post and article content
4. **Generate Image Prompts**: Extract image prompts from content
5. **Generate Images**: Generate images using OpenAI DALL-E or Runware
6. **Generate Site Structure**: Create site/page architecture from business brief
7. **Optimize Content**: Optimize content for SEO, readability, and engagement
8. **Generate Page Content**: Generate structured page content with JSON blocks for Site Builder
---
@@ -87,6 +90,17 @@ The IGNY8 AI framework provides a unified interface for all AI operations. All A
- `get_function_instance` - Gets function instance by name
- `list_functions` - Lists all registered functions
**Registered Functions** (7 lazy-loaded):
1. `auto_cluster` - AutoClusterFunction
2. `generate_ideas` - GenerateIdeasFunction
3. `generate_content` - GenerateContentFunction
4. `generate_images` - GenerateImagesFunction
5. `generate_image_prompts` - GenerateImagePromptsFunction
6. `generate_site_structure` - GenerateSiteStructureFunction
7. `optimize_content` - OptimizeContentFunction
**Note**: `generate_page_content` exists as a function but may be called directly without registry registration.
#### AI Core Handler
**File**: `backend/igny8_core/ai/ai_core.py`
**Class**: `AICore`
@@ -111,6 +125,9 @@ The IGNY8 AI framework provides a unified interface for all AI operations. All A
- `image_prompt_extraction` - For extract_image_prompts function
- `image_prompt_template` - Template for formatting image prompts
- `negative_prompt` - Negative prompt for Runware image generation
- `site_structure_generation` - For generate_site_structure function
- `content_optimization` - For optimize_content function
- `page_content_generation` - For generate_page_content function
#### Model Settings
**File**: `backend/igny8_core/ai/settings.py`
@@ -352,6 +369,118 @@ The IGNY8 AI framework provides a unified interface for all AI operations. All A
- PARSE: "Processing image response"
- SAVE: "Saving generated image(s)"
### 6. Generate Site Structure
**Purpose**: Create site/page architecture from business brief, objectives, and style guides
**Function Class**: `GenerateSiteStructureFunction`
**File**: `backend/igny8_core/ai/functions/generate_site_structure.py`
**API Endpoint**:
- **ViewSet**: `SiteBlueprintViewSet`
- **Action**: `generate_structure`
- **Method**: POST
- **URL Path**: `/v1/site-builder/blueprints/{id}/generate_structure/`
- **Payload**: `ids` (list[int]) - Site Blueprint IDs
**Function Methods**:
- `get_name()`: Returns `'generate_site_structure'`
- `validate(payload, account)`: Validates blueprint ID exists
- `prepare(payload, account)`: Loads site blueprint with related data
- `build_prompt(data, account)`: Builds site structure generation prompt with business brief, objectives, style guides
- `parse_response(response, step_tracker)`: Parses site structure JSON (pages, blocks, navigation)
- `save_output(parsed, original_data, account, progress_tracker, step_tracker)`: Creates PageBlueprint records with blocks
**Input**: Site Blueprint ID
**Output**: PageBlueprint records created with structured blocks
**Progress Messages**:
- INIT: "Validating blueprint data…"
- PREP: "Preparing site context…"
- AI_CALL: "Generating site structure with AI…"
- PARSE: "Parsing generated blueprint…"
- SAVE: "Saving pages and blocks…"
- DONE: "Site structure ready!"
### 7. Optimize Content
**Purpose**: Optimize content for SEO, readability, and engagement
**Function Class**: `OptimizeContentFunction`
**File**: `backend/igny8_core/ai/functions/optimize_content.py`
**API Endpoint**:
- **ViewSet**: `OptimizerViewSet`
- **Action**: `optimize` or `analyze`
- **Method**: POST
- **URL Path**: `/v1/optimizer/optimize/` or `/v1/optimizer/analyze/`
- **Payload**: `ids` (list[int]) - Content IDs, `entry_point` (optional, str)
**Function Methods**:
- `get_name()`: Returns `'optimize_content'`
- `validate(payload, account)`: Validates content IDs exist
- `prepare(payload, account)`: Loads content with related data
- `build_prompt(data, account)`: Builds optimization prompt with content, SEO targets, readability goals
- `parse_response(response, step_tracker)`: Parses optimized content JSON
- `save_output(parsed, original_data, account, progress_tracker, step_tracker)`: Updates Content records with optimized content and scores
**Input**: List of content IDs
**Output**: Content records updated with optimized content, SEO scores, readability scores
**Optimization Features**:
- SEO optimization (keyword density, meta descriptions, headings)
- Readability improvements (sentence length, paragraph structure)
- Engagement enhancements (call-to-actions, internal links)
- Content scoring (SEO score, readability score, engagement score)
**Progress Messages**:
- INIT: "Validating content data…"
- PREP: "Preparing content context…"
- AI_CALL: "Optimizing content with AI…"
- PARSE: "Parsing optimized content…"
- SAVE: "Saving optimized content…"
- DONE: "Content optimized!"
### 8. Generate Page Content
**Purpose**: Generate structured page content with JSON blocks for Site Builder pages
**Function Class**: `GeneratePageContentFunction`
**File**: `backend/igny8_core/ai/functions/generate_page_content.py`
**API Endpoint**:
- **ViewSet**: `PageBlueprintViewSet`
- **Action**: `generate_content` or `regenerate`
- **Method**: POST
- **URL Path**: `/v1/site-builder/pages/{id}/generate_content/` or `/v1/site-builder/pages/{id}/regenerate/`
- **Payload**: `ids` (list[int]) - Page Blueprint IDs (max 20)
**Function Methods**:
- `get_name()`: Returns `'generate_page_content'`
- `get_max_items()`: Returns `20` (max pages per batch)
- `validate(payload, account)`: Validates page blueprint IDs exist
- `prepare(payload, account)`: Loads page blueprints with related data
- `build_prompt(data, account)`: Builds page content generation prompt optimized for Site Builder
- `parse_response(response, step_tracker)`: Parses JSON blocks format
- `save_output(parsed, original_data, account, progress_tracker, step_tracker)`: Updates PageBlueprint records with blocks_json
**Input**: List of page blueprint IDs
**Output**: PageBlueprint records updated with structured blocks_json
**Key Differences from Generate Content**:
- Outputs structured JSON blocks format instead of HTML
- Optimized prompts for site builder pages
- Supports page-specific context (site structure, navigation, related pages)
- Blocks can include: headings, paragraphs, images, CTAs, forms, etc.
**Progress Messages**:
- INIT: "Initializing page content generation..."
- PREP: "Loading page blueprint and building prompt..."
- AI_CALL: "Generating structured content with AI..."
- PARSE: "Parsing JSON blocks..."
- SAVE: "Saving blocks to page..."
- DONE: "Page content generated!"
---
## Progress Tracking
@@ -539,6 +668,9 @@ The IGNY8 AI framework provides:
8. **Database Logging**: Automatic logging to AITaskLog
9. **Extensibility**: Easy to add new AI functions
10. **Reliability**: Retry logic and error recovery
11. **8 AI Functions**: Complete coverage from planning to publishing
12. **Site Builder Integration**: Specialized functions for site structure and page content
13. **Content Optimization**: AI-powered content optimization and scoring
This architecture ensures consistency, maintainability, and extensibility while providing a robust foundation for all AI operations in the IGNY8 platform.
This architecture ensures consistency, maintainability, and extensibility while providing a robust foundation for all AI operations in the IGNY8 platform, supporting 8 AI functions across the complete content workflow.

View File

@@ -1,6 +1,6 @@
# IGNY8 Functional Business Logic Documentation
**Last Updated:** 2025-01-XX
**Last Updated:** 2025-01-XX (Workflow updated - Wizard removed)
**Purpose:** Complete functional and business logic documentation covering all workflows, functions, features, and how the application works from a business perspective.
---
@@ -9,17 +9,18 @@
1. [Prerequisites](#prerequisites)
2. [System Overview](#system-overview)
3. [Account and User Management](#account-and-user-management)
4. [Planner Module - Complete Workflows](#planner-module---complete-workflows)
5. [Writer Module - Complete Workflows](#writer-module---complete-workflows)
6. [Thinker Module - Complete Workflows](#thinker-module---complete-workflows)
7. [System Module - Complete Workflows](#system-module---complete-workflows)
8. [Billing Module - Complete Workflows](#billing-module---complete-workflows)
9. [AI Functions - Complete Details](#ai-functions---complete-details)
10. [Credit System - How It Works](#credit-system---how-it-works)
11. [WordPress Integration](#wordpress-integration)
12. [Data Flow and State Management](#data-flow-and-state-management)
13. [Complete Feature List](#complete-feature-list)
3. [Complete User Workflow](#complete-user-workflow)
4. [Account and User Management](#account-and-user-management)
5. [Planner Module - Complete Workflows](#planner-module---complete-workflows)
6. [Writer Module - Complete Workflows](#writer-module---complete-workflows)
7. [Thinker Module - Complete Workflows](#thinker-module---complete-workflows)
8. [System Module - Complete Workflows](#system-module---complete-workflows)
9. [Billing Module - Complete Workflows](#billing-module---complete-workflows)
10. [AI Functions - Complete Details](#ai-functions---complete-details)
11. [Credit System - How It Works](#credit-system---how-it-works)
12. [WordPress Integration](#wordpress-integration)
13. [Data Flow and State Management](#data-flow-and-state-management)
14. [Complete Feature List](#complete-feature-list)
---
@@ -83,6 +84,156 @@ IGNY8 is a SaaS platform for SEO keyword management and AI-driven content genera
---
## Complete User Workflow
### Current Workflow Path (Updated 2025-01-XX)
The Site Builder Wizard has been removed. The workflow now follows a direct path:
```
PLANNING → WRITER → OPTIMIZE → PUBLISH
```
**Direct Path:** Keywords/Clusters → Ideas → Tasks → Content (no wizard intermediary)
### Phase Flow Summary
```
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ PLANNING │ --> │ WRITER │ --> │OPTIMIZE │ --> │ PUBLISH │
│ │ │ │ │ │ │ │
│Keywords │ │Content │ │Link & │ │Deploy │
│Clusters │ │Generate │ │Optimize │ │Site │
│ Ideas │ │ Images │ │ │ │ │
└──────────┘ └──────────┘ └──────────┘ └──────────┘
```
### Complete Workflow Steps
#### Phase 1: Planning & Keyword Research
1. **Keyword Discovery**
- Navigate to `/planner/keyword-opportunities`
- Browse keyword database
- Identify target keywords
2. **Keyword Import**
- Navigate to `/planner/keywords`
- Import CSV or manual entry
- Keywords stored by sector
3. **Keyword Clustering**
- Select keywords → "Auto-Cluster"
- AI clustering (1 credit per 30 keywords)
- Clusters created automatically
4. **Cluster Management**
- Navigate to `/planner/clusters`
- Review & refine clusters
- Merge/split clusters as needed
- Clusters ready for content generation
5. **Content Ideas Generation**
- Navigate to `/planner/ideas`
- Generate ideas from clusters (1 credit per idea)
- Review and refine ideas
- Queue ideas to Writer
#### Phase 2: Content Creation (Writer)
1. **Task Creation**
- Ideas automatically create tasks
- Navigate to `/writer/tasks`
- Review tasks from ideas
2. **Content Generation**
- Select tasks → "Generate Content"
- AI content generation (3 credits per content)
- HTML content with structured blocks
- Meta tags automatically generated
3. **Content Review**
- Navigate to `/writer/content`
- Review & edit HTML content
- Update metadata (title, description, keywords)
- Validate content structure
4. **Image Generation**
- Navigate to `/writer/images`
- Generate image prompts (optional)
- Generate images (1 credit per image)
- Featured and in-article images
#### Phase 3: Optimization & Linking
1. **Internal Linking**
- Navigate to `/linker/content`
- System analyzes content
- Suggests internal links (cluster matches prioritized)
- Accept/reject link suggestions
2. **Content Optimization**
- Navigate to `/optimizer/content`
- System scores content
- Review optimization suggestions
- Apply improvements
#### Phase 4: Publishing
1. **Content Validation**
- Navigate to `/sites/:id/posts/:postId`
- Validate entity type, cluster mapping, taxonomy
- Ensure all attributes complete
2. **WordPress Publishing**
- Select content → "Publish to WordPress"
- System validates WordPress connection
- Content published to WordPress site
- Images uploaded and linked
3. **Site Deployment** (for IGNY8-hosted sites)
- Navigate to `/sites/:id/deploy`
- Review cluster coverage
- Validate content completeness
- Deploy site to sites.igny8.com/{slug}
### Workflow Variations
#### Workflow A: New IGNY8-Hosted Site
- Complete build from scratch
- Full workflow: Planning → Writer → Optimize → Publish → Deploy
#### Workflow B: Existing Site Management
- Add new content to existing site
- Manage existing content
- Update and republish content
#### Workflow C: WordPress Sync - New Site
- Connect new WordPress site
- Sync existing content
- Continue with normal workflow
#### Workflow D: WordPress Sync - Existing Site
- Connect existing WordPress site
- Import existing posts
- Sync and manage content
### Site Builder Status
**Removed Features:**
- ❌ Site Builder Wizard (6-step guided process)
- ❌ WorkflowState model and services
- ❌ Wizard UI components and routes
**Available Features:**
- ✅ Site Blueprint APIs (create/manage via API)
- ✅ Site Builder models (SiteBlueprint, PageBlueprint, etc.)
- ✅ Direct workflow path (Planning → Writer)
**Note:** Site blueprints can still be created and managed through API endpoints, but there is no guided UI wizard. Users proceed directly from Planning to Writer.
---
## Account and User Management
### Account Creation and Setup

View File

@@ -2,7 +2,7 @@
**Base URL**: `https://api.igny8.com/api/v1/`
**Version**: 1.0.0
**Last Updated**: 2025-01-XX
**Last Updated**: 2025-01-XX (Added 6 missing modules: Linker, Optimizer, Publisher, Site Builder, Automation, Integration)
**Status**: ✅ **100% IMPLEMENTED** - All endpoints use unified format
**Purpose**: Complete, unified reference for IGNY8 API covering authentication, endpoints, response formats, error handling, rate limiting, permissions, and integration examples.
@@ -97,6 +97,12 @@ Development: http://localhost:8000/api/v1/
├── auth/ # Authentication and user management
├── planner/ # Keywords, clusters, content ideas
├── writer/ # Tasks, content, images
├── linker/ # Internal linking operations
├── optimizer/ # Content optimization and scoring
├── publisher/ # Publishing records and site deployment
├── site-builder/ # Site blueprint management
├── automation/ # Automation rules and scheduled tasks
├── integration/ # External platform integrations
├── system/ # Settings, prompts, integrations
└── billing/ # Credits, transactions, usage
```
@@ -219,6 +225,7 @@ Content-Type: application/json
- `GET /api/v1/auth/industries/` - List industries
- `GET /api/v1/system/status/` - System health check
- `GET /api/v1/system/ping/` - Health check endpoint
- `GET /api/v1/publisher/sites/{site_id}/definition/` - Get site definition for Sites Renderer
**All other endpoints require JWT authentication.**
@@ -988,6 +995,414 @@ class KeywordViewSet(SiteSectorModelViewSet):
- `GET /api/v1/system/ping/` - Health check endpoint (AllowAny)
- `GET /api/v1/system/request-metrics/{request_id}/` - Get request metrics for debugging
### Linker Module Endpoints
**Base Path**: `/api/v1/linker/`
**Permission**: IsAuthenticatedAndActive + HasTenantAccess
#### Process Content for Internal Linking
- `POST /api/v1/linker/process/` - Process single content item for internal linking
**Request:**
```json
{
"content_id": 123
}
```
**Response:**
```json
{
"success": true,
"data": {
"content_id": 123,
"suggested_links": [
{
"target_content_id": 456,
"target_title": "Related Article",
"anchor_text": "relevant keyword",
"confidence": 0.85
}
]
}
}
```
#### Batch Process Content
- `POST /api/v1/linker/batch_process/` - Process multiple content items for linking
**Request:**
```json
{
"content_ids": [123, 456, 789]
}
```
### Optimizer Module Endpoints
**Base Path**: `/api/v1/optimizer/`
**Permission**: IsAuthenticatedAndActive + HasTenantAccess
#### Optimize Content
- `POST /api/v1/optimizer/optimize/` - Optimize content (auto-detects entry point)
**Request:**
```json
{
"ids": [123, 456],
"entry_point": "seo" // Optional: "seo", "readability", "engagement"
}
```
**Response:**
```json
{
"success": true,
"data": {
"optimized_content": "...",
"seo_score": 85,
"readability_score": 78,
"engagement_score": 82
}
}
```
#### Batch Optimize Content
- `POST /api/v1/optimizer/batch_optimize/` - Batch optimize multiple content items
**Request:**
```json
{
"ids": [123, 456, 789],
"entry_point": "seo" // Optional
}
```
#### Analyze Content
- `POST /api/v1/optimizer/analyze/` - Analyze content without optimization
**Request:**
```json
{
"id": 123
}
```
**Response:**
```json
{
"success": true,
"data": {
"seo_score": 75,
"readability_score": 70,
"engagement_score": 68,
"recommendations": [
"Add more internal links",
"Improve heading structure"
]
}
}
```
### Publisher Module Endpoints
**Base Path**: `/api/v1/publisher/`
**Permission**: IsAuthenticatedAndActive + HasTenantAccess
#### Publishing Records
**Base Path**: `/api/v1/publisher/publishing-records/`
**Inherits**: SiteSectorModelViewSet
**Standard CRUD:**
- `GET /api/v1/publisher/publishing-records/` - List publishing records (paginated)
- `POST /api/v1/publisher/publishing-records/` - Create publishing record
- `GET /api/v1/publisher/publishing-records/{id}/` - Get publishing record
- `PUT /api/v1/publisher/publishing-records/{id}/` - Update publishing record
- `DELETE /api/v1/publisher/publishing-records/{id}/` - Delete publishing record
**Filtering:**
- `status` - Filter by publishing status
- `destination_type` - Filter by destination (wordpress, sites_renderer, etc.)
- `site_id` - Filter by site
- `sector_id` - Filter by sector
#### Deployment Records
**Base Path**: `/api/v1/publisher/deployments/`
**Inherits**: SiteSectorModelViewSet
**Standard CRUD:**
- `GET /api/v1/publisher/deployments/` - List deployment records (paginated)
- `POST /api/v1/publisher/deployments/` - Create deployment record
- `GET /api/v1/publisher/deployments/{id}/` - Get deployment record
- `PUT /api/v1/publisher/deployments/{id}/` - Update deployment record
- `DELETE /api/v1/publisher/deployments/{id}/` - Delete deployment record
#### Publishing Actions
- `POST /api/v1/publisher/publish/` - Publish content to destination
**Request:**
```json
{
"content_id": 123,
"destination_type": "wordpress",
"destination_id": 1
}
```
- `POST /api/v1/publisher/deploy/` - Deploy site blueprint
**Request:**
```json
{
"blueprint_id": 456,
"environment": "production"
}
```
- `POST /api/v1/publisher/check_readiness/` - Check deployment readiness
**Request:**
```json
{
"blueprint_id": 456
}
```
#### Public Endpoint (No Authentication)
- `GET /api/v1/publisher/sites/{site_id}/definition/` - Get site definition for Sites Renderer
**Response:**
```json
{
"success": true,
"data": {
"site_id": 1,
"slug": "example-site",
"blueprints": [...],
"pages": [...]
}
}
```
### Site Builder Module Endpoints
**Base Path**: `/api/v1/site-builder/`
**Permission**: IsAuthenticatedAndActive + HasTenantAccess
#### Site Blueprints
**Base Path**: `/api/v1/site-builder/blueprints/`
**Inherits**: SiteSectorModelViewSet
**Standard CRUD:**
- `GET /api/v1/site-builder/blueprints/` - List site blueprints (paginated)
- `POST /api/v1/site-builder/blueprints/` - Create site blueprint
- `GET /api/v1/site-builder/blueprints/{id}/` - Get blueprint details
- `PUT /api/v1/site-builder/blueprints/{id}/` - Update blueprint
- `DELETE /api/v1/site-builder/blueprints/{id}/` - Delete blueprint
**Custom Actions:**
- `POST /api/v1/site-builder/blueprints/{id}/generate_structure/` - Generate site structure using AI
- `POST /api/v1/site-builder/blueprints/{id}/generate_all_pages/` - Generate all pages for blueprint
- `POST /api/v1/site-builder/blueprints/{id}/create_tasks/` - Create Writer tasks for pages
- `GET /api/v1/site-builder/blueprints/{id}/progress/` - Get cluster-level completion status
- `POST /api/v1/site-builder/blueprints/{id}/clusters/attach/` - Attach planner clusters
- `POST /api/v1/site-builder/blueprints/{id}/clusters/detach/` - Detach clusters
- `GET /api/v1/site-builder/blueprints/{id}/taxonomies/` - List taxonomies
- `POST /api/v1/site-builder/blueprints/{id}/taxonomies/` - Create taxonomy
- `POST /api/v1/site-builder/blueprints/{id}/taxonomies/import/` - Import taxonomies
- `POST /api/v1/site-builder/blueprints/bulk_delete/` - Bulk delete blueprints
**Filtering:**
- `status` - Filter by blueprint status
- `site_id` - Filter by site
- `sector_id` - Filter by sector
#### Page Blueprints
**Base Path**: `/api/v1/site-builder/pages/`
**Inherits**: SiteSectorModelViewSet
**Standard CRUD:**
- `GET /api/v1/site-builder/pages/` - List page blueprints (paginated)
- `POST /api/v1/site-builder/pages/` - Create page blueprint
- `GET /api/v1/site-builder/pages/{id}/` - Get page details
- `PUT /api/v1/site-builder/pages/{id}/` - Update page
- `DELETE /api/v1/site-builder/pages/{id}/` - Delete page
**Custom Actions:**
- `POST /api/v1/site-builder/pages/{id}/generate_content/` - Generate content for page
- `POST /api/v1/site-builder/pages/{id}/regenerate/` - Regenerate page content
**Filtering:**
- `site_blueprint_id` - Filter by site blueprint
- `status` - Filter by page status
#### Site Assets
- `GET /api/v1/site-builder/assets/` - List files for site
**Query Parameters:**
- `site_id` - Filter by site
- `file_type` - Filter by file type
- `POST /api/v1/site-builder/assets/` - Upload file
**Request:** Multipart form data
```json
{
"file": "<file>",
"site_id": 1,
"file_type": "image"
}
```
- `DELETE /api/v1/site-builder/assets/` - Delete file
**Request:**
```json
{
"file_path": "path/to/file.jpg",
"site_id": 1
}
```
#### Site Builder Metadata
- `GET /api/v1/site-builder/metadata/` - Get metadata (business types, audience profiles, etc.)
**Response:**
```json
{
"success": true,
"data": {
"business_types": [...],
"audience_profiles": [...],
"brand_personalities": [...],
"hero_imagery_directions": [...]
}
}
```
### Automation Module Endpoints
**Base Path**: `/api/v1/automation/`
**Permission**: IsAuthenticatedAndActive + HasTenantAccess
#### Automation Rules
**Base Path**: `/api/v1/automation/rules/`
**Inherits**: SiteSectorModelViewSet
**Standard CRUD:**
- `GET /api/v1/automation/rules/` - List automation rules (paginated)
- `POST /api/v1/automation/rules/` - Create automation rule
- `GET /api/v1/automation/rules/{id}/` - Get rule details
- `PUT /api/v1/automation/rules/{id}/` - Update rule
- `DELETE /api/v1/automation/rules/{id}/` - Delete rule
**Custom Actions:**
- `POST /api/v1/automation/rules/{id}/execute/` - Manually execute automation rule
**Filtering:**
- `status` - Filter by rule status (active, inactive)
- `trigger_type` - Filter by trigger type
- `site_id` - Filter by site
- `sector_id` - Filter by sector
#### Scheduled Tasks
**Base Path**: `/api/v1/automation/scheduled-tasks/`
**Inherits**: AccountModelViewSet
**Standard CRUD:**
- `GET /api/v1/automation/scheduled-tasks/` - List scheduled tasks (paginated)
- `POST /api/v1/automation/scheduled-tasks/` - Create scheduled task
- `GET /api/v1/automation/scheduled-tasks/{id}/` - Get task details
- `PUT /api/v1/automation/scheduled-tasks/{id}/` - Update task
- `DELETE /api/v1/automation/scheduled-tasks/{id}/` - Delete task
**Filtering:**
- `status` - Filter by task status
- `task_type` - Filter by task type
- `next_run_date` - Filter by next run date
### Integration Module Endpoints
**Base Path**: `/api/v1/integration/`
**Permission**: IsAuthenticatedAndActive + HasTenantAccess
#### Site Integrations
**Base Path**: `/api/v1/integration/integrations/`
**Inherits**: SiteSectorModelViewSet
**Standard CRUD:**
- `GET /api/v1/integration/integrations/` - List site integrations (paginated)
- `POST /api/v1/integration/integrations/` - Create integration
- `GET /api/v1/integration/integrations/{id}/` - Get integration details
- `PUT /api/v1/integration/integrations/{id}/` - Update integration
- `DELETE /api/v1/integration/integrations/{id}/` - Delete integration
**Custom Actions:**
- `POST /api/v1/integration/integrations/{id}/test_connection/` - Test connection to integrated platform
**Request:**
```json
{}
```
**Response:**
```json
{
"success": true,
"data": {
"connected": true,
"message": "Connection successful"
}
}
```
- `POST /api/v1/integration/integrations/{id}/sync/` - Sync content with integrated platform
**Request:**
```json
{
"content_ids": [123, 456],
"sync_type": "full" // or "incremental"
}
```
- `GET /api/v1/integration/integrations/{id}/sync_health/` - Get sync health status
**Response:**
```json
{
"success": true,
"data": {
"last_sync": "2025-01-XXT...",
"sync_status": "healthy",
"pending_items": 0,
"failed_items": 0
}
}
```
**Filtering:**
- `platform_type` - Filter by platform (wordpress, shopify, etc.)
- `status` - Filter by integration status
- `site_id` - Filter by site
- `sector_id` - Filter by sector
### Billing Module Endpoints
**Base Path**: `/api/v1/billing/`
@@ -1386,7 +1801,7 @@ All API changes are documented in `CHANGELOG.md` with:
---
**Last Updated**: 2025-01-XX
**Last Updated**: 2025-01-XX (Added 6 missing modules: Linker, Optimizer, Publisher, Site Builder, Automation, Integration)
**API Version**: 1.0.0
**Status**: ✅ **100% IMPLEMENTED**
**Status**: ✅ **100% IMPLEMENTED** - All 10 modules documented with complete endpoint reference

View File

@@ -1,7 +1,7 @@
# WordPress Plugin Integration Guide
**Version**: 1.0.0
**Last Updated**: 2025-11-16
**Last Updated**: 2025-01-XX (Added Publisher module endpoints for content publishing)
Complete guide for integrating WordPress plugins with IGNY8 API v1.0.
@@ -1092,11 +1092,21 @@ if (!wp_next_scheduled('igny8_sync_post_statuses')) {
## Complete Integration Flow
### IGNY8 → WordPress Flow
### IGNY8 → WordPress Flow (Using Publisher Module)
1. Content generated in IGNY8
2. Content created/updated in IGNY8
3. Call `POST /api/v1/publisher/publish/` with `content_id` and `destinations: ['wordpress']`
4. Publisher module creates WordPress post via REST API
5. Publishing record created in IGNY8
6. WordPress post ID stored in publishing record
7. Content updated with WordPress post URL
### IGNY8 → WordPress Flow (Legacy/Direct)
1. Content generated in IGNY8
2. Task created/updated in IGNY8
3. WordPress post created via `wp_insert_post()`
3. WordPress post created via `wp_insert_post()` (if using WordPress plugin)
4. Post meta saved with `_igny8_task_id`
5. IGNY8 task updated with WordPress post ID
@@ -1572,8 +1582,9 @@ function igny8_send_site_data_to_igny8($site_id) {
$site_data = igny8_collect_site_data();
// Send to IGNY8 API
// Note: This endpoint may need to be created in IGNY8 API
$response = $api->post("/system/sites/{$site_id}/import/", [
// Note: This endpoint is planned/future feature - may not be available yet
// Alternative: Use Integration module endpoints for site data sync
$response = $api->post("/integration/integrations/{$integration_id}/sync/", [
'site_data' => $site_data,
'import_type' => 'full_site_scan'
]);
@@ -1632,7 +1643,8 @@ function igny8_sync_incremental_site_data($site_id) {
}
// Send incremental update to IGNY8
$response = $api->post("/system/sites/{$site_id}/sync/", [
// Note: Use Integration module for site sync
$response = $api->post("/integration/integrations/{$integration_id}/sync/", [
'posts' => $formatted_posts,
'sync_type' => 'incremental',
'last_sync' => $last_sync
@@ -1728,6 +1740,8 @@ function igny8_map_site_to_semantic_strategy($site_id, $site_data) {
}
// Send semantic map to IGNY8
// Note: This endpoint is planned/future feature - may not be available yet
// Alternative: Use Planner module to create sectors/clusters/keywords manually
$response = $api->post("/planner/sites/{$site_id}/semantic-map/", [
'semantic_map' => $semantic_map,
'site_data' => $site_data
@@ -1811,6 +1825,7 @@ function igny8_analyze_and_restructure_site($site_id) {
$site_data = igny8_collect_site_data();
// Step 2: Send to IGNY8 for analysis
// Note: This endpoint is planned/future feature - may not be available yet
$analysis_response = $api->post("/system/sites/{$site_id}/analyze/", [
'site_data' => $site_data,
'analysis_type' => 'full_site_restructure'
@@ -1830,6 +1845,7 @@ function igny8_analyze_and_restructure_site($site_id) {
}
// Step 4: Get restructuring recommendations
// Note: This endpoint is planned/future feature - may not be available yet
$recommendations_response = $api->get("/system/sites/{$site_id}/recommendations/");
if (!$recommendations_response['success']) {
@@ -1908,7 +1924,8 @@ class Igny8SiteIntegration {
$site_data = igny8_collect_site_data();
// Send to IGNY8
$response = $this->api->post("/system/sites/{$this->site_id}/import/", [
// Note: Use Integration module for site data import
$response = $this->api->post("/integration/integrations/{$integration_id}/sync/", [
'site_data' => $site_data,
'import_type' => 'full_scan'
]);
@@ -1937,6 +1954,7 @@ class Igny8SiteIntegration {
* Get semantic strategy recommendations
*/
public function get_recommendations() {
// Note: This endpoint is planned/future feature - may not be available yet
$response = $this->api->get("/planner/sites/{$this->site_id}/recommendations/");
if ($response['success']) {
@@ -1950,6 +1968,7 @@ class Igny8SiteIntegration {
* Apply restructuring recommendations
*/
public function apply_restructuring($recommendations) {
// Note: This endpoint is planned/future feature - may not be available yet
$response = $this->api->post("/planner/sites/{$this->site_id}/restructure/", [
'recommendations' => $recommendations
]);