IGNY8 HOLISTIC ARCHITECTURE PLAN
Complete System Architecture, Implementation Strategy, and Structure
Last Updated: 2025-01-XX
Purpose: Comprehensive architecture plan combining existing system, Phase 2 requirements, automation, multi-site management, and best practices.
TABLE OF CONTENTS
- Architecture Overview
- Container Architecture
- Backend Layer Structure
- Frontend Structure
- Automation System
- Multi-Site Management
- Volume & Storage Strategy
- Repository Structure
- Implementation Phases
- Limits & Boundaries
1. ARCHITECTURE OVERVIEW
1.1 Core Principles
| Principle |
Description |
Implementation |
| Domain-Driven Design |
Organize by business domains, not technical layers |
domain/ folder with content, planning, linking, optimization, publishing domains |
| Service Layer Pattern |
Business logic in services, not ViewSets |
All modules delegate to domain services |
| Single Responsibility |
Each layer has one clear purpose |
Core → Domain → Module → Infrastructure |
| No Duplication |
Reuse services across modules |
ContentGenerationService used by Writer + Site Builder |
| Multi-Tenancy First |
All features respect account/site/sector boundaries |
All models inherit AccountBaseModel or SiteSectorBaseModel |
| Automation Ready |
All functions can be automated via Celery |
All AI functions exposed as Celery tasks with scheduling support |
1.2 System Boundaries
| System |
Purpose |
Technology |
Container |
| IGNY8 Core App |
Main backend API (all domains) |
Django 5.2+ |
igny8_backend |
| IGNY8 Main App |
Dashboard UI |
React 19 + Vite |
igny8_frontend |
| IGNY8 Site Builder |
Site creation wizard |
React 19 + Vite |
igny8_site_builder (NEW) |
| IGNY8 Sites |
Public site renderer |
React 19 + Vite/Next.js |
igny8_sites (NEW) |
| IGNY8 Marketing |
Marketing website |
React 19 + Vite |
igny8_marketing_dev (can merge with Sites) |
| Celery Workers |
Async task processing |
Celery + Redis |
igny8_celery_worker |
| Celery Beat |
Scheduled automation |
Celery Beat |
igny8_celery_beat |
2. CONTAINER ARCHITECTURE
2.1 Container Structure
| Container |
Port |
Purpose |
Volumes |
Dependencies |
igny8_backend |
8011:8010 |
Django API server |
/data/app/igny8/backend:/app, /data/app/logs:/app/logs, /data/app/storage:/app/storage |
postgres, redis |
igny8_frontend |
8021:5173 |
Main app UI (dev) |
/data/app/igny8/frontend:/app |
igny8_backend |
igny8_site_builder |
8022:5175 |
Site Builder UI (NEW) |
/data/app/igny8/site-builder:/app |
igny8_backend |
igny8_sites |
8024:5176 |
Sites renderer (NEW) |
/data/app/igny8/sites:/app, /data/app/sites-data:/sites |
igny8_backend |
igny8_marketing_dev |
8023:5174 |
Marketing site |
/data/app/igny8/frontend:/app |
igny8_backend |
igny8_celery_worker |
- |
Async tasks |
/data/app/igny8/backend:/app, /data/app/logs:/app/logs |
postgres, redis |
igny8_celery_beat |
- |
Scheduled tasks |
/data/app/igny8/backend:/app, /data/app/logs:/app/logs |
postgres, redis |
2.2 Volume Strategy
| Volume Path |
Purpose |
Mount Type |
Backup Strategy |
/data/app/igny8/backend |
Backend code (dev) |
Bind mount (rw) |
Git repo |
/data/app/igny8/frontend |
Frontend code (dev) |
Bind mount (rw) |
Git repo |
/data/app/igny8/site-builder |
Site Builder code (NEW) |
Bind mount (rw) |
Git repo |
/data/app/igny8/sites |
Sites renderer code (NEW) |
Bind mount (rw) |
Git repo |
/data/app/storage |
Generated files, images |
Named volume |
Daily backup |
/data/app/sites-data |
Rendered site files (NEW) |
Named volume |
Daily backup |
/data/app/logs |
Application logs |
Named volume |
Rotate weekly |
/data/app/cache |
Redis cache (optional) |
Named volume |
No backup |
Volume Improvements:
- Use named volumes for data (storage, sites-data, logs) - better performance, easier backup
- Use bind mounts only for code (development)
- Production: Use named volumes for all, code deployed via images
3. BACKEND LAYER STRUCTURE
3.1 Complete Backend Structure
3.2 Model Extensions
| Model |
Current Location |
New Location |
Extensions Needed |
Content |
modules/writer/models.py |
domain/content/models.py |
Add: entity_type, json_blocks, structure_data, linker_version, optimizer_version, internal_links, optimization_scores, published_to, external_ids |
Tasks |
modules/writer/models.py |
domain/content/models.py |
Add: entity_type choices (product, service, taxonomy, etc.) |
Keywords |
modules/planner/models.py |
domain/planning/models.py |
No changes |
Clusters |
modules/planner/models.py |
domain/planning/models.py |
No changes |
ContentIdeas |
modules/planner/models.py |
domain/planning/models.py |
Add: entity_type support |
InternalLinks |
- |
domain/linking/models.py |
NEW: source_id, target_id, anchor, position, link_type |
OptimizationTask |
- |
domain/optimization/models.py |
NEW: content_id, type, target_keyword, scores_before, scores_after, html_before, html_after |
SiteBlueprint |
- |
domain/site_building/models.py |
NEW: tenant, site, config_json, structure_json, status |
PageBlueprint |
- |
domain/site_building/models.py |
NEW: site_blueprint, slug, type, blocks_json, status |
PublishingRecord |
- |
domain/publishing/models.py |
NEW: content_id, destination, status, external_id, published_at |
DeploymentRecord |
- |
domain/publishing/models.py |
NEW: site_blueprint, version, status, build_url, deployed_at |
AutomationRule |
- |
domain/automation/models.py |
NEW: name, trigger, conditions, actions, schedule, is_active |
ScheduledTask |
- |
domain/automation/models.py |
NEW: automation_rule, scheduled_at, status, executed_at |
4. FRONTEND STRUCTURE
4.1 Main App Structure (igny8_frontend)
4.2 Site Builder Structure (NEW Container)
4.3 Sites Renderer Structure (NEW Container)
5. AUTOMATION SYSTEM
5.1 Automation Architecture
| Component |
Purpose |
Implementation |
| AutomationRule Model |
Store automation rules |
domain/automation/models.py |
| AutomationService |
Execute automation rules |
domain/automation/services/automation_service.py |
| Celery Beat Tasks |
Scheduled automation |
infrastructure/messaging/automation_tasks.py |
| Automation API |
CRUD for rules |
modules/automation/views.py |
| Automation UI |
Manage rules |
frontend/src/pages/Automation/ |
5.2 Automation Rule Structure
5.3 Automation Workflows
| Workflow |
Trigger |
Actions |
Schedule |
| Auto Cluster Keywords |
New keywords added |
Run clustering AI |
Daily at 2 AM |
| Auto Generate Ideas |
Cluster created |
Generate ideas for cluster |
Immediate or scheduled |
| Auto Create Tasks |
Ideas created |
Create tasks from ideas |
Daily at 9 AM |
| Auto Generate Content |
Tasks queued |
Generate content for tasks |
Hourly (respects daily limit) |
| Auto Generate Images |
Content generated |
Generate images for content |
Immediate |
| Auto Link Content |
Content generated |
Run linker on content |
After content generation |
| Auto Optimize Content |
Content linked |
Run optimizer on content |
After linking |
| Auto Publish |
Content optimized |
Publish to WordPress/Sites |
Daily at 10 AM |
5.4 Automation Implementation
| Task |
File |
Implementation |
| AutomationRule Model |
domain/automation/models.py |
Create model with trigger, conditions, actions, schedule |
| AutomationService |
domain/automation/services/automation_service.py |
execute_rule(), check_conditions(), execute_actions() |
| Celery Beat Tasks |
infrastructure/messaging/automation_tasks.py |
@periodic_task decorators for scheduled rules |
| Automation API |
modules/automation/views.py |
CRUD ViewSet for AutomationRule |
| Automation UI |
frontend/src/pages/Automation/ |
Dashboard, Rules management, History |
6. MULTI-SITE MANAGEMENT
6.1 Site Isolation Strategy
| Aspect |
Implementation |
Purpose |
| Database Filtering |
All models inherit AccountBaseModel/SiteSectorBaseModel |
Automatic site isolation |
| API Filtering |
ViewSets use base classes |
Automatic filtering by site_id |
| Storage Isolation |
/data/app/storage/{site_id}/ |
Separate storage per site |
| Site-Specific Limits |
Plan limits enforced per site |
Prevent one site from overwhelming system |
| Queue Isolation |
Celery queues per site (optional) |
Prevent site blocking |
| Rate Limiting |
Per-site rate limits |
Prevent abuse |
6.2 Site Resource Management
| Resource |
Limit Type |
Enforcement |
Location |
| Daily Content Tasks |
Per site |
Plan.daily_content_tasks |
domain/content/services/content_generation_service.py |
| Daily AI Requests |
Per site |
Plan.daily_ai_requests |
infrastructure/ai/engine.py |
| Monthly Word Count |
Per site |
Plan.monthly_word_count_limit |
domain/content/services/content_generation_service.py |
| Daily Image Generation |
Per site |
Plan.daily_image_generation_limit |
infrastructure/ai/functions/generate_images.py |
| Storage Quota |
Per site |
Configurable (default: 10GB) |
infrastructure/storage/file_storage.py |
| Concurrent Tasks |
Per site |
Configurable (default: 5) |
Celery queue configuration |
6.3 Site Performance Optimization
| Optimization |
Implementation |
Benefit |
| Database Indexing |
Indexes on site_id, sector_id, account_id |
Faster queries |
| Query Optimization |
select_related(), prefetch_related() |
Reduce DB queries |
| Caching |
Redis cache per site |
Faster responses |
| Background Processing |
Celery for heavy operations |
Non-blocking |
| Resource Throttling |
Per-site rate limits |
Prevent overload |
7. VOLUME & STORAGE STRATEGY
7.1 Volume Structure
7.2 Volume Mounting Strategy
| Volume |
Type |
Purpose |
Backup |
| Code directories |
Bind mount (dev) / Image (prod) |
Source code |
Git repo |
| storage/ |
Named volume |
Generated files, images |
Daily backup |
| sites-data/ |
Named volume |
Rendered site files |
Daily backup |
| logs/ |
Named volume |
Application logs |
Weekly rotation |
| cache/ |
Named volume |
Redis cache |
No backup |
7.3 Storage Service Implementation
8. REPOSITORY STRUCTURE
8.1 Main Repository Structure
8.2 Branching Strategy
| Branch |
Purpose |
Merge To |
Protection |
main |
Production-ready code |
- |
Protected, requires PR |
develop |
Integration branch |
main |
Protected, requires PR |
feature/* |
Feature branches |
develop |
Not protected |
phase-2/* |
Phase 2 features |
develop |
Not protected |
hotfix/* |
Critical fixes |
main, develop |
Not protected |
release/* |
Release candidates |
main |
Protected |
8.3 Repository Exclusions (.gitignore)
8.4 Separate Repositories (Optional)
| Repository |
Contents |
Purpose |
igny8-core |
Backend + Main frontend |
Core platform |
igny8-site-builder |
Site Builder code |
Separate deployment |
igny8-sites |
Sites renderer |
Separate deployment |
igny8-wp-plugin |
WordPress plugin |
External (separate) |
igny8-wp-theme |
WordPress theme |
External (separate) |
Recommendation: Keep all in one repo (igny8) with clear folder structure. Separate repos only if deployment cycles differ significantly.
9. IMPLEMENTATION PHASES
9.1 Phase 0: Foundation (Current + Immediate)
| Task |
Files |
Status |
Priority |
| Extend Content Model |
domain/content/models.py |
TODO |
HIGH |
| Create Service Layer |
domain/*/services/ |
TODO |
HIGH |
| Refactor ViewSets |
modules/*/views.py |
TODO |
HIGH |
| Implement Automation Models |
domain/automation/models.py |
TODO |
HIGH |
| Implement Automation Service |
domain/automation/services/ |
TODO |
HIGH |
| Implement Automation API |
modules/automation/ |
TODO |
HIGH |
| Implement Automation UI |
frontend/src/pages/Automation/ |
TODO |
HIGH |
| Implement Schedules UI |
frontend/src/pages/Schedules.tsx |
TODO |
HIGH |
9.2 Phase 1: Site Builder
| Task |
Files |
Dependencies |
Priority |
| Create Site Builder Container |
docker-compose.app.yml |
Phase 0 |
HIGH |
| Site Builder Models |
domain/site_building/models.py |
Phase 0 |
HIGH |
| Structure Generation Service |
domain/site_building/services/ |
Phase 0 |
HIGH |
| Structure Generation AI Function |
infrastructure/ai/functions/generate_site_structure.py |
Phase 0 |
HIGH |
| Site Builder API |
modules/site_builder/ |
Phase 0 |
HIGH |
| Site Builder Frontend |
site-builder/src/ |
Phase 0 |
HIGH |
9.3 Phase 2: Linker & Optimizer
| Task |
Files |
Dependencies |
Priority |
| Linker Models |
domain/linking/models.py |
Phase 0 |
MEDIUM |
| Linker Service |
domain/linking/services/ |
Phase 0 |
MEDIUM |
| Linker API |
modules/linker/ |
Phase 0 |
MEDIUM |
| Linker UI |
frontend/src/pages/Linker/ |
Phase 0 |
MEDIUM |
| Optimizer Models |
domain/optimization/models.py |
Phase 0 |
MEDIUM |
| Optimizer Service |
domain/optimization/services/ |
Phase 0 |
MEDIUM |
| Optimizer AI Function |
infrastructure/ai/functions/optimize_content.py |
Phase 0 |
MEDIUM |
| Optimizer API |
modules/optimizer/ |
Phase 0 |
MEDIUM |
| Optimizer UI |
frontend/src/pages/Optimizer/ |
Phase 0 |
MEDIUM |
9.4 Phase 3: Sites Renderer
| Task |
Files |
Dependencies |
Priority |
| Create Sites Container |
docker-compose.app.yml |
Phase 1 |
MEDIUM |
| Sites Renderer Frontend |
sites/src/ |
Phase 1 |
MEDIUM |
| Publisher Service |
domain/publishing/services/ |
Phase 0 |
MEDIUM |
| Sites Renderer Adapter |
domain/publishing/services/adapters/ |
Phase 1 |
MEDIUM |
| Publisher API |
modules/publisher/ |
Phase 0 |
MEDIUM |
| Deployment Service |
domain/publishing/services/deployment_service.py |
Phase 1 |
MEDIUM |
9.5 Phase 4: Universal Content Types
| Task |
Files |
Dependencies |
Priority |
| Extend Content Model |
domain/content/models.py |
Phase 0 |
LOW |
| Product Content Prompts |
infrastructure/ai/prompts.py |
Phase 0 |
LOW |
| Service Page Prompts |
infrastructure/ai/prompts.py |
Phase 0 |
LOW |
| Taxonomy Prompts |
infrastructure/ai/prompts.py |
Phase 0 |
LOW |
| Content Type Support in Writer |
domain/content/services/ |
Phase 0 |
LOW |
| Content Type Support in Linker |
domain/linking/services/ |
Phase 2 |
LOW |
| Content Type Support in Optimizer |
domain/optimization/services/ |
Phase 2 |
LOW |
10. LIMITS & BOUNDARIES
10.1 Plan Limits (Existing)
| Limit |
Model Field |
Enforcement Location |
Per |
| Max Keywords |
Plan.max_keywords |
domain/planning/services/clustering_service.py |
Account |
| Max Clusters |
Plan.max_clusters |
domain/planning/services/clustering_service.py |
Account |
| Max Content Ideas |
Plan.max_content_ideas |
domain/planning/services/ideas_service.py |
Account |
| Daily Content Tasks |
Plan.daily_content_tasks |
domain/content/services/content_generation_service.py |
Site |
| Daily AI Requests |
Plan.daily_ai_requests |
infrastructure/ai/engine.py |
Site |
| Monthly Word Count |
Plan.monthly_word_count_limit |
domain/content/services/content_generation_service.py |
Site |
| Daily Image Generation |
Plan.daily_image_generation_limit |
infrastructure/ai/functions/generate_images.py |
Site |
| Monthly Image Count |
Plan.monthly_image_count |
infrastructure/ai/functions/generate_images.py |
Site |
| Max Sites |
Plan.max_sites |
core/auth/models.py (Account.save) |
Account |
| Max Users |
Plan.max_users |
core/auth/models.py (Account.save) |
Account |
10.2 New Limits for Phase 2
| Limit |
Model Field |
Enforcement Location |
Per |
| Max Sites Built |
Plan.max_sites_built (NEW) |
domain/site_building/services/ |
Account |
| Daily Site Generations |
Plan.daily_site_generations (NEW) |
domain/site_building/services/ |
Site |
| Storage Quota |
Plan.storage_quota_gb (NEW) |
infrastructure/storage/file_storage.py |
Site |
| Max Automation Rules |
Plan.max_automation_rules (NEW) |
domain/automation/services/ |
Account |
| Daily Automation Executions |
Plan.daily_automation_executions (NEW) |
domain/automation/services/ |
Site |
| Max Concurrent Tasks |
Plan.max_concurrent_tasks (NEW) |
Celery queue config |
Site |
10.3 Admin Boundaries
| Boundary |
Implementation |
Location |
| System Account |
Account.is_system_account() |
core/auth/models.py |
| Superuser Access |
User.is_superuser |
core/auth/models.py |
| Plan Management |
Admin-only ViewSet |
modules/system/views.py |
| User Management |
Role-based permissions |
core/api/permissions.py |
| Credit Management |
Admin-only actions |
modules/billing/views.py |
| Automation Management |
Role-based (Owner/Admin) |
modules/automation/views.py |
10.4 Multi-Tenancy Boundaries
| Boundary |
Implementation |
Location |
| Account Isolation |
AccountBaseModel |
core/base/models.py |
| Site Isolation |
SiteSectorBaseModel |
core/base/models.py |
| Sector Isolation |
SiteSectorBaseModel |
core/base/models.py |
| API Filtering |
Base ViewSets |
core/api/base.py |
| Storage Isolation |
Site-specific paths |
infrastructure/storage/file_storage.py |
| Queue Isolation |
Site-specific queues (optional) |
Celery config |
SUMMARY
Key Architectural Decisions
- Domain-Driven Structure: Organize by business domains, not technical layers
- Service Layer: All business logic in services, ViewSets are thin
- Unified Content Model: Extend existing
Content model, don't create duplicates
- Automation First: All functions can be automated via Celery + AutomationRule
- Multi-Site Ready: All features respect site boundaries and limits
- Volume Strategy: Named volumes for data, bind mounts for code (dev)
- Single Repository: Keep all code in one repo with clear structure
- Container Separation: Separate containers for different UIs (Main, Site Builder, Sites)
Implementation Order
- Phase 0: Foundation (Service layer, Automation, Model extensions)
- Phase 1: Site Builder
- Phase 2: Linker & Optimizer
- Phase 3: Sites Renderer
- Phase 4: Universal Content Types
Success Criteria
- ✅ No code duplication
- ✅ All functions automatable
- ✅ Multi-site isolation working
- ✅ Limits enforced per site
- ✅ Volume strategy optimized
- ✅ Repository structure clean
- ✅ All placeholders implemented
END OF DOCUMENT