# santifer/cv-santiago architecture

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

- Interactive diagram: https://gitdiagram.com/santifer/cv-santiago
- Repository: https://github.com/santifer/cv-santiago

## Overview

santifer.io is an interactive bilingual portfolio centered on demonstrating its AI chatbot. Visitors explore the portfolio and case studies, then can chat by text or voice; the backend retrieves portfolio content when useful, generates responses, and traces activity for a private LLMOps dashboard. Separate product branches provide prompt-injection defenses and automated evaluations, alongside the portfolio’s article and SEO presentation. The README documents these capabilities; source excerpts verify selected request, RAG, voice, and dashboard links, so unsampled relationships are omitted.

Main entry points: [`src/main.tsx`](https://github.com/santifer/cv-santiago/blob/main/src/main.tsx) (Page routing), [`src/useVoiceMode.ts`](https://github.com/santifer/cv-santiago/blob/main/src/useVoiceMode.ts) (Voice mode), [`api/ops/stats.js`](https://github.com/santifer/cv-santiago/blob/main/api/ops/stats.js) (Dashboard API endpoints), [`api/chat.js`](https://github.com/santifer/cv-santiago/blob/main/api/chat.js) (Chat API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portfolio["Portfolio experience"]
  node_router["Page routing<br/>[main.tsx]"]
  node_home["Portfolio home<br/>[App.tsx]"]
end

subgraph group_chat["Chat and retrieval"]
  node_chat_widget["Text chat widget<br/>[FloatingChat.tsx]"]
  node_chat_api["Chat API<br/>[chat.js]"]
  node_prompt["Prompt management<br/>[prompt.js]"]
  node_rag["Hybrid RAG pipeline<br/>[rag.js]"]
  node_supabase[("Supabase content store")]
  node_voice_hook["Voice mode<br/>[useVoiceMode.ts]"]
  node_voice_token["Voice token API<br/>[voice-token.js]"]
  node_voice_service{{"Realtime voice service"}}
  node_voice_rag["Voice RAG search<br/>[rag-search.js]"]
  node_voice_trace["Voice tracing API<br/>[voice-trace.js]"]
end

subgraph group_ops["Operations and evaluation"]
  node_langfuse{{"Langfuse observability"}}
  node_ops_login["Dashboard authentication<br/>[OpsAuth.tsx]"]
  node_ops_dashboard["LLMOps dashboard<br/>[OpsDashboard.tsx]"]
  node_ops_api_hook["Dashboard API client<br/>[useOpsApi.ts]"]
  node_ops_endpoints["Dashboard API endpoints<br/>[stats.js]"]
  node_ops_auth["Operations auth<br/>[ops-auth.js]"]
  node_eval_runner["Automated evaluations<br/>[runner.ts]"]
  node_eval_judge["LLM evaluation judge<br/>[llm-judge.ts]"]
  node_cron_eval["Production trace scoring<br/>[evaluate.js]"]
end

subgraph group_content["Case studies"]
  node_case_studies["Case study pages<br/>[JacoboAgent.tsx]"]
  node_article_registry[("Article registry<br/>[registry.ts]")]
  node_article_components["Article components<br/>[components.tsx]"]
  node_article_seo["Article SEO<br/>[use-article-seo.ts]"]
  node_architecture_diagram["Architecture diagrams"]
end

node_visitor(("Portfolio visitor"))
node_ops_user(("Dashboard operator"))

node_visitor -->|"opens pages"| node_router
node_router -->|"routes home"| node_home
node_router -->|"routes articles"| node_article_registry
node_article_registry -->|"registers pages"| node_case_studies
node_case_studies -->|"renders content"| node_article_components
node_case_studies -->|"sets SEO"| node_article_seo
node_case_studies -->|"renders diagrams"| node_architecture_diagram
node_router -->|"mounts chat"| node_chat_widget
node_visitor -->|"sends messages"| node_chat_widget
node_chat_widget -->|"posts chat"| node_chat_api
node_chat_api -->|"loads prompt"| node_prompt
node_chat_api -->|"retrieves context"| node_rag
node_rag -->|"searches content"| node_supabase
node_visitor -->|"starts voice"| node_voice_hook
node_voice_hook -->|"requests token"| node_voice_token
node_voice_token -->|"issues session token"| node_voice_service
node_voice_hook -->|"opens WebSocket"| node_voice_service
node_voice_hook -->|"requests retrieval"| node_voice_rag
node_voice_rag -->|"uses shared pipeline"| node_rag
node_voice_hook -->|"sends session trace"| node_voice_trace
node_chat_api -->|"records traces"| node_langfuse
node_voice_trace -->|"records voice traces"| node_langfuse
node_ops_user -->|"signs in"| node_ops_login
node_router -->|"routes dashboard"| node_ops_dashboard
node_ops_dashboard -->|"gates access"| node_ops_login
node_ops_dashboard -->|"loads dashboard data"| node_ops_api_hook
node_ops_api_hook -->|"fetches API"| node_ops_endpoints
node_ops_endpoints -->|"validates access"| node_ops_auth
node_ops_endpoints -.->|"reads trace data"| node_langfuse
node_ops_endpoints -.->|"reads RAG stats"| node_supabase
node_eval_runner -->|"judges responses"| node_eval_judge
node_cron_eval -.->|"scores traces"| node_langfuse
node_ops_endpoints -.->|"shows eval results"| node_eval_runner

click node_router "https://github.com/santifer/cv-santiago/blob/main/src/main.tsx"
click node_home "https://github.com/santifer/cv-santiago/blob/main/src/App.tsx"
click node_case_studies "https://github.com/santifer/cv-santiago/blob/main/src/JacoboAgent.tsx"
click node_article_registry "https://github.com/santifer/cv-santiago/blob/main/src/articles/registry.ts"
click node_article_components "https://github.com/santifer/cv-santiago/blob/main/src/articles/components.tsx"
click node_article_seo "https://github.com/santifer/cv-santiago/blob/main/src/articles/use-article-seo.ts"
click node_architecture_diagram "https://github.com/santifer/cv-santiago/blob/main/src/ArchitectureDiagram.tsx"
click node_chat_widget "https://github.com/santifer/cv-santiago/blob/main/src/FloatingChat.tsx"
click node_chat_api "https://github.com/santifer/cv-santiago/blob/main/api/chat.js"
click node_prompt "https://github.com/santifer/cv-santiago/blob/main/api/_shared/prompt.js"
click node_rag "https://github.com/santifer/cv-santiago/blob/main/api/_shared/rag.js"
click node_voice_hook "https://github.com/santifer/cv-santiago/blob/main/src/useVoiceMode.ts"
click node_voice_token "https://github.com/santifer/cv-santiago/blob/main/api/voice-token.js"
click node_voice_rag "https://github.com/santifer/cv-santiago/blob/main/api/rag-search.js"
click node_voice_trace "https://github.com/santifer/cv-santiago/blob/main/api/voice-trace.js"
click node_ops_login "https://github.com/santifer/cv-santiago/blob/main/src/ops/OpsAuth.tsx"
click node_ops_dashboard "https://github.com/santifer/cv-santiago/blob/main/src/ops/OpsDashboard.tsx"
click node_ops_api_hook "https://github.com/santifer/cv-santiago/blob/main/src/ops/hooks/useOpsApi.ts"
click node_ops_endpoints "https://github.com/santifer/cv-santiago/blob/main/api/ops/stats.js"
click node_ops_auth "https://github.com/santifer/cv-santiago/blob/main/api/_shared/ops-auth.js"
click node_eval_runner "https://github.com/santifer/cv-santiago/blob/main/evals/runner.ts"
click node_eval_judge "https://github.com/santifer/cv-santiago/blob/main/evals/llm-judge.ts"
click node_cron_eval "https://github.com/santifer/cv-santiago/blob/main/api/cron/evaluate.js"

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_router,node_home toneBlue
class node_chat_widget,node_chat_api,node_prompt,node_rag,node_supabase,node_voice_hook,node_voice_token,node_voice_service,node_voice_rag,node_voice_trace toneAmber
class node_langfuse,node_ops_login,node_ops_dashboard,node_ops_api_hook,node_ops_endpoints,node_ops_auth,node_eval_runner,node_eval_judge,node_cron_eval toneMint
class node_case_studies,node_article_registry,node_article_components,node_article_seo,node_architecture_diagram toneRose
class node_visitor,node_ops_user toneIndigo
```

## Components

### Portfolio experience

- [Page routing](https://github.com/santifer/cv-santiago/blob/main/src/main.tsx): `src/main.tsx`
- [Portfolio home](https://github.com/santifer/cv-santiago/blob/main/src/App.tsx): `src/App.tsx`

### Chat and retrieval

- [Text chat widget](https://github.com/santifer/cv-santiago/blob/main/src/FloatingChat.tsx): `src/FloatingChat.tsx`
- [Chat API](https://github.com/santifer/cv-santiago/blob/main/api/chat.js): `api/chat.js`
- [Prompt management](https://github.com/santifer/cv-santiago/blob/main/api/_shared/prompt.js): `api/_shared/prompt.js`
- [Hybrid RAG pipeline](https://github.com/santifer/cv-santiago/blob/main/api/_shared/rag.js): `api/_shared/rag.js`
- **Supabase content store**
- [Voice mode](https://github.com/santifer/cv-santiago/blob/main/src/useVoiceMode.ts): `src/useVoiceMode.ts`
- [Voice token API](https://github.com/santifer/cv-santiago/blob/main/api/voice-token.js): `api/voice-token.js`
- **Realtime voice service**
- [Voice RAG search](https://github.com/santifer/cv-santiago/blob/main/api/rag-search.js): `api/rag-search.js`
- [Voice tracing API](https://github.com/santifer/cv-santiago/blob/main/api/voice-trace.js): `api/voice-trace.js`

### Operations and evaluation

- **Langfuse observability**
- [Dashboard authentication](https://github.com/santifer/cv-santiago/blob/main/src/ops/OpsAuth.tsx): `src/ops/OpsAuth.tsx`
- [LLMOps dashboard](https://github.com/santifer/cv-santiago/blob/main/src/ops/OpsDashboard.tsx): `src/ops/OpsDashboard.tsx`
- [Dashboard API client](https://github.com/santifer/cv-santiago/blob/main/src/ops/hooks/useOpsApi.ts): `src/ops/hooks/useOpsApi.ts`
- [Dashboard API endpoints](https://github.com/santifer/cv-santiago/blob/main/api/ops/stats.js): `api/ops/stats.js`
- [Operations auth](https://github.com/santifer/cv-santiago/blob/main/api/_shared/ops-auth.js): `api/_shared/ops-auth.js`
- [Automated evaluations](https://github.com/santifer/cv-santiago/blob/main/evals/runner.ts): `evals/runner.ts`
- [LLM evaluation judge](https://github.com/santifer/cv-santiago/blob/main/evals/llm-judge.ts): `evals/llm-judge.ts`
- [Production trace scoring](https://github.com/santifer/cv-santiago/blob/main/api/cron/evaluate.js): `api/cron/evaluate.js`

### Case studies

- [Case study pages](https://github.com/santifer/cv-santiago/blob/main/src/JacoboAgent.tsx): `src/JacoboAgent.tsx`
- [Article registry](https://github.com/santifer/cv-santiago/blob/main/src/articles/registry.ts): `src/articles/registry.ts`
- [Article components](https://github.com/santifer/cv-santiago/blob/main/src/articles/components.tsx): `src/articles/components.tsx`
- [Article SEO](https://github.com/santifer/cv-santiago/blob/main/src/articles/use-article-seo.ts): `src/articles/use-article-seo.ts`
- [Architecture diagrams](https://github.com/santifer/cv-santiago/blob/main/src/ArchitectureDiagram.tsx): `src/ArchitectureDiagram.tsx`

### Other components

- **Portfolio visitor**
- **Dashboard operator**

## Connections

- Portfolio visitor → Page routing: opens pages (evidence: `src/main.tsx`)
- Page routing → Portfolio home: routes home (evidence: `src/main.tsx`)
- Page routing → Article registry: routes articles (evidence: `src/main.tsx`)
- Article registry → Case study pages: registers pages (evidence: `src/articles/registry.ts`)
- Case study pages → Article components: renders content (evidence: `src/JacoboAgent.tsx`)
- Case study pages → Article SEO: sets SEO (evidence: `src/JacoboAgent.tsx`)
- Case study pages → Architecture diagrams: renders diagrams
- Page routing → Text chat widget: mounts chat (evidence: `src/main.tsx`)
- Portfolio visitor → Text chat widget: sends messages (evidence: `README.md`)
- Text chat widget → Chat API: posts chat (evidence: `README.md`)
- Chat API → Prompt management: loads prompt (evidence: `api/chat.js`)
- Chat API → Hybrid RAG pipeline: retrieves context (evidence: `api/chat.js`)
- Hybrid RAG pipeline → Supabase content store: searches content (evidence: `README.md`)
- Portfolio visitor → Voice mode: starts voice (evidence: `README.md`)
- Voice mode → Voice token API: requests token (evidence: `src/useVoiceMode.ts`)
- Voice token API → Realtime voice service: issues session token (evidence: `README.md`)
- Voice mode → Realtime voice service: opens WebSocket (evidence: `README.md`)
- Voice mode → Voice RAG search: requests retrieval (evidence: `README.md`)
- Voice RAG search → Hybrid RAG pipeline: uses shared pipeline (evidence: `api/rag-search.js`)
- Voice mode → Voice tracing API: sends session trace (evidence: `src/useVoiceMode.ts`)
- Chat API → Langfuse observability: records traces (evidence: `README.md`)
- Voice tracing API → Langfuse observability: records voice traces (evidence: `README.md`)
- Dashboard operator → Dashboard authentication: signs in (evidence: `README.md`)
- Page routing → LLMOps dashboard: routes dashboard (evidence: `src/main.tsx`)
- LLMOps dashboard → Dashboard authentication: gates access (evidence: `src/ops/OpsDashboard.tsx`)
- LLMOps dashboard → Dashboard API client: loads dashboard data (evidence: `src/ops/OpsDashboard.tsx`)
- Dashboard API client → Dashboard API endpoints: fetches API (evidence: `src/ops/hooks/useOpsApi.ts`)
- Dashboard API endpoints → Operations auth: validates access
- Dashboard API endpoints → Langfuse observability: reads trace data (evidence: `README.md`)
- Dashboard API endpoints → Supabase content store: reads RAG stats (evidence: `README.md`)
- Automated evaluations → LLM evaluation judge: judges responses (evidence: `evals/runner.ts`)
- Production trace scoring → Langfuse observability: scores traces (evidence: `README.md`)
- Dashboard API endpoints → Automated evaluations: shows eval results (evidence: `README.md`)
