# aro310/portfolio_api architecture

> Architecture diagram of the GitHub repository aro310/portfolio_api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aro310/portfolio_api
- Repository: https://github.com/aro310/portfolio_api

## Overview

The sampled Python runtime implements a portfolio chatbot API: visitors submit chat prompts, the API manages optional conversation history, calls the Groq-backed assistant, and returns text/actions; separate routes generate speech or send contact messages. The README instead describes Rhubarb Lip Sync, a separate audio-to-mouth-cue product with CLI exports and editor integrations, so both documented product branches are represented without implying they connect. Source excerpts support the API and selected integration calls; README-only product relationships are documented capabilities, not inspected implementations.

Main entry points: [`app.py`](https://github.com/aro310/portfolio_api/blob/main/app.py) (Flask API), [`rhubarb.exe`](https://github.com/aro310/portfolio_api/blob/main/rhubarb.exe) (Rhubarb CLI), [`gemini_api.py`](https://github.com/aro310/portfolio_api/blob/main/gemini_api.py) (Chat Orchestrator), [`mcp_service.py`](https://github.com/aro310/portfolio_api/blob/main/mcp_service.py) (MCP Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Chat API"]
  node_flask["Flask API<br/>[app.py]"]
  node_history["Session History<br/>[app.py]"]
  node_supabase[("Supabase")]
  node_contact["Contact Mail<br/>[app.py]"]
end

subgraph group_assistant["Assistant Services"]
  node_chat["Chat Orchestrator<br/>[gemini_api.py]"]
  node_groq["Groq Chat API"]
  node_websearch["Web Search<br/>[gemini_api.py]"]
  node_mcp["MCP Client<br/>[mcp_service.py]"]
  node_n8n["n8n Tools"]
  node_localmail["Assistant Email Tool<br/>[gemini_api.py]"]
  node_tts["Speech Generation<br/>[ele.py]"]
  node_eleven["ElevenLabs"]
end

subgraph group_lip["Lip Sync Product"]
  node_rhubarb["Rhubarb CLI<br/>[rhubarb.exe]"]
  node_cues["Mouth Cue Export<br/>[rhubarb.exe]"]
  node_formats["TSV XML JSON DAT<br/>[README.adoc]"]
end

subgraph group_integrations["Editor Integrations"]
  node_aftereffects["After Effects Script"]
  node_spine["Spine Integration"]
  node_vegas["Vegas Scripts<br/>[Import Rhubarb.cs]"]
  node_moho["Moho OpenToonz<br/>[README.adoc]"]
end

node_visitor(("Visitor"))
node_audio(("Voice Recording"))

node_visitor -->|"sends requests"| node_flask
node_flask -->|"loads and saves"| node_history
node_history -->|"reads and writes"| node_supabase
node_flask -->|"calls assistant"| node_chat
node_chat -->|"calls chat API"| node_groq
node_chat -->|"searches context"| node_websearch
node_chat -->|"executes tools"| node_mcp
node_mcp -->|"lists and calls"| node_n8n
node_chat -->|"runs local tool"| node_localmail
node_localmail -->|"emails contact"| node_visitor
node_visitor -->|"submits contact"| node_flask
node_flask -->|"sends email"| node_contact
node_visitor -->|"requests speech"| node_flask
node_flask -->|"generates audio"| node_tts
node_tts -->|"requests speech"| node_eleven
node_audio -->|"provides recording"| node_rhubarb
node_rhubarb -->|"generates cues"| node_cues
node_rhubarb -->|"exports formats"| node_formats
node_aftereffects -->|"runs CLI"| node_rhubarb
node_spine -->|"imports project"| node_rhubarb
node_vegas -->|"imports results"| node_rhubarb
node_moho -->|"uses DAT output"| node_rhubarb

click node_flask "https://github.com/aro310/portfolio_api/blob/main/app.py"
click node_history "https://github.com/aro310/portfolio_api/blob/main/app.py"
click node_contact "https://github.com/aro310/portfolio_api/blob/main/app.py"
click node_chat "https://github.com/aro310/portfolio_api/blob/main/gemini_api.py"
click node_websearch "https://github.com/aro310/portfolio_api/blob/main/gemini_api.py"
click node_mcp "https://github.com/aro310/portfolio_api/blob/main/mcp_service.py"
click node_localmail "https://github.com/aro310/portfolio_api/blob/main/gemini_api.py"
click node_tts "https://github.com/aro310/portfolio_api/blob/main/ele.py"
click node_rhubarb "https://github.com/aro310/portfolio_api/blob/main/rhubarb.exe"
click node_cues "https://github.com/aro310/portfolio_api/blob/main/rhubarb.exe"
click node_formats "https://github.com/aro310/portfolio_api/blob/main/README.adoc"
click node_aftereffects "https://github.com/aro310/portfolio_api/blob/main/extras/AdobeAfterEffects/Rhubarb%20Lip%20Sync.jsx"
click node_spine "https://github.com/aro310/portfolio_api/tree/main/extras/EsotericSoftwareSpine"
click node_vegas "https://github.com/aro310/portfolio_api/blob/main/extras/MagixVegas/Import%20Rhubarb.cs"
click node_moho "https://github.com/aro310/portfolio_api/blob/main/README.adoc"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_flask,node_history,node_supabase,node_contact toneBlue
class node_chat,node_groq,node_websearch,node_mcp,node_n8n,node_localmail,node_tts,node_eleven toneAmber
class node_rhubarb,node_cues,node_formats toneMint
class node_aftereffects,node_spine,node_vegas,node_moho toneRose
class node_visitor,node_audio toneIndigo
```

## Components

### Chat API

- [Flask API](https://github.com/aro310/portfolio_api/blob/main/app.py): `app.py`
- [Session History](https://github.com/aro310/portfolio_api/blob/main/app.py): `app.py`
- **Supabase**
- [Contact Mail](https://github.com/aro310/portfolio_api/blob/main/app.py): `app.py`

### Assistant Services

- [Chat Orchestrator](https://github.com/aro310/portfolio_api/blob/main/gemini_api.py): `gemini_api.py`
- **Groq Chat API**
- [Web Search](https://github.com/aro310/portfolio_api/blob/main/gemini_api.py): `gemini_api.py`
- [MCP Client](https://github.com/aro310/portfolio_api/blob/main/mcp_service.py): `mcp_service.py`
- **n8n Tools**
- [Assistant Email Tool](https://github.com/aro310/portfolio_api/blob/main/gemini_api.py): `gemini_api.py`
- [Speech Generation](https://github.com/aro310/portfolio_api/blob/main/ele.py): `ele.py`
- **ElevenLabs**

### Lip Sync Product

- [Rhubarb CLI](https://github.com/aro310/portfolio_api/blob/main/rhubarb.exe): `rhubarb.exe`
- [Mouth Cue Export](https://github.com/aro310/portfolio_api/blob/main/rhubarb.exe): `rhubarb.exe`
- [TSV XML JSON DAT](https://github.com/aro310/portfolio_api/blob/main/README.adoc): `README.adoc`

### Editor Integrations

- [After Effects Script](https://github.com/aro310/portfolio_api/blob/main/extras/AdobeAfterEffects/Rhubarb%20Lip%20Sync.jsx): `extras/AdobeAfterEffects/Rhubarb Lip Sync.jsx`
- [Spine Integration](https://github.com/aro310/portfolio_api/tree/main/extras/EsotericSoftwareSpine): `extras/EsotericSoftwareSpine`
- [Vegas Scripts](https://github.com/aro310/portfolio_api/blob/main/extras/MagixVegas/Import%20Rhubarb.cs): `extras/MagixVegas/Import Rhubarb.cs`
- [Moho OpenToonz](https://github.com/aro310/portfolio_api/blob/main/README.adoc): `README.adoc`

### Other components

- **Visitor**
- **Voice Recording**

## Connections

- Visitor → Flask API: sends requests (evidence: `app.py`)
- Flask API → Session History: loads and saves (evidence: `app.py`)
- Session History → Supabase: reads and writes (evidence: `app.py`)
- Flask API → Chat Orchestrator: calls assistant (evidence: `app.py`)
- Chat Orchestrator → Groq Chat API: calls chat API (evidence: `gemini_api.py`)
- Chat Orchestrator → Web Search: searches context (evidence: `gemini_api.py`)
- Chat Orchestrator → MCP Client: executes tools (evidence: `gemini_api.py`)
- MCP Client → n8n Tools: lists and calls (evidence: `mcp_service.py`)
- Chat Orchestrator → Assistant Email Tool: runs local tool (evidence: `gemini_api.py`)
- Assistant Email Tool → Visitor: emails contact (evidence: `gemini_api.py`)
- Visitor → Flask API: submits contact (evidence: `app.py`)
- Flask API → Contact Mail: sends email (evidence: `app.py`)
- Visitor → Flask API: requests speech (evidence: `app.py`)
- Flask API → Speech Generation: generates audio (evidence: `app.py`)
- Speech Generation → ElevenLabs: requests speech (evidence: `ele.py`)
- Voice Recording → Rhubarb CLI: provides recording (evidence: `README.adoc`)
- Rhubarb CLI → Mouth Cue Export: generates cues (evidence: `README.adoc`)
- Rhubarb CLI → TSV XML JSON DAT: exports formats (evidence: `README.adoc`)
- After Effects Script → Rhubarb CLI: runs CLI (evidence: `extras/AdobeAfterEffects/Rhubarb Lip Sync.jsx`)
- Spine Integration → Rhubarb CLI: imports project (evidence: `README.adoc`)
- Vegas Scripts → Rhubarb CLI: imports results (evidence: `README.adoc`)
- Moho OpenToonz → Rhubarb CLI: uses DAT output (evidence: `README.adoc`)
