# danielho-bs/newsbot-ai architecture

> Architecture diagram of the GitHub repository danielho-bs/newsbot-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danielho-bs/newsbot-ai
- Repository: https://github.com/danielho-bs/newsbot-ai

## Overview

##### Main Components
- Docker Infrastructure: Represent Docker as the overarching container orchestration environment created via the Dockerfile and docker-compose.yml.
- n8n Service: This is the workflow automation tool. It should be depicted as a container that pulls in and runs the NewsBot_AI.json workflow file, which governs the automation steps.
- Ollama Service: Represent this container for language/model processing. Indicate that it exposes a base URL (http://host.docker.internal:11434/) and is launched by a Docker image.
- Discord Webhook: Show this as an external endpoint that receives messages/notifications coming out of the automation.

##### Architectural Patterns & Design Principles
- Containerized Microservices: Emphasize the separation of concerns (n8n vs. Ollama) by using Docker containers managed via docker-compose.
- Workflow Automation: Indicate the use of workflow definitions (NewsBot_AI.json) within n8n to automate the process.
- Integration with External APIs/Webhooks: Clearly mark the connections with Discord and external CNN news feeds.

##### Specify Relevant Technologies
- Docker and Docker Compose will be illustrated as the means of deploying and managing services.
- n8n as the workflow automation component.
- Ollama as the language model processing engine.
- Discord Webhooks (depicted as an external service endpoint for sending notifications).
- Any additional technologies noted in references (e.g., API endpoints, base URLs, ports).

##### Elements
- Annotations for ports and URLs (e.g., n8n at http://localhost:5678 and Ollama Base URL).

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Deployment Config"
        DF("Dockerfile"):::config
        DC("docker-compose.yml"):::config
    end

    subgraph "Containerized Services"
        N8N("n8n Workflow Engine Container\n(http://localhost:5678)"):::container
        OB("Ollama Language Service Container\n(Base URL: http://host.docker.internal:11434)"):::container
    end

    NF("NewsBot Workflow File"):::file
    CNN("CNN News Source"):::external
    DIS("Discord Webhook"):::external

    DF -->|"deploys"| N8N
    DC -->|"deploys"| N8N
    DF -->|"deploys"| OB
    DC -->|"deploys"| OB

    NF -->|"loaded_by"| N8N

    CNN -->|"fetches"| N8N
    N8N -->|"sends_to"| OB
    N8N -->|"posts_to"| DIS

    click DF "https://github.com/danielho-bs/newsbot-ai/tree/main/Dockerfile"
    click DC "https://github.com/danielho-bs/newsbot-ai/blob/main/docker-compose.yml"
    click NF "https://github.com/danielho-bs/newsbot-ai/blob/main/NewsBot_AI.json"

    classDef config fill:#f9e79f,stroke:#b7950b,stroke-width:2px;
    classDef container fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef external fill:#d5f5e3,stroke:#229954,stroke-width:2px;
    classDef file fill:#fadbd8,stroke:#c0392b,stroke-width:2px;
```
