# Architectuur

## Overzicht

```mermaid
flowchart TB
  subgraph vm106 [VM106 - 10.4.7.18]
    Cockpit[Cockpit :8600]
    ToolsAPI[Tools API :8700]
    Gitea[Gitea :3001]
    PG[(PostgreSQL foodlinkk_db)]
    Cockpit --> ToolsAPI
    Cockpit --> PG
    ToolsAPI --> PG
  end
  subgraph vm105 [VM105 - 10.4.7.19]
    Ollama[Ollama / Hermes]
    Chroma[ChromaDB]
  end
  subgraph proxmox [Proxmox - 10.4.7.14]
    Nodes[VM105 + VM106]
  end
  Cockpit --> Ollama
  ToolsAPI --> Ollama
  ToolsAPI --> proxmox
```

## Lagen

1. **Presentation** — Cockpit templates (Jinja2), Alpine.js, neo CSS thema
2. **API gateway** — Cockpit routes proxyen naar Tools API waar nodig (`retail.py`, `ops_api.py`)
3. **Services** — Tools API connectors (reclamefolder, Proxmox, RSS, CBS, PDOK)
4. **Data** — PostgreSQL met migraties `001`–`016`
5. **Agents** — Souls in `agent_souls`, events in `agent_events`, mesh op `/agents`

## Marketing automatisering

- Upload → `marketing_media` tabel + `/static/uploads/marketing/`
- Publish → `POST /api/marketing/publish` → BackgroundTasks → `social_publish_jobs`
- Credentials → `social_integrations` (Settings tab Social API's)
- Zonder keys: `skipped_not_configured` per kanaal

## IT Ops

- `tools-api/app/connectors/proxmox.py` — SSH/API naar Proxmox host
- Snapshots in `infra_snapshots`
- Cockpit `/ops` — SVG topologie met pulse animaties

## Packaging

- Python generator (`svgwrite`, Pillow, `python-barcode`, reportlab)
- Endpoints onder `/packaging/*` (Tools API) + Cockpit UI `/packaging`
