42 KiB
IGNY8 Functional Business Logic Documentation
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.
Table of Contents
- Prerequisites
- System Overview
- Complete User Workflow
- Account and User Management
- Planner Module - Complete Workflows
- Writer Module - Complete Workflows
- Thinker Module - Complete Workflows
- System Module - Complete Workflows
- Billing Module - Complete Workflows
- AI Functions - Complete Details
- Credit System - How It Works
- WordPress Integration
- Data Flow and State Management
- Complete Feature List
Prerequisites
Technology Stack Required
Backend Technologies:
- Django
- Django REST Framework
- PostgreSQL
- Celery
- Redis
- Python
Frontend Technologies:
- React
- TypeScript
- Vite
- Tailwind CSS
- Zustand
- React Router
Infrastructure:
- Docker
- Docker Compose
- Caddy
External Services:
- OpenAI API
- Runware API (optional)
- WordPress (optional)
System Overview
IGNY8 is a SaaS platform for SEO keyword management and AI-driven content generation. The system operates on a multi-tenant architecture where each account is completely isolated. Users work within accounts, manage sites, organize content by sectors, and use AI to generate content from keywords.
Core Business Flow
- Account Setup: User creates account, sets up sites and sectors
- Keyword Management: Import keywords, organize by sector, cluster related keywords
- Content Planning: Generate content ideas from keyword clusters
- Content Creation: Create tasks from ideas, generate AI content
- Image Generation: Generate images for content
- Publishing: Publish content to WordPress sites
Key Business Concepts
- Account: Top-level organization containing all data
- Site: Workspace within account (can have multiple sites)
- Sector: Content category within site (1-5 per site)
- Keywords: SEO keywords organized by sector
- Clusters: AI-grouped related keywords
- Content Ideas: AI-generated content ideas from clusters
- Tasks: Content generation tasks created from ideas
- Content: Generated HTML blog posts and articles
- Images: AI-generated images for content
- Credits: Currency for AI operations
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
-
Keyword Discovery
- Navigate to
/planner/keyword-opportunities - Browse keyword database
- Identify target keywords
- Navigate to
-
Keyword Import
- Navigate to
/planner/keywords - Import CSV or manual entry
- Keywords stored by sector
- Navigate to
-
Keyword Clustering
- Select keywords → "Auto-Cluster"
- AI clustering (1 credit per 30 keywords)
- Clusters created automatically
-
Cluster Management
- Navigate to
/planner/clusters - Review & refine clusters
- Merge/split clusters as needed
- Clusters ready for content generation
- Navigate to
-
Content Ideas Generation
- Navigate to
/planner/ideas - Generate ideas from clusters (1 credit per idea)
- Review and refine ideas
- Queue ideas to Writer
- Navigate to
Phase 2: Content Creation (Writer)
-
Task Creation
- Ideas automatically create tasks
- Navigate to
/writer/tasks - Review tasks from ideas
-
Content Generation
- Select tasks → "Generate Content"
- AI content generation (3 credits per content)
- HTML content with structured blocks
- Meta tags automatically generated
-
Content Review
- Navigate to
/writer/content - Review & edit HTML content
- Update metadata (title, description, keywords)
- Validate content structure
- Navigate to
-
Image Generation
- Navigate to
/writer/images - Generate image prompts (optional)
- Generate images (1 credit per image)
- Featured and in-article images
- Navigate to
Phase 3: Optimization & Linking
-
Internal Linking
- Navigate to
/linker/content - System analyzes content
- Suggests internal links (cluster matches prioritized)
- Accept/reject link suggestions
- Navigate to
-
Content Optimization
- Navigate to
/optimizer/content - System scores content
- Review optimization suggestions
- Apply improvements
- Navigate to
Phase 4: Publishing
-
Content Validation
- Navigate to
/sites/:id/posts/:postId - Validate entity type, cluster mapping, taxonomy
- Ensure all attributes complete
- Navigate to
-
WordPress Publishing
- Select content → "Publish to WordPress"
- System validates WordPress connection
- Content published to WordPress site
- Images uploaded and linked
-
Site Deployment (for IGNY8-hosted sites)
- Navigate to
/sites/:id/deploy - Review cluster coverage
- Validate content completeness
- Deploy site to sites.igny8.com/{slug}
- Navigate to
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
Workflow:
- User visits signup page
- User provides email and password
- System creates Account record with default plan
- System creates User record with "owner" role
- System creates Subscription record linking account to plan
- User receives confirmation
- User signs in and receives JWT token
- Frontend stores token and redirects to dashboard
Data Created:
- Account record (name, slug, owner, plan, credits, status)
- User record (email, account, role: owner)
- Subscription record (account, plan, status)
User Roles and Permissions
Roles:
- Developer: Full system access, bypasses all restrictions
- Owner: Full account access, manages users and billing
- Admin: Account admin, manages content and users
- Editor: Content editing access for granted sites only
- Viewer: Read-only access for granted sites only
- System Bot: System automation user
Access Control:
- Owners and Admins: Automatic access to all sites in account
- Editors and Viewers: Require explicit site access grants
- Developers and System Bot: Access to all sites across all accounts
Site and Sector Management
Site Creation:
- User navigates to Settings → Sites
- User creates site with name, domain, industry
- System creates Site record linked to account
- User can configure WordPress integration (URL, username, password)
- Site becomes available for content organization
Sector Creation:
- User navigates to site details
- User creates sector (1-5 active sectors per site)
- System creates Sector record linked to site
- Sector becomes available for keyword and content organization
Constraints:
- Maximum 5 active sectors per site
- Multiple sites can be active simultaneously
- All content must belong to a site and sector
Planner Module - Complete Workflows
Keyword Management
Keyword Import (CSV):
- User navigates to Planner → Keywords
- User clicks "Import CSV" action
- User uploads CSV file with columns: keyword, volume, difficulty, intent
- System validates CSV format and data
- System checks for duplicates
- System creates Keyword records for each row
- Keywords are linked to selected site and sector
- Keywords appear in table with status "active"
Keyword Import (Manual):
- User navigates to Planner → Keywords
- User clicks "Add Keyword" action
- User enters keyword, volume, difficulty, intent
- System validates keyword uniqueness within sector
- System creates Keyword record
- Keyword appears in table
Keyword Filtering:
- Filter by sector
- Filter by status (active, inactive, archived)
- Filter by intent (informational, navigational, transactional, commercial)
- Filter by cluster (clustered, unclustered)
- Filter by difficulty range (min/max)
- Filter by volume range (min/max)
- Search by keyword text
Keyword Bulk Operations:
- Bulk delete: Select multiple keywords, delete all
- Bulk update status: Select multiple keywords, change status
- Bulk add from seed: Add keywords from seed keyword library
Keyword Export:
- User applies filters (optional)
- User clicks "Export CSV" action
- System generates CSV file with filtered keywords
- User downloads CSV file
Keyword Clustering
Auto Cluster Workflow:
- User navigates to Planner → Keywords
- User selects keywords (maximum 20 per batch)
- User clicks "Auto Cluster" action
- System validates keyword IDs and account credits
- System queues Celery task (
run_ai_taskwith functionauto_cluster) - System returns task ID to frontend
- Frontend polls progress endpoint (
/api/v1/system/settings/task_progress/{task_id}/) - Celery worker processes task:
- Loads keywords from database
- Builds AI prompt with keyword data (keyword, volume, difficulty, intent)
- Calls OpenAI API with clustering prompt
- Parses AI response (cluster names and keyword assignments)
- Creates Cluster records for each cluster
- Links keywords to clusters (Many-to-Many relationship)
- Updates cluster metrics (keywords_count, volume)
- Progress updates sent to frontend (phases: INIT, PREP, AI_CALL, PARSE, SAVE, DONE)
- Task completes
- Frontend displays new clusters
- Credits deducted from account (1 credit per 30 keywords)
Manual Cluster Management:
- User navigates to Planner → Clusters
- User views clusters with keyword counts and volumes
- User can edit cluster name and description
- User can add keywords to cluster
- User can remove keywords from cluster
- User can delete cluster (keywords remain, just unlinked)
Cluster Filtering:
- Filter by sector
- Filter by status
- Search by cluster name
- Sort by keywords_count, volume, created_at
Content Idea Generation
Generate Ideas Workflow:
- User navigates to Planner → Clusters
- User selects one cluster (maximum 1 per batch)
- User clicks "Generate Ideas" action
- System validates cluster ID and account credits
- System queues Celery task (
run_ai_taskwith functiongenerate_ideas) - System returns task ID to frontend
- Frontend polls progress endpoint
- Celery worker processes task:
- Loads cluster and associated keywords
- Builds AI prompt with cluster data (cluster name, keywords, sector context)
- Calls OpenAI API with idea generation prompt
- Parses AI response (idea titles, descriptions, content types, structures)
- Creates ContentIdeas records for each idea
- Links ideas to cluster
- Progress updates sent to frontend
- Task completes
- Frontend displays new content ideas
- Credits deducted from account (1 credit per idea)
Content Ideas Management:
- User navigates to Planner → Ideas
- User views ideas with titles, descriptions, content types
- User can edit idea title and description
- User can change idea status (active, inactive, archived)
- User can delete idea
- User can create tasks from ideas (moves to Writer module)
Idea Filtering:
- Filter by sector
- Filter by cluster
- Filter by status
- Filter by content type
- Search by idea title
Bulk Queue to Writer:
- User selects multiple ideas
- User clicks "Queue to Writer" action
- System creates Task records for each idea
- Tasks are linked to ideas and clusters
- Tasks appear in Writer → Tasks page
Writer Module - Complete Workflows
Task Management
Task Creation:
- User navigates to Writer → Tasks
- User can create task manually or from content ideas
- If from ideas: System creates task with idea data (title, description, cluster, idea)
- If manual: User enters title, description, selects cluster, content type, structure
- System creates Task record
- Task appears in table with status "draft"
Task Filtering:
- Filter by sector
- Filter by cluster
- Filter by status (draft, in_progress, review, completed, archived)
- Filter by content type
- Filter by content structure
- Search by title or keywords
Task Bulk Operations:
- Bulk delete: Select multiple tasks, delete all
- Bulk update status: Select multiple tasks, change status
Content Generation
Generate Content Workflow:
- User navigates to Writer → Tasks
- User selects tasks (maximum 50 per batch)
- User clicks "Generate Content" action
- System validates task IDs and account credits
- System queues Celery task (
run_ai_taskwith functiongenerate_content) - System returns task ID to frontend
- Frontend polls progress endpoint
- Celery worker processes task (for each task):
- Loads task and related data (cluster, keywords, idea, sector, site)
- Builds AI prompt with task data (title, description, keywords, content type, structure)
- Calls OpenAI API with content generation prompt
- Parses HTML content response
- Creates or updates Content record with HTML
- Calculates word count
- Updates task status to "review"
- Progress updates sent to frontend (per task)
- Task completes
- Frontend displays generated content
- Credits deducted from account (3 credits per content piece)
Content Management:
- User navigates to Writer → Content
- User views content list with titles, word counts, status
- User clicks content to view full HTML
- User can edit content HTML directly
- User can update content status (draft, review, published)
- User can update meta title and description
- User can update primary and secondary keywords
Content Filtering:
- Filter by sector
- Filter by status
- Filter by content type
- Search by title or keywords
- Sort by word count, created_at, status
Content Views:
- Drafts: Content with status "draft"
- Published: Content with status "published" and wp_post_id set
- All Content: All content regardless of status
Image Generation
Generate Image Prompts Workflow:
- User navigates to Writer → Content
- User selects content items
- User clicks "Generate Image Prompts" action (optional)
- System validates content IDs
- System queues Celery task (
run_ai_taskwith functiongenerate_image_prompts) - Celery worker processes task:
- Loads content HTML
- Builds AI prompt for image prompt extraction
- Calls OpenAI API
- Parses image prompts (featured image prompt, 1-6 in-article image prompts)
- Creates or updates Images records with prompts
- Sets image_type (featured, in_article)
- Task completes
- Images appear in Writer → Images page with prompts ready
Generate Images Workflow:
- User navigates to Writer → Images
- User selects images with prompts
- User clicks "Generate Images" action
- System validates image IDs and account credits
- System queues Celery task (
run_ai_taskwith functiongenerate_images) - System returns task ID to frontend
- Frontend polls progress endpoint
- Celery worker processes task (for each image sequentially):
- Loads image with prompt
- Determines image provider (OpenAI DALL-E or Runware) from integration settings
- Builds image generation request
- Calls OpenAI DALL-E API or Runware API
- Receives image URL
- Updates Images record with image_url
- Sets image status to "completed"
- Progress updates sent to frontend (per image)
- Task completes
- Frontend displays generated images
- Credits deducted from account (1 credit per image)
Image Management:
- User navigates to Writer → Images
- User views images with prompts, URLs, types, status
- User can view image by clicking
- User can regenerate image (creates new image with same prompt)
- User can delete image
- User can update image status
Image Filtering:
- Filter by content
- Filter by image type (featured, in_article, desktop, mobile)
- Filter by status
- Filter by task
Image Bulk Operations:
- Bulk update status: Select multiple images, change status
WordPress Publishing
Publish to WordPress Workflow:
- User navigates to Writer → Content
- User selects content to publish
- User clicks "Publish to WordPress" action
- System validates:
- Site has WordPress URL configured (wp_url field)
- Site has WordPress credentials (wp_username, wp_app_password)
- Content status is "review" or "draft"
- System calls WordPress REST API:
- Authenticates with WordPress using credentials
- Creates post with content HTML (title from content meta_title or task title)
- Sets post content to content HTML
- Uploads featured image if available (Images record with image_type="featured")
- Uploads in-article images if available (Images records with image_type="in_article")
- Sets post status (draft or publish based on content status)
- Sets post meta (primary_keyword, secondary_keywords)
- WordPress returns post ID
- System updates Content record:
- Sets wp_post_id field
- Sets status to "published"
- Frontend displays success message
- User can view published content in WordPress
Publishing Requirements:
- Site must have WordPress URL configured
- Site must have WordPress username and app password
- Content must have status "review" or "draft"
- Featured image is optional but recommended
Thinker Module - Complete Workflows
AI Prompts Management
Prompt Management:
- User navigates to Thinker → Prompts
- User views all AI prompts used in the system
- User can view prompt details (prompt_type, prompt_value, function_name)
- User can edit prompt value
- User can reset prompt to default value
- System uses prompts in AI function execution
Prompt Types:
auto_cluster: Prompt for keyword clusteringgenerate_ideas: Prompt for content idea generationgenerate_content: Prompt for content generationgenerate_image_prompts: Prompt for extracting image prompts from contentgenerate_images: Prompt for image generation
Prompt Hierarchy:
- Account-specific prompt (if exists)
- Default system prompt (fallback)
Author Profiles Management
Author Profile Creation:
- User navigates to Thinker → Author Profiles
- User clicks "Add Profile" action
- User enters name, description, tone, language
- System creates AuthorProfile record
- Profile becomes available for content generation
Author Profile Usage:
- Author profiles are used in content generation prompts
- Profile tone and language influence AI-generated content style
- Multiple profiles can be created for different content styles
Author Profile Management:
- View all profiles
- Edit profile details
- Delete profile
Strategies Management
Strategy Creation:
- User navigates to Thinker → Strategies
- User clicks "Add Strategy" action
- User enters name, description
- User selects sector (optional, for sector-specific strategies)
- User configures prompt types (which prompts this strategy affects)
- User configures section logic (content structure preferences)
- System creates Strategy record
- Strategy becomes active and influences AI generation
Strategy Usage:
- Strategies influence content generation when linked to sectors
- Strategy prompt types override default prompts
- Strategy section logic affects content structure
Strategy Management:
- View all strategies
- Edit strategy details
- Activate/deactivate strategy
- Delete strategy
Image Testing
Image Testing Workflow:
- User navigates to Thinker → Image Testing
- User enters image prompt
- User selects image provider (OpenAI DALL-E or Runware)
- User clicks "Generate Test Image" action
- System calls image generation API
- System displays generated image
- User can test different prompts and providers
- No credits deducted for testing (or minimal test credits)
System Module - Complete Workflows
Integration Settings
OpenAI Integration Setup:
- User navigates to Settings → Integration
- User selects "OpenAI" integration type
- User enters OpenAI API key
- User clicks "Test Connection" (optional)
- System makes test API call to OpenAI
- System returns connection status
- User saves integration settings
- System stores API key in IntegrationSettings record
- OpenAI integration ready for AI functions
Runware Integration Setup:
- User navigates to Settings → Integration
- User selects "Runware" integration type
- User enters Runware API key
- User selects Runware model (e.g.,
runware:97@1) - User clicks "Test Connection" (optional)
- System makes test API call to Runware
- System returns connection status
- User saves integration settings
- System stores API key and model in IntegrationSettings record
- Runware integration ready for image generation
Integration Test Functions:
- Test OpenAI: Makes test API call, returns success/failure
- Test Runware: Makes test API call, returns success/failure
- Generate Test Image: Generates test image using selected provider
System Settings
General Settings:
- Account name and details
- Site management
- Sector management
- Industry selection
User Management:
- Add users to account
- Assign roles (owner, admin, editor, viewer)
- Grant site access (for editors/viewers)
- Remove users
Module Settings:
- Enable/disable modules
- Configure module-specific settings
AI Settings:
- Configure AI model preferences
- Set default models per function
- Configure token limits
- Set cost tracking preferences
System Status and Monitoring
Status Endpoint:
- System health check
- Database connectivity
- Redis connectivity
- Celery worker status
- Service availability
Request Metrics:
- API request counts
- Response times
- Error rates
- Resource usage (CPU, memory, I/O)
Billing Module - Complete Workflows
Credit Management
Credit Balance:
- Each account has a credit balance
- Credits are displayed in Billing → Credits page
- Credits are deducted for AI operations
- Credits can be added via transactions
Credit Transactions:
- User navigates to Billing → Transactions
- User views all credit transactions
- Transaction types:
- Purchase: Credits purchased
- Subscription: Credits from subscription renewal
- Refund: Credits refunded
- Deduction: Credits used for AI operations
- Adjustment: Manual credit adjustments
- Each transaction shows amount, balance_after, description, timestamp
Credit Usage Logs:
- User navigates to Billing → Usage
- User views detailed usage logs
- Each log entry shows:
- Operation type (clustering, ideas, content, images, reparse)
- Credits used
- Cost in USD
- Model used
- Input/output tokens
- Related object (keyword, cluster, task)
- Timestamp
- Logs are filterable by operation type, date range
Credit Costs
Credit Costs per Operation:
- Clustering: 1 credit per 30 keywords (base: 1 credit)
- Ideas: 1 credit per idea (base: 1 credit)
- Content: 3 credits per content piece (base: 3 credits)
- Images: 1 credit per image (base: 1 credit)
- Reparse: 1 credit per reparse (base: 1 credit)
Credit Deduction Process:
- User initiates AI operation
- System checks account credit balance
- System calculates required credits based on operation type
- If insufficient credits: Operation fails with error
- If sufficient credits: Operation proceeds
- After operation completes: Credits deducted via CreditService
- CreditTransaction record created (deduction type)
- CreditUsageLog record created with operation details
- Account credit balance updated
Plan Management
Plan Features:
- Each account is linked to a plan via subscription
- Plans define limits:
- Maximum users
- Maximum sites
- Maximum keywords
- Maximum clusters
- Maximum content ideas
- Maximum AI requests
- Maximum word count
- Maximum images
- Included credits per month
- Credits per month (if different from included)
Plan Limits Enforcement:
- System checks plan limits before operations
- Operations fail if limits exceeded
- Limits are checked at:
- Keyword import
- Cluster creation
- Idea generation
- Content generation
- Image generation
AI Functions - Complete Details
AI Function Execution Flow
Unified Entry Point:
- All AI functions use
run_ai_taskCelery task - Function name passed as parameter (auto_cluster, generate_ideas, generate_content, generate_image_prompts, generate_images)
- Payload contains function-specific data
- Account ID passed for credit checking and account isolation
Execution Phases:
- INIT: Initialize function, validate payload
- PREP: Load data from database, prepare for AI call
- AI_CALL: Make API call to OpenAI or Runware
- PARSE: Parse AI response, extract structured data
- SAVE: Save results to database
- DONE: Task complete, return results
Progress Tracking:
- Progress updates sent via Celery task progress
- Frontend polls progress endpoint
- Progress shows current phase and percentage
- Progress shows items processed (e.g., "3 of 10 keywords clustered")
Error Handling:
- Validation errors: Returned immediately
- API errors: Logged, error returned to frontend
- Insufficient credits: Operation fails before AI call
- Network errors: Retried with exponential backoff
Auto Cluster Function
Function Name: auto_cluster
Purpose: Group related keywords into semantic clusters using AI
Input:
- Keyword IDs (list, maximum 20)
- Sector ID (optional)
Process:
- Load keywords from database
- Build prompt with keyword data (keyword, volume, difficulty, intent)
- Call OpenAI API with clustering prompt
- Parse response (cluster names, keyword assignments)
- Create Cluster records
- Link keywords to clusters
- Update cluster metrics
Output:
- Cluster records created
- Keywords linked to clusters
- Cluster metrics updated (keywords_count, volume)
Credits: 1 credit per 30 keywords
Generate Ideas Function
Function Name: generate_ideas
Purpose: Generate SEO-optimized content ideas from keyword clusters
Input:
- Cluster IDs (list, maximum 1 per batch)
Process:
- Load cluster and associated keywords
- Build prompt with cluster data (name, keywords, sector context)
- Call OpenAI API with idea generation prompt
- Parse response (idea titles, descriptions, content types, structures)
- Create ContentIdeas records
- Link ideas to cluster
Output:
- ContentIdeas records created
- Ideas linked to clusters
Credits: 1 credit per idea
Generate Content Function
Function Name: generate_content
Purpose: Generate article content from task ideas
Input:
- Task IDs (list, maximum 50 per batch)
Process:
- Load tasks with relationships (cluster, keywords, idea, sector, site)
- For each task:
- Build prompt with task data (title, description, keywords, content type, structure)
- Call OpenAI API with content generation prompt
- Parse HTML content response
- Create or update Content record
- Calculate word count
- Update task status
- Process tasks sequentially or in parallel (configurable)
Output:
- Content records created/updated with HTML
- Task status updated to "review"
- Word count calculated
Credits: 3 credits per content piece
Generate Image Prompts Function
Function Name: generate_image_prompts
Purpose: Extract image prompts from content HTML
Input:
- Content IDs (list)
Process:
- Load content HTML
- Build prompt for image prompt extraction
- Call OpenAI API
- Parse response (featured image prompt, 1-6 in-article image prompts)
- Create or update Images records with prompts
- Set image_type (featured, in_article)
Output:
- Images records created/updated with prompts
- Image types set
Credits: Included in content generation (no separate charge)
Generate Images Function
Function Name: generate_images
Purpose: Generate images using OpenAI DALL-E or Runware
Input:
- Image IDs (list)
Process:
- Load images with prompts
- Determine image provider from integration settings
- For each image:
- Build image generation request
- Call OpenAI DALL-E API or Runware API
- Receive image URL
- Update Images record with image_url
- Set status to "completed"
- Process images sequentially
Output:
- Images records updated with image URLs
- Image status updated
Credits: 1 credit per image
Credit System - How It Works
Credit Balance Management
Account Credits:
- Each account has a
creditsfield (integer) - Credits start at 0 or plan-included credits
- Credits are deducted for AI operations
- Credits can be added via transactions
Credit Checking:
- Before AI operation: System checks if account has sufficient credits
- If insufficient: Operation fails with
InsufficientCreditsError - If sufficient: Operation proceeds
Credit Deduction:
- After AI operation completes: Credits deducted via
CreditService.deduct_credits() - Account credits field updated
- CreditTransaction record created (type: deduction, amount: negative)
- CreditUsageLog record created with operation details
Credit Addition:
- Via transactions:
CreditService.add_credits()called - Account credits field updated
- CreditTransaction record created (type: purchase/subscription/refund/adjustment, amount: positive)
Credit Transaction Types
Purchase:
- User purchases credits
- Amount: Positive integer
- Description: "Credit purchase"
- Balance after: Account credits + purchase amount
Subscription:
- Credits from subscription renewal
- Amount: Plan's included_credits or credits_per_month
- Description: "Subscription renewal credits"
- Balance after: Account credits + subscription credits
Refund:
- Credits refunded to account
- Amount: Positive integer
- Description: "Credit refund"
- Balance after: Account credits + refund amount
Deduction:
- Credits used for AI operations
- Amount: Negative integer
- Description: Operation-specific (e.g., "Content generation")
- Balance after: Account credits - deduction amount
Adjustment:
- Manual credit adjustments by admin
- Amount: Positive or negative integer
- Description: Admin-provided reason
- Balance after: Account credits + adjustment amount
Credit Usage Logging
Operation Types:
clustering: Keyword clustering operationsideas: Content idea generationcontent: Content generationimages: Image generationreparse: Content reparse operations
Log Details:
- Operation type
- Credits used
- Cost in USD (calculated from API costs)
- Model used (e.g., "gpt-4", "dall-e-3")
- Input tokens (if available)
- Output tokens (if available)
- Related object type (keyword, cluster, task, content, image)
- Related object ID
- Metadata (additional context)
WordPress Integration
WordPress Configuration
Site-Level Configuration:
- Each site can have WordPress integration configured
- Fields:
wp_url,wp_username,wp_app_password - Configuration stored in Site model
WordPress App Password:
- WordPress requires app password (not regular password)
- App password generated in WordPress user settings
- App password used for REST API authentication
Publishing Process
Publishing Workflow:
- User selects content to publish
- System validates WordPress configuration
- System authenticates with WordPress REST API
- System creates WordPress post:
- Title: Content meta_title or task title
- Content: Content HTML
- Status: Draft or Publish (based on content status)
- Featured image: Uploaded if available
- In-article images: Uploaded if available
- Meta fields: Primary keyword, secondary keywords
- WordPress returns post ID
- System updates Content record:
- Sets
wp_post_idfield - Sets
statusto "published"
- Sets
- User can view published content in WordPress
Image Upload:
- Featured image: Images record with
image_type="featured" - In-article images: Images records with
image_type="in_article" - Images uploaded to WordPress media library
- Image URLs updated in WordPress post
Publishing Requirements:
- Site must have
wp_urlconfigured - Site must have
wp_usernameandwp_app_password - Content must have status "review" or "draft"
- WordPress REST API must be accessible
Data Flow and State Management
Frontend State Management
Zustand Stores:
- Auth Store: User authentication, JWT token, account info
- Site Store: Current site selection, accessible sites
- Sector Store: Current sector selection, accessible sectors
- Planner Store: Planner module state (keywords, clusters, ideas)
- Writer Store: Writer module state (tasks, content, images)
- Billing Store: Credit balance, transactions, usage logs
- Settings Store: User settings, preferences
- Page Size Store: Table page size preferences
- Column Visibility Store: Table column visibility preferences
React Contexts:
- Theme Context: Dark/light theme
- Sidebar Context: Sidebar open/closed state
- Header Metrics Context: Header KPI metrics
- Toast Context: Toast notifications
API Communication
API Client:
- Frontend uses Fetch API for HTTP requests
- Base URL:
/api/v1/ - JWT token included in Authorization header
- Request/response format: JSON
Request Flow:
- User action in frontend
- Frontend makes API request
- Backend middleware extracts account from JWT
- Backend ViewSet processes request
- Backend returns JSON response
- Frontend updates state
- Frontend updates UI
Response Format:
- Success:
{success: true, data: {...}, message: "..."} - Error:
{success: false, error: "...", errors: {...}} - Pagination:
{count: N, next: "...", previous: "...", results: [...]}
Celery Task Flow
Task Queueing:
- User action triggers API request
- Backend ViewSet action queues Celery task
- Task ID returned to frontend
- Frontend stores task ID
Progress Polling:
- Frontend polls progress endpoint every 2-3 seconds
- Backend returns progress (phase, percentage, items processed)
- Frontend updates progress UI
- Polling continues until task completes
Task Completion:
- Celery worker completes task
- Results saved to database
- Progress endpoint returns completion status
- Frontend stops polling
- Frontend refreshes data
- Frontend displays results
Complete Feature List
Planner Module Features
Keywords:
- CSV import
- Manual keyword entry
- Keyword filtering (sector, status, intent, cluster, difficulty, volume)
- Keyword search
- Keyword sorting
- Bulk delete
- Bulk status update
- Bulk add from seed keywords
- CSV export
- Auto cluster (AI-powered clustering)
- Keyword-to-cluster linking
- Keyword metrics display (volume, difficulty, intent)
Clusters:
- Cluster listing
- Cluster creation (manual)
- Cluster editing (name, description)
- Cluster deletion
- Keyword-to-cluster management (add/remove)
- Cluster metrics (keywords_count, volume)
- Auto generate ideas (AI-powered idea generation)
- Cluster filtering (sector, status)
- Cluster search
Content Ideas:
- Idea listing
- Idea creation (manual)
- Idea editing (title, description)
- Idea deletion
- Idea status management
- Bulk queue to writer (create tasks from ideas)
- Idea filtering (sector, cluster, status, content type)
- Idea search
Keyword Opportunities:
- Opportunity analysis
- Keyword gap analysis
- Competitive analysis
Writer Module Features
Tasks:
- Task listing
- Task creation (manual or from ideas)
- Task editing (title, description, content type, structure)
- Task deletion
- Task status management
- Auto generate content (AI-powered content generation)
- Task filtering (sector, cluster, status, content type, structure)
- Task search
- Bulk delete
- Bulk status update
Content:
- Content listing
- Content viewing (full HTML)
- Content editing (HTML editor)
- Content status management
- Meta title and description editing
- Primary and secondary keywords editing
- Word count display
- Publish to WordPress
- Content filtering (sector, status, content type)
- Content search
- Drafts view
- Published view
Images:
- Image listing
- Image viewing
- Image creation (manual)
- Image editing (prompt, type)
- Image deletion
- Generate image prompts (AI-powered prompt extraction)
- Generate images (AI-powered image generation)
- Image filtering (content, type, status, task)
- Image bulk status update
- Image regeneration
Thinker Module Features
Prompts:
- Prompt listing
- Prompt viewing
- Prompt editing
- Prompt reset to default
- Prompt type filtering
Author Profiles:
- Profile listing
- Profile creation
- Profile editing
- Profile deletion
- Profile usage in content generation
Strategies:
- Strategy listing
- Strategy creation
- Strategy editing
- Strategy activation/deactivation
- Strategy deletion
- Sector-specific strategies
- Strategy prompt type configuration
- Strategy section logic configuration
Image Testing:
- Test image generation
- Prompt testing
- Provider testing (OpenAI DALL-E, Runware)
- Image preview
System Module Features
Integration Settings:
- OpenAI integration setup
- Runware integration setup
- API key management
- Connection testing
- Test image generation
- Model selection (Runware)
Settings:
- General settings
- Account settings
- User settings
- Module settings
- AI settings
User Management:
- User listing
- User creation
- User editing
- User deletion
- Role assignment
- Site access management
Site Management:
- Site listing
- Site creation
- Site editing
- Site deletion
- WordPress integration configuration
- Industry assignment
Sector Management:
- Sector listing
- Sector creation
- Sector editing
- Sector deletion
- Sector activation/deactivation
- Maximum 5 active sectors per site
Billing Module Features
Credits:
- Credit balance display
- Credit transaction history
- Credit usage logs
- Credit cost display per operation
Transactions:
- Transaction listing
- Transaction filtering (type, date range)
- Transaction details
- Balance tracking
Usage:
- Usage log listing
- Usage log filtering (operation type, date range)
- Cost tracking
- Token tracking
- Model usage tracking
Plans:
- Plan listing
- Plan details
- Plan limits display
- Subscription management
Authentication Features
Sign Up:
- Account creation
- User creation (owner role)
- Subscription creation (default plan)
- Email validation
- Password validation
Sign In:
- Email/password authentication
- JWT token generation
- Token storage (localStorage)
- Account context loading
Password Management:
- Password change
- Password reset (planned)
Session Management:
- Token expiration handling
- Token refresh (planned)
- Logout
Dashboard Features
Home Dashboard:
- Account overview
- KPI metrics
- Recent activity
- Quick actions
Module Dashboards:
- Planner Dashboard: Keyword metrics, cluster metrics, idea metrics
- Writer Dashboard: Task metrics, content metrics, image metrics
- Thinker Dashboard: Prompt metrics, strategy metrics
- Billing Dashboard: Credit balance, usage metrics
Summary
IGNY8 operates as a complete SaaS platform for SEO keyword management and AI-driven content generation. The system follows a clear business flow:
- Setup: Users create accounts, set up sites and sectors
- Planning: Users import keywords, cluster them with AI, generate content ideas
- Creation: Users create tasks from ideas, generate AI content, generate images
- Publishing: Users publish content to WordPress sites
- Management: Users manage credits, transactions, settings, and integrations
All operations are account-isolated, credit-based, and AI-powered. The system provides complete workflows from keyword import to WordPress publishing, with comprehensive filtering, search, and bulk operations throughout.