FINAL DOCUMENTATION STRUCTURE
==============================

docs/
├── README.md (Master navigation - find anything in 1 step)
├── CHANGELOG.md (All changes across system)
│
├── 00-SYSTEM/
│   ├── ARCHITECTURE-OVERVIEW.md (High-level system design)
│   ├── TECH-STACK.md (All technologies used)
│   ├── MULTITENANCY.md (Account isolation, tenant context)
│   ├── AUTHENTICATION.md (JWT, sessions, permissions)
│   └── DATA-FLOWS.md (Visual workflows across system)
│
├── 10-BACKEND/
│   ├── OVERVIEW.md (Backend architecture)
│   ├── MODELS.md (All database models with fields)
│   ├── SERVICES.md (Business logic services)
│   │
│   ├── accounts/
│   │   └── ACCOUNTS-REFERENCE.md (User, Account, Role models + endpoints)
│   │
│   ├── billing/
│   │   ├── BILLING-REFERENCE.md (Plans, Subscriptions, Invoices)
│   │   ├── CREDITS-SYSTEM.md (Credit allocation/deduction)
│   │   └── PAYMENT-METHODS.md (Payment processing)
│   │
│   ├── planner/
│   │   ├── PLANNER-REFERENCE.md (Keywords → Clusters → Ideas)
│   │   ├── KEYWORD-CLUSTERING.md (Clustering algorithm)
│   │   └── IDEA-GENERATION.md (AI-powered idea generation)
│   │
│   ├── writer/
│   │   ├── WRITER-REFERENCE.md (Content generation)
│   │   ├── CONTENT-GENERATION.md (AI content creation flow)
│   │   ├── IMAGES-SYSTEM.md (Image generation & management)
│   │   └── PUBLISHING.md (Review & publish workflow)
│   │
│   ├── automation/
│   │   ├── AUTOMATION-REFERENCE.md (Full automation pipeline)
│   │   ├── PIPELINE-STAGES.md (Stage-by-stage breakdown)
│   │   └── SCHEDULER.md (Celery tasks & scheduling)
│   │
│   ├── integrations/
│   │   ├── WORDPRESS-INTEGRATION.md (WP sync & publishing)
│   │   ├── AI-SERVICES.md (OpenAI, Anthropic integration)
│   │   └── IMAGE-GENERATION.md (DALL-E, Stability AI)
│   │
│   └── sites/
│       └── SITES-REFERENCE.md (Site & Sector management)
│
├── 20-API/
│   ├── API-REFERENCE.md (All REST endpoints)
│   ├── AUTHENTICATION-ENDPOINTS.md (Login, register, tokens)
│   ├── PLANNER-ENDPOINTS.md (Keywords, clusters, ideas)
│   ├── WRITER-ENDPOINTS.md (Content, tasks, images)
│   ├── AUTOMATION-ENDPOINTS.md (Automation runs)
│   ├── BILLING-ENDPOINTS.md (Invoices, payments, credits)
│   └── INTEGRATION-ENDPOINTS.md (WordPress, external services)
│
├── 30-FRONTEND/
│   ├── FRONTEND-ARCHITECTURE.md (React structure, routing)
│   ├── STATE-MANAGEMENT.md (Zustand stores)
│   ├── COMPONENTS.md (Reusable UI components)
│   │
│   ├── planner/
│   │   └── PLANNER-UI.md (Keywords, clusters, ideas pages)
│   │
│   ├── writer/
│   │   └── WRITER-UI.md (Content, tasks, publishing pages)
│   │
│   ├── automation/
│   │   └── AUTOMATION-UI.md (Automation dashboard)
│   │
│   └── billing/
│       └── BILLING-UI.md (Plans, payments, invoices)
│
├── 40-WORKFLOWS/
│   ├── SIGNUP-TO-ACTIVE.md (User journey from signup to active)
│   ├── CONTENT-LIFECYCLE.md (Keyword → Idea → Task → Content → Published)
│   ├── PAYMENT-WORKFLOW.md (Manual payment approval flow)
│   ├── AUTOMATION-WORKFLOW.md (Full automation run lifecycle)
│   └── WORDPRESS-SYNC.md (Bidirectional sync workflow)
│
├── 50-DEPLOYMENT/
│   ├── ENVIRONMENT-SETUP.md (Local, staging, production)
│   ├── DOCKER-DEPLOYMENT.md (Container setup)
│   └── DATABASE-MIGRATIONS.md (Migration strategy)
│
└── 90-ARCHIVED/
    └── (Old deprecated docs for reference)

NAVIGATION RULES
================

1. Master README.md has "Quick Find" table:
   - Want to add feature? → Find module → Find file
   - Want to troubleshoot? → Find workflow → Find exact function
   - Want API details? → Find endpoint → See request/response/location

2. Every doc file has:
   - Purpose statement
   - File locations (exact paths)
   - Function/Class names (no code)
   - Related files (cross-references)
   - Data flow (if applicable)

3. No code snippets, only:
   - File paths: backend/igny8_core/business/billing/services/credit_service.py
   - Function names: CreditService.add_credits()
   - Model fields: account.credits, invoice.total
   - Endpoints: POST /v1/billing/admin/payments/confirm/

4. Visual elements allowed:
   - ASCII flow diagrams
   - State transition tables
   - Field mapping tables
   - Workflow sequences

