# rasulkireev/marketing-agents architecture

> Architecture diagram of the GitHub repository rasulkireev/marketing-agents, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rasulkireev/marketing-agents
- Repository: https://github.com/rasulkireev/marketing-agents

## Overview

##### Main Components
- Backend (Django Application):
- Core of the project with two key directories: the “seo_blog_bot” folder (containing settings, ASGI/WGSI, URL configurations, and other high-level project utilities) and the “core” folder (which holds the business logic, models, migrations, views, tasks, signals, and API endpoints).
- A component for administrative tools (admin panel as referenced in the README) and Django’s built-in features.
- Frontend:
- Depicted as a separate module under the “frontend” directory. This contains source code (controllers, application logic, styles, templates) and build configurations (Webpack, PostCSS, Tailwind).
- That the templating system bridges server-side rendering (Django templates) with client-side dynamic controllers.
- External Services & Integrations:
- Stripe for payments and subscriptions. Include this external payment gateway showing data flow to and from the backend.
- CapRover deployment environment and integration with CI/CD (GitHub Actions) as per the deployment directions in the README.
- Background workers: Separate container definitions (seo-blog-bot-workers) are indicated in deployment files.
- Database (likely PostgreSQL) and caching or messaging services (Redis) as separate components in the deployment instructions.

##### Relationships and Interactions
- The frontend communicates with backend API endpoints from “core/api” (e.g., auth, views, schemas).
- Django’s templating system (files in both frontend/templates and core/templates) generates or serves dynamic HTML pages.
- Link the Backend to External Services:
- Demonstrate how Stripe webhooks communicate with the backend (as noted in the README).
- How background tasks (managed via celery-like tasks in core/tasks.py or similar mechanisms) might interact with external queues or worker containers.
- Deployment Infrastructure:
- GitHub Actions workflows that trigger builds and deployments, and their connections to CapRover.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- The division between the backend (“core” and “seo_blog_bot”) and the frontend ensures clear modularity.
- MVC and RESTful API:
- Microservices/Multi-container Deployment:
- CI/CD Integration:
- The presence of GitHub workflows (.github/workflows) and Docker Compose is key. Represent these as auxiliary orchestration components that automate deployment, scaling, and versioning.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend"
        F1["Frontend: Client Application"] 
        F2["Controllers (frontend/src)"]
        F3["Templates (frontend/templates)"]
        F4["Webpack Config (frontend/webpack)"]
        F1 --> F2
        F1 --> F3
        F1 --> F4
    end

    subgraph "Backend"
        B1["Django: Server & Config (seo_blog_bot)"]
        B2["Application Logic (core)"]
        B3["API Endpoints (core/api)"]
        B4["Views (core/views.py)"]
        B5["Business Models (core/models.py)"]
        B6["Admin Interface (core/admin.py)"]
        B7["Background Tasks (core/tasks.py)"]
        B8["Webhook Handler (core/webhooks.py)"]
        B9["Database Migrations (core/migrations)"]
        B1 --> B2
        B2 --> B3
        B2 --> B4
        B2 --> B5
        B2 --> B7
        B2 --> B8
        B2 --> B9
        B2 --> B6
        F2 -- "API_calls" --> B3
        F3 -- "Template_rendering" --> B4
    end

    subgraph "Deployment & External"
        D1["Main App Container (Dockerfile-python)"]
        D2["Worker Container (deployment)"]
        D3["CI/CD Pipeline (.github/workflows)"]
        D4["CapRover Deployment"]
        D5["Stripe Payment Gateway"]
        D6["Database (PostgreSQL)"]
        D7["Cache/Queue (Redis)"]
        D1 --> D6
        D1 --> D7
        D2 --> D7
        D3 --> D1
        D3 --> D2
        B8 -- "receives_events" --> D5
        B7 -- "processes_tasks" --> D2
        B2 -- "DB_Operations" --> D6
    end

    click B1 "https://github.com/rasulkireev/marketing-agents/tree/main/seo_blog_bot/"
    click B2 "https://github.com/rasulkireev/marketing-agents/tree/main/core/"
    click B3 "https://github.com/rasulkireev/marketing-agents/tree/main/core/api/"
    click B4 "https://github.com/rasulkireev/marketing-agents/blob/main/core/views.py"
    click B5 "https://github.com/rasulkireev/marketing-agents/blob/main/core/models.py"
    click B6 "https://github.com/rasulkireev/marketing-agents/blob/main/core/admin.py"
    click B7 "https://github.com/rasulkireev/marketing-agents/blob/main/core/tasks.py"
    click B8 "https://github.com/rasulkireev/marketing-agents/blob/main/core/webhooks.py"
    click B9 "https://github.com/rasulkireev/marketing-agents/tree/main/core/migrations/"
    click F1 "https://github.com/rasulkireev/marketing-agents/tree/main/frontend/"
    click F2 "https://github.com/rasulkireev/marketing-agents/tree/main/frontend/src/"
    click F3 "https://github.com/rasulkireev/marketing-agents/tree/main/frontend/templates/"
    click F4 "https://github.com/rasulkireev/marketing-agents/tree/main/frontend/webpack/"
    click D1 "https://github.com/rasulkireev/marketing-agents/tree/main/Dockerfile-python"
    click D2 "https://github.com/rasulkireev/marketing-agents/tree/main/deployment/"
    click D3 "https://github.com/rasulkireev/marketing-agents/tree/main/.github/workflows"

    classDef frontend fill:#f7d9b1,stroke:#333,stroke-width:2px;
    classDef backend fill:#b1d9f7,stroke:#333,stroke-width:2px;
    classDef infra fill:#d9f7b1,stroke:#333,stroke-width:2px;

    class F1,F2,F3,F4 frontend;
    class B1,B2,B3,B4,B5,B6,B7,B8,B9 backend;
    class D1,D2,D3,D4,D5,D6,D7 infra;
```
