# the0wl/chat-gratuito architecture

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

- Interactive diagram: https://gitdiagram.com/the0wl/chat-gratuito
- Repository: https://github.com/the0wl/chat-gratuito

## Overview

Chat IA is a browser-based chat client for Gemini, Groq, and Claude. A user enters a message; ChatInterface checks the selected provider’s saved API key, updates conversation state, dispatches the conversation to that provider, and displays the returned text. Settings manage API keys in local storage, while App manages the persisted theme. The excerpts establish the main render, callback, and request flows; no README content was provided, so unsampled capabilities are not inferred.

Main entry points: [`src/components/ChatInterface.tsx`](https://github.com/the0wl/chat-gratuito/blob/main/src/components/ChatInterface.tsx) (Chat Orchestrator), [`src/App.tsx`](https://github.com/the0wl/chat-gratuito/blob/main/src/App.tsx) (App Theme), [`src/services/gemini.ts`](https://github.com/the0wl/chat-gratuito/blob/main/src/services/gemini.ts) (Gemini Client), [`src/services/groq.ts`](https://github.com/the0wl/chat-gratuito/blob/main/src/services/groq.ts) (Groq Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_entry["React Entry<br/>[main.tsx]"]
  node_app_component["App Theme<br/>[App.tsx]"]
  node_message_types["Chat Data Types<br/>[types.ts]"]
end

subgraph group_chat["Conversation UI"]
  node_chat_interface["Chat Orchestrator<br/>[ChatInterface.tsx]"]
  node_message_input["Message Input<br/>[MessageInput.tsx]"]
  node_message_list["Message List<br/>[MessageList.tsx]"]
  node_message_bubble["Message Rendering<br/>[MessageBubble.tsx]"]
end

subgraph group_settings["Controls and Settings"]
  node_model_selector["Model Selector<br/>[ModelSelector.tsx]"]
  node_settings_modal["API Key Settings<br/>[SettingsModal.tsx]"]
  node_theme_toggle["Theme Toggle<br/>[ThemeToggle.tsx]"]
end

subgraph group_providers["Model Providers"]
  node_gemini_service["Gemini Client<br/>[gemini.ts]"]
  node_groq_service["Groq Client<br/>[groq.ts]"]
  node_claude_service["Claude Client<br/>[claude.ts]"]
end

node_user(("User"))
node_browser_storage[("Browser Local Storage")]
node_gemini_api{{"Gemini API"}}
node_groq_api{{"Groq API"}}
node_claude_api{{"Anthropic API"}}

node_user -->|"enters message"| node_message_input
node_entry -->|"renders"| node_app_component
node_app_component -->|"renders"| node_chat_interface
node_app_component -->|"reads and writes theme"| node_browser_storage
node_chat_interface -->|"renders"| node_message_input
node_chat_interface -->|"renders"| node_message_list
node_message_list -->|"renders"| node_message_bubble
node_chat_interface -->|"renders"| node_model_selector
node_chat_interface -->|"renders"| node_settings_modal
node_chat_interface -->|"renders"| node_theme_toggle
node_message_input -->|"submits text"| node_chat_interface
node_model_selector -->|"changes model"| node_chat_interface
node_settings_modal -->|"saves keys"| node_chat_interface
node_theme_toggle -->|"toggles theme"| node_app_component
node_chat_interface -->|"reads and writes keys"| node_browser_storage
node_chat_interface -->|"dispatches request"| node_gemini_service
node_chat_interface -->|"dispatches request"| node_groq_service
node_chat_interface -->|"dispatches request"| node_claude_service
node_gemini_service -->|"sends request"| node_gemini_api
node_groq_service -->|"sends request"| node_groq_api
node_claude_service -->|"sends request"| node_claude_api
node_gemini_service -->|"returns reply"| node_chat_interface
node_groq_service -->|"returns reply"| node_chat_interface
node_claude_service -->|"returns reply"| node_chat_interface

click node_entry "https://github.com/the0wl/chat-gratuito/blob/main/src/main.tsx"
click node_app_component "https://github.com/the0wl/chat-gratuito/blob/main/src/App.tsx"
click node_chat_interface "https://github.com/the0wl/chat-gratuito/blob/main/src/components/ChatInterface.tsx"
click node_message_input "https://github.com/the0wl/chat-gratuito/blob/main/src/components/MessageInput.tsx"
click node_message_list "https://github.com/the0wl/chat-gratuito/blob/main/src/components/MessageList.tsx"
click node_message_bubble "https://github.com/the0wl/chat-gratuito/blob/main/src/components/MessageBubble.tsx"
click node_model_selector "https://github.com/the0wl/chat-gratuito/blob/main/src/components/ModelSelector.tsx"
click node_settings_modal "https://github.com/the0wl/chat-gratuito/blob/main/src/components/SettingsModal.tsx"
click node_theme_toggle "https://github.com/the0wl/chat-gratuito/blob/main/src/components/ThemeToggle.tsx"
click node_message_types "https://github.com/the0wl/chat-gratuito/blob/main/src/types.ts"
click node_gemini_service "https://github.com/the0wl/chat-gratuito/blob/main/src/services/gemini.ts"
click node_groq_service "https://github.com/the0wl/chat-gratuito/blob/main/src/services/groq.ts"
click node_claude_service "https://github.com/the0wl/chat-gratuito/blob/main/src/services/claude.ts"

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_entry,node_app_component,node_message_types,node_user toneBlue
class node_chat_interface,node_message_input,node_message_list,node_message_bubble,node_browser_storage toneAmber
class node_model_selector,node_settings_modal,node_theme_toggle,node_gemini_api,node_groq_api,node_claude_api toneMint
class node_gemini_service,node_groq_service,node_claude_service toneRose
```

## Components

### Application Shell

- [React Entry](https://github.com/the0wl/chat-gratuito/blob/main/src/main.tsx): `src/main.tsx`
- [App Theme](https://github.com/the0wl/chat-gratuito/blob/main/src/App.tsx): `src/App.tsx`
- [Chat Data Types](https://github.com/the0wl/chat-gratuito/blob/main/src/types.ts): `src/types.ts`

### Conversation UI

- [Chat Orchestrator](https://github.com/the0wl/chat-gratuito/blob/main/src/components/ChatInterface.tsx): `src/components/ChatInterface.tsx`
- [Message Input](https://github.com/the0wl/chat-gratuito/blob/main/src/components/MessageInput.tsx): `src/components/MessageInput.tsx`
- [Message List](https://github.com/the0wl/chat-gratuito/blob/main/src/components/MessageList.tsx): `src/components/MessageList.tsx`
- [Message Rendering](https://github.com/the0wl/chat-gratuito/blob/main/src/components/MessageBubble.tsx): `src/components/MessageBubble.tsx`

### Controls and Settings

- [Model Selector](https://github.com/the0wl/chat-gratuito/blob/main/src/components/ModelSelector.tsx): `src/components/ModelSelector.tsx`
- [API Key Settings](https://github.com/the0wl/chat-gratuito/blob/main/src/components/SettingsModal.tsx): `src/components/SettingsModal.tsx`
- [Theme Toggle](https://github.com/the0wl/chat-gratuito/blob/main/src/components/ThemeToggle.tsx): `src/components/ThemeToggle.tsx`

### Model Providers

- [Gemini Client](https://github.com/the0wl/chat-gratuito/blob/main/src/services/gemini.ts): `src/services/gemini.ts`
- [Groq Client](https://github.com/the0wl/chat-gratuito/blob/main/src/services/groq.ts): `src/services/groq.ts`
- [Claude Client](https://github.com/the0wl/chat-gratuito/blob/main/src/services/claude.ts): `src/services/claude.ts`

### Other components

- **User**
- **Browser Local Storage**
- **Gemini API**
- **Groq API**
- **Anthropic API**

## Connections

- User → Message Input: enters message (evidence: `src/components/MessageInput.tsx`)
- React Entry → App Theme: renders (evidence: `src/main.tsx`)
- App Theme → Chat Orchestrator: renders (evidence: `src/App.tsx`)
- App Theme → Browser Local Storage: reads and writes theme (evidence: `src/App.tsx`)
- Chat Orchestrator → Message Input: renders (evidence: `src/components/ChatInterface.tsx`)
- Chat Orchestrator → Message List: renders (evidence: `src/components/ChatInterface.tsx`)
- Message List → Message Rendering: renders (evidence: `src/components/MessageList.tsx`)
- Chat Orchestrator → Model Selector: renders (evidence: `src/components/ChatInterface.tsx`)
- Chat Orchestrator → API Key Settings: renders (evidence: `src/components/ChatInterface.tsx`)
- Chat Orchestrator → Theme Toggle: renders (evidence: `src/components/ChatInterface.tsx`)
- Message Input → Chat Orchestrator: submits text (evidence: `src/components/MessageInput.tsx`)
- Model Selector → Chat Orchestrator: changes model (evidence: `src/components/ChatInterface.tsx`)
- API Key Settings → Chat Orchestrator: saves keys (evidence: `src/components/ChatInterface.tsx`)
- Theme Toggle → App Theme: toggles theme (evidence: `src/App.tsx`)
- Chat Orchestrator → Browser Local Storage: reads and writes keys (evidence: `src/components/ChatInterface.tsx`)
- Chat Orchestrator → Gemini Client: dispatches request (evidence: `src/components/ChatInterface.tsx`)
- Chat Orchestrator → Groq Client: dispatches request (evidence: `src/components/ChatInterface.tsx`)
- Chat Orchestrator → Claude Client: dispatches request (evidence: `src/components/ChatInterface.tsx`)
- Gemini Client → Gemini API: sends request (evidence: `src/services/gemini.ts`)
- Groq Client → Groq API: sends request (evidence: `src/services/groq.ts`)
- Claude Client → Anthropic API: sends request (evidence: `src/services/claude.ts`)
- Gemini Client → Chat Orchestrator: returns reply (evidence: `src/components/ChatInterface.tsx`)
- Groq Client → Chat Orchestrator: returns reply (evidence: `src/components/ChatInterface.tsx`)
- Claude Client → Chat Orchestrator: returns reply (evidence: `src/components/ChatInterface.tsx`)
