# hoed/gajahmada architecture

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

- Interactive diagram: https://gitdiagram.com/hoed/gajahmada
- Repository: https://github.com/hoed/gajahmada

## Overview

Gajahmada is a sovereign AI system presented through a React dashboard. Users enter the dashboard to chat with the system or provide knowledge through training, files, web/Wikipedia crawling, and RSS; the shared context coordinates knowledge aggregation and retrieval around the AI brain. RAG, multilingual support, image generation, and Web3/DeFi are additional documented or surfaced capabilities. The graph combines excerpted imports and calls with README-documented capabilities; several UI-to-service and optional integration links are therefore marked unverified rather than asserted as observed calls.

Main entry points: [`src/pages/Index.tsx`](https://github.com/hoed/gajahmada/blob/main/src/pages/Index.tsx) (Dashboard Page), [`src/contexts/GajahmadaContext.tsx`](https://github.com/hoed/gajahmada/blob/main/src/contexts/GajahmadaContext.tsx) (System Context), [`src/pages/Documentation.tsx`](https://github.com/hoed/gajahmada/blob/main/src/pages/Documentation.tsx) (Documentation Page), [`src/components/Web3ServerArchitecture.tsx`](https://github.com/hoed/gajahmada/blob/main/src/components/Web3ServerArchitecture.tsx) (Web3 Architecture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_app["React App<br/>[App.tsx]"]
  node_dashboard["Dashboard Page<br/>[Index.tsx]"]
  node_docs["Documentation Page<br/>[Documentation.tsx]"]
  node_dashboardui["Dashboard Interface"]
  node_chat["Chat Interface<br/>[ChatInterface.tsx]"]
end

subgraph group_ai["AI and Knowledge"]
  node_context["System Context"]
  node_brain["AI Brain<br/>[gajahmada-brain.ts]"]
  node_rag["RAG Search<br/>[rag.ts]"]
  node_aggregator["Knowledge Aggregation"]
  node_retriever["Autonomous Retrieval"]
  node_trainer["Knowledge Training"]
  node_trainingui["Training Tools"]
  node_uploadui["File Training"]
  node_crawlerui["Crawler Interface"]
  node_crawler["Web Crawler<br/>[web-crawler.ts]"]
  node_wikiui["Wikipedia Interface"]
  node_wikiscraper["Wikipedia Scraper"]
  node_rssui["RSS Ingestion"]
  node_rssdiscover["RSS Discovery"]
end

subgraph group_data["Persistence and Integrations"]
  node_databaseadapter["Database Adapter"]
  node_dbconfig["Database Configuration<br/>[database.config.ts]"]
  node_supabaseclient["Supabase Client<br/>[client.ts]"]
  node_datastore[("Configured Database")]
  node_supabase[("Supabase Service")]
end

subgraph group_capabilities["Extended Capabilities"]
  node_multilingual["Multilingual Engine"]
  node_imagegen["Image Generation<br/>[index.ts]"]
  node_searchfn["Search Function<br/>[index.ts]"]
  node_blockchainfn["Blockchain Node Manager<br/>[index.ts]"]
  node_web3architecture["Web3 Architecture"]
  node_contractui["Smart Contracts"]
  node_swapui["Token Swap"]
  node_historyui["Transaction History"]
  node_portfolio["Portfolio Dashboard"]
end

node_user(("User"))

node_user -->|"opens"| node_app
node_app -->|"provides state"| node_context
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_docs
node_dashboard -->|"renders"| node_dashboardui
node_dashboard -->|"renders"| node_trainingui
node_dashboard -->|"renders"| node_uploadui
node_dashboard -->|"renders"| node_crawlerui
node_dashboard -->|"renders"| node_wikiui
node_dashboard -->|"renders"| node_rssui
node_dashboard -->|"renders"| node_web3architecture
node_dashboardui -->|"renders"| node_chat
node_context -->|"uses"| node_brain
node_context -->|"uses"| node_rag
node_context -->|"initializes"| node_aggregator
node_context -->|"initializes"| node_retriever
node_retriever -->|"uses"| node_trainer
node_context -->|"persists state"| node_datastore
node_trainingui -.->|"uses state"| node_context
node_uploadui -->|"uses state"| node_context
node_uploadui -.->|"submits knowledge"| node_trainer
node_crawlerui -.->|"uses"| node_crawler
node_wikiui -.->|"uses"| node_wikiscraper
node_rssui -->|"uses state"| node_context
node_context -->|"uses"| node_supabaseclient
node_databaseadapter -->|"reads config"| node_dbconfig
node_databaseadapter -->|"uses"| node_supabaseclient
node_databaseadapter -.->|"reads and writes"| node_datastore
node_supabaseclient -->|"connects optionally"| node_supabase
node_context -.->|"supports languages"| node_multilingual
node_dashboard -.->|"offers discovery"| node_rssdiscover
node_dashboard -.->|"offers generation"| node_imagegen
node_dashboard -.->|"offers search"| node_searchfn
node_dashboard -.->|"offers node management"| node_blockchainfn
node_docs -->|"documents"| node_multilingual
node_docs -->|"documents"| node_contractui
node_docs -->|"documents"| node_historyui
node_docs -->|"documents"| node_portfolio
node_docs -->|"documents"| node_swapui
node_web3architecture -.->|"presents"| node_contractui
node_web3architecture -.->|"presents"| node_swapui
node_web3architecture -.->|"presents"| node_historyui
node_web3architecture -.->|"presents"| node_portfolio

click node_app "https://github.com/hoed/gajahmada/blob/main/src/App.tsx"
click node_dashboard "https://github.com/hoed/gajahmada/blob/main/src/pages/Index.tsx"
click node_docs "https://github.com/hoed/gajahmada/blob/main/src/pages/Documentation.tsx"
click node_dashboardui "https://github.com/hoed/gajahmada/blob/main/src/components/DashboardSection.tsx"
click node_chat "https://github.com/hoed/gajahmada/blob/main/src/components/ChatInterface.tsx"
click node_context "https://github.com/hoed/gajahmada/blob/main/src/contexts/GajahmadaContext.tsx"
click node_brain "https://github.com/hoed/gajahmada/blob/main/src/lib/gajahmada-brain.ts"
click node_rag "https://github.com/hoed/gajahmada/blob/main/src/lib/rag.ts"
click node_aggregator "https://github.com/hoed/gajahmada/blob/main/src/lib/knowledge-aggregator.ts"
click node_retriever "https://github.com/hoed/gajahmada/blob/main/src/lib/autonomous-retriever.ts"
click node_trainer "https://github.com/hoed/gajahmada/blob/main/src/lib/knowledge-trainer.ts"
click node_trainingui "https://github.com/hoed/gajahmada/blob/main/src/components/KnowledgeTrainer.tsx"
click node_uploadui "https://github.com/hoed/gajahmada/blob/main/src/components/FileUploadTrainer.tsx"
click node_crawlerui "https://github.com/hoed/gajahmada/blob/main/src/components/WebCrawlerInterface.tsx"
click node_crawler "https://github.com/hoed/gajahmada/blob/main/src/lib/web-crawler.ts"
click node_wikiui "https://github.com/hoed/gajahmada/blob/main/src/components/WikipediaInterface.tsx"
click node_wikiscraper "https://github.com/hoed/gajahmada/blob/main/src/lib/wikipedia-scraper.ts"
click node_rssui "https://github.com/hoed/gajahmada/blob/main/src/components/RSSFeedIngestion.tsx"
click node_rssdiscover "https://github.com/hoed/gajahmada/blob/main/src/components/RSSDiscoveryManager.tsx"
click node_databaseadapter "https://github.com/hoed/gajahmada/blob/main/src/lib/database-adapter.ts"
click node_dbconfig "https://github.com/hoed/gajahmada/blob/main/src/config/database.config.ts"
click node_supabaseclient "https://github.com/hoed/gajahmada/blob/main/src/integrations/supabase/client.ts"
click node_multilingual "https://github.com/hoed/gajahmada/blob/main/src/lib/multilingual-engine.ts"
click node_imagegen "https://github.com/hoed/gajahmada/blob/main/supabase/functions/image-generation/index.ts"
click node_searchfn "https://github.com/hoed/gajahmada/blob/main/supabase/functions/gajahmada-search/index.ts"
click node_blockchainfn "https://github.com/hoed/gajahmada/blob/main/supabase/functions/blockchain-node-manager/index.ts"
click node_web3architecture "https://github.com/hoed/gajahmada/blob/main/src/components/Web3ServerArchitecture.tsx"
click node_contractui "https://github.com/hoed/gajahmada/blob/main/src/components/SmartContractInteraction.tsx"
click node_swapui "https://github.com/hoed/gajahmada/blob/main/src/components/TokenSwapInterface.tsx"
click node_historyui "https://github.com/hoed/gajahmada/blob/main/src/components/TransactionHistory.tsx"
click node_portfolio "https://github.com/hoed/gajahmada/blob/main/src/components/PortfolioDashboard.tsx"

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_app,node_dashboard,node_docs,node_dashboardui,node_chat,node_user toneBlue
class node_context,node_brain,node_rag,node_aggregator,node_retriever,node_trainer,node_trainingui,node_uploadui,node_crawlerui,node_crawler,node_wikiui,node_wikiscraper,node_rssui,node_rssdiscover toneAmber
class node_databaseadapter,node_dbconfig,node_supabaseclient,node_datastore,node_supabase toneMint
class node_multilingual,node_imagegen,node_searchfn,node_blockchainfn,node_web3architecture,node_contractui,node_swapui,node_historyui,node_portfolio toneRose
```

## Components

### Application UI

- [React App](https://github.com/hoed/gajahmada/blob/main/src/App.tsx): `src/App.tsx`
- [Dashboard Page](https://github.com/hoed/gajahmada/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Documentation Page](https://github.com/hoed/gajahmada/blob/main/src/pages/Documentation.tsx): `src/pages/Documentation.tsx`
- [Dashboard Interface](https://github.com/hoed/gajahmada/blob/main/src/components/DashboardSection.tsx): `src/components/DashboardSection.tsx`
- [Chat Interface](https://github.com/hoed/gajahmada/blob/main/src/components/ChatInterface.tsx): `src/components/ChatInterface.tsx`

### AI and Knowledge

- [System Context](https://github.com/hoed/gajahmada/blob/main/src/contexts/GajahmadaContext.tsx): `src/contexts/GajahmadaContext.tsx`
- [AI Brain](https://github.com/hoed/gajahmada/blob/main/src/lib/gajahmada-brain.ts): `src/lib/gajahmada-brain.ts`
- [RAG Search](https://github.com/hoed/gajahmada/blob/main/src/lib/rag.ts): `src/lib/rag.ts`
- [Knowledge Aggregation](https://github.com/hoed/gajahmada/blob/main/src/lib/knowledge-aggregator.ts): `src/lib/knowledge-aggregator.ts`
- [Autonomous Retrieval](https://github.com/hoed/gajahmada/blob/main/src/lib/autonomous-retriever.ts): `src/lib/autonomous-retriever.ts`
- [Knowledge Training](https://github.com/hoed/gajahmada/blob/main/src/lib/knowledge-trainer.ts): `src/lib/knowledge-trainer.ts`
- [Training Tools](https://github.com/hoed/gajahmada/blob/main/src/components/KnowledgeTrainer.tsx): `src/components/KnowledgeTrainer.tsx`
- [File Training](https://github.com/hoed/gajahmada/blob/main/src/components/FileUploadTrainer.tsx): `src/components/FileUploadTrainer.tsx`
- [Crawler Interface](https://github.com/hoed/gajahmada/blob/main/src/components/WebCrawlerInterface.tsx): `src/components/WebCrawlerInterface.tsx`
- [Web Crawler](https://github.com/hoed/gajahmada/blob/main/src/lib/web-crawler.ts): `src/lib/web-crawler.ts`
- [Wikipedia Interface](https://github.com/hoed/gajahmada/blob/main/src/components/WikipediaInterface.tsx): `src/components/WikipediaInterface.tsx`
- [Wikipedia Scraper](https://github.com/hoed/gajahmada/blob/main/src/lib/wikipedia-scraper.ts): `src/lib/wikipedia-scraper.ts`
- [RSS Ingestion](https://github.com/hoed/gajahmada/blob/main/src/components/RSSFeedIngestion.tsx): `src/components/RSSFeedIngestion.tsx`
- [RSS Discovery](https://github.com/hoed/gajahmada/blob/main/src/components/RSSDiscoveryManager.tsx): `src/components/RSSDiscoveryManager.tsx`

### Persistence and Integrations

- [Database Adapter](https://github.com/hoed/gajahmada/blob/main/src/lib/database-adapter.ts): `src/lib/database-adapter.ts`
- [Database Configuration](https://github.com/hoed/gajahmada/blob/main/src/config/database.config.ts): `src/config/database.config.ts`
- [Supabase Client](https://github.com/hoed/gajahmada/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Configured Database**
- **Supabase Service**

### Extended Capabilities

- [Multilingual Engine](https://github.com/hoed/gajahmada/blob/main/src/lib/multilingual-engine.ts): `src/lib/multilingual-engine.ts`
- [Image Generation](https://github.com/hoed/gajahmada/blob/main/supabase/functions/image-generation/index.ts): `supabase/functions/image-generation/index.ts`
- [Search Function](https://github.com/hoed/gajahmada/blob/main/supabase/functions/gajahmada-search/index.ts): `supabase/functions/gajahmada-search/index.ts`
- [Blockchain Node Manager](https://github.com/hoed/gajahmada/blob/main/supabase/functions/blockchain-node-manager/index.ts): `supabase/functions/blockchain-node-manager/index.ts`
- [Web3 Architecture](https://github.com/hoed/gajahmada/blob/main/src/components/Web3ServerArchitecture.tsx): `src/components/Web3ServerArchitecture.tsx`
- [Smart Contracts](https://github.com/hoed/gajahmada/blob/main/src/components/SmartContractInteraction.tsx): `src/components/SmartContractInteraction.tsx`
- [Token Swap](https://github.com/hoed/gajahmada/blob/main/src/components/TokenSwapInterface.tsx): `src/components/TokenSwapInterface.tsx`
- [Transaction History](https://github.com/hoed/gajahmada/blob/main/src/components/TransactionHistory.tsx): `src/components/TransactionHistory.tsx`
- [Portfolio Dashboard](https://github.com/hoed/gajahmada/blob/main/src/components/PortfolioDashboard.tsx): `src/components/PortfolioDashboard.tsx`

### Other components

- **User**

## Connections

- User → React App: opens (evidence: `src/App.tsx`)
- React App → System Context: provides state (evidence: `src/App.tsx`)
- React App → Dashboard Page: routes to (evidence: `src/App.tsx`)
- React App → Documentation Page: routes to (evidence: `src/App.tsx`)
- Dashboard Page → Dashboard Interface: renders (evidence: `src/pages/Index.tsx`)
- Dashboard Page → Training Tools: renders (evidence: `src/pages/Index.tsx`)
- Dashboard Page → File Training: renders (evidence: `src/pages/Index.tsx`)
- Dashboard Page → Crawler Interface: renders (evidence: `src/pages/Index.tsx`)
- Dashboard Page → Wikipedia Interface: renders (evidence: `src/pages/Index.tsx`)
- Dashboard Page → RSS Ingestion: renders (evidence: `src/pages/Index.tsx`)
- Dashboard Page → Web3 Architecture: renders (evidence: `src/pages/Index.tsx`)
- Dashboard Interface → Chat Interface: renders (evidence: `src/components/DashboardSection.tsx`)
- System Context → AI Brain: uses (evidence: `src/contexts/GajahmadaContext.tsx`)
- System Context → RAG Search: uses (evidence: `src/contexts/GajahmadaContext.tsx`)
- System Context → Knowledge Aggregation: initializes (evidence: `src/contexts/GajahmadaContext.tsx`)
- System Context → Autonomous Retrieval: initializes (evidence: `src/contexts/GajahmadaContext.tsx`)
- Autonomous Retrieval → Knowledge Training: uses (evidence: `src/lib/autonomous-retriever.ts`)
- System Context → Configured Database: persists state (evidence: `src/contexts/GajahmadaContext.tsx`)
- Training Tools → System Context: uses state
- File Training → System Context: uses state (evidence: `src/components/FileUploadTrainer.tsx`)
- File Training → Knowledge Training: submits knowledge
- Crawler Interface → Web Crawler: uses
- Wikipedia Interface → Wikipedia Scraper: uses
- RSS Ingestion → System Context: uses state (evidence: `src/components/RSSFeedIngestion.tsx`)
- System Context → Supabase Client: uses (evidence: `src/contexts/GajahmadaContext.tsx`)
- Database Adapter → Database Configuration: reads config (evidence: `src/lib/database-adapter.ts`)
- Database Adapter → Supabase Client: uses (evidence: `src/lib/database-adapter.ts`)
- Database Adapter → Configured Database: reads and writes
- Supabase Client → Supabase Service: connects optionally (evidence: `src/integrations/supabase/client.ts`)
- System Context → Multilingual Engine: supports languages
- Dashboard Page → RSS Discovery: offers discovery
- Dashboard Page → Image Generation: offers generation
- Dashboard Page → Search Function: offers search
- Dashboard Page → Blockchain Node Manager: offers node management
- Documentation Page → Multilingual Engine: documents (evidence: `src/pages/Documentation.tsx`)
- Documentation Page → Smart Contracts: documents (evidence: `src/pages/Documentation.tsx`)
- Documentation Page → Transaction History: documents (evidence: `src/pages/Documentation.tsx`)
- Documentation Page → Portfolio Dashboard: documents (evidence: `src/pages/Documentation.tsx`)
- Documentation Page → Token Swap: documents (evidence: `src/pages/Documentation.tsx`)
- Web3 Architecture → Smart Contracts: presents
- Web3 Architecture → Token Swap: presents
- Web3 Architecture → Transaction History: presents
- Web3 Architecture → Portfolio Dashboard: presents
