# mohamedyaakoubi/potential architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedyaakoubi/potential
- Repository: https://github.com/mohamedyaakoubi/potential

## Overview

Potential is a Next.js Abu Dhabi open-data discovery interface with an AI chat assistant, dataset listing, and CSV/XLSX visualization. The main flow runs from the home page through search/chat state into dataset results; chat can also call a GPT endpoint and accept document images. API route files are present, but their implementations were not sampled, so their behavior and connections are left unspecified. Edges reflect shown calls or page wiring; optional/unverified links are omitted.

Main entry points: [`components/potential-section-with-chat.tsx`](https://github.com/mohamedyaakoubi/potential/blob/main/components/potential-section-with-chat.tsx) (Chat assistant), [`app/page.tsx`](https://github.com/mohamedyaakoubi/potential/blob/main/app/page.tsx) (Home state), [`components/hero-section.tsx`](https://github.com/mohamedyaakoubi/potential/blob/main/components/hero-section.tsx) (Search hero), [`components/ui/button.tsx`](https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/button.tsx) (Button control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_home["Home state<br/>[page.tsx]"]
  node_hero["Search hero<br/>[hero-section.tsx]"]
  node_footer["Site footer<br/>[footer.tsx]"]
end

subgraph group_discovery["Dataset discovery"]
  node_results["Dataset results<br/>[search-results.tsx]"]
  node_dataset_api["Dataset API route<br/>[route.ts]"]
  node_search_api["Search API route<br/>[route.ts]"]
  node_download_api["Download proxy route<br/>[route.ts]"]
end

subgraph group_assistant["AI assistant"]
  node_chat["Chat assistant"]
  node_chat_api["GPT endpoint<br/>[route.ts]"]
  node_chat_history["Chat history<br/>[chatHistory.ts]"]
  node_document_api["Document API route<br/>[route.ts]"]
end

subgraph group_shared["Shared runtime"]
  node_button["Button control<br/>[button.tsx]"]
  node_card["Card layout<br/>[card.tsx]"]
  node_input["Input control<br/>[input.tsx]"]
  node_scroll["Scroll area<br/>[scroll-area.tsx]"]
  node_class_utils["Class utilities<br/>[utils.ts]"]
end

node_visitor(("Visitor"))
node_gpt_service["GPT service"]
node_firebase_storage[("Firebase Storage")]
node_form_recognizer["Form Recognizer"]
node_open_data["Abu Dhabi catalog"]

node_visitor -->|"opens"| node_home
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_chat
node_home -->|"renders"| node_results
node_home -->|"renders"| node_footer
node_hero -->|"submits query"| node_home
node_chat -->|"sends datasets"| node_home
node_results -->|"fetches metadata"| node_open_data
node_chat -->|"posts messages"| node_chat_api
node_chat_api -->|"reads and saves"| node_chat_history
node_chat_api -->|"sends prompt"| node_gpt_service
node_chat -->|"uploads images"| node_firebase_storage
node_chat -->|"processes document"| node_form_recognizer
node_chat -->|"uses controls"| node_button
node_chat -->|"uses layout"| node_card
node_chat -->|"uses input"| node_input
node_chat -->|"uses scrolling"| node_scroll
node_hero -->|"uses control"| node_button
node_hero -->|"uses input"| node_input
node_footer -->|"uses control"| node_button
node_button -->|"merges classes"| node_class_utils
node_card -->|"merges classes"| node_class_utils
node_input -->|"merges classes"| node_class_utils
node_scroll -->|"merges classes"| node_class_utils

click node_home "https://github.com/mohamedyaakoubi/potential/blob/main/app/page.tsx"
click node_hero "https://github.com/mohamedyaakoubi/potential/blob/main/components/hero-section.tsx"
click node_footer "https://github.com/mohamedyaakoubi/potential/blob/main/components/footer.tsx"
click node_chat "https://github.com/mohamedyaakoubi/potential/blob/main/components/potential-section-with-chat.tsx"
click node_chat_api "https://github.com/mohamedyaakoubi/potential/blob/main/app/api/gpt/route.ts"
click node_chat_history "https://github.com/mohamedyaakoubi/potential/blob/main/utils/chatHistory.ts"
click node_results "https://github.com/mohamedyaakoubi/potential/blob/main/components/search-results.tsx"
click node_dataset_api "https://github.com/mohamedyaakoubi/potential/blob/main/app/api/dataset/route.ts"
click node_search_api "https://github.com/mohamedyaakoubi/potential/blob/main/app/api/search/route.ts"
click node_document_api "https://github.com/mohamedyaakoubi/potential/blob/main/app/api/doc/route.ts"
click node_download_api "https://github.com/mohamedyaakoubi/potential/blob/main/app/api/proxyDownload/route.ts"
click node_button "https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/button.tsx"
click node_card "https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/card.tsx"
click node_input "https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/input.tsx"
click node_scroll "https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/scroll-area.tsx"
click node_class_utils "https://github.com/mohamedyaakoubi/potential/blob/main/lib/utils.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_home,node_hero,node_footer toneBlue
class node_results,node_dataset_api,node_search_api,node_download_api,node_firebase_storage toneAmber
class node_chat,node_chat_api,node_chat_history,node_document_api toneMint
class node_button,node_card,node_input,node_scroll,node_class_utils toneRose
class node_visitor,node_gpt_service,node_form_recognizer,node_open_data toneIndigo
```

## Components

### User experience

- [Home state](https://github.com/mohamedyaakoubi/potential/blob/main/app/page.tsx): `app/page.tsx`
- [Search hero](https://github.com/mohamedyaakoubi/potential/blob/main/components/hero-section.tsx): `components/hero-section.tsx`
- [Site footer](https://github.com/mohamedyaakoubi/potential/blob/main/components/footer.tsx): `components/footer.tsx`

### Dataset discovery

- [Dataset results](https://github.com/mohamedyaakoubi/potential/blob/main/components/search-results.tsx): `components/search-results.tsx`
- [Dataset API route](https://github.com/mohamedyaakoubi/potential/blob/main/app/api/dataset/route.ts): `app/api/dataset/route.ts`
- [Search API route](https://github.com/mohamedyaakoubi/potential/blob/main/app/api/search/route.ts): `app/api/search/route.ts`
- [Download proxy route](https://github.com/mohamedyaakoubi/potential/blob/main/app/api/proxyDownload/route.ts): `app/api/proxyDownload/route.ts`

### AI assistant

- [Chat assistant](https://github.com/mohamedyaakoubi/potential/blob/main/components/potential-section-with-chat.tsx): `components/potential-section-with-chat.tsx`
- [GPT endpoint](https://github.com/mohamedyaakoubi/potential/blob/main/app/api/gpt/route.ts): `app/api/gpt/route.ts`
- [Chat history](https://github.com/mohamedyaakoubi/potential/blob/main/utils/chatHistory.ts): `utils/chatHistory.ts`
- [Document API route](https://github.com/mohamedyaakoubi/potential/blob/main/app/api/doc/route.ts): `app/api/doc/route.ts`

### Shared runtime

- [Button control](https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/button.tsx): `components/ui/button.tsx`
- [Card layout](https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/card.tsx): `components/ui/card.tsx`
- [Input control](https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/input.tsx): `components/ui/input.tsx`
- [Scroll area](https://github.com/mohamedyaakoubi/potential/blob/main/components/ui/scroll-area.tsx): `components/ui/scroll-area.tsx`
- [Class utilities](https://github.com/mohamedyaakoubi/potential/blob/main/lib/utils.ts): `lib/utils.ts`

### Other components

- **Visitor**
- **GPT service**
- **Firebase Storage**
- **Form Recognizer**
- **Abu Dhabi catalog**

## Connections

- Visitor → Home state: opens (evidence: `README.md`)
- Home state → Search hero: renders (evidence: `app/page.tsx`)
- Home state → Chat assistant: renders (evidence: `app/page.tsx`)
- Home state → Dataset results: renders (evidence: `app/page.tsx`)
- Home state → Site footer: renders (evidence: `app/page.tsx`)
- Search hero → Home state: submits query (evidence: `app/page.tsx`)
- Chat assistant → Home state: sends datasets (evidence: `app/page.tsx`)
- Dataset results → Abu Dhabi catalog: fetches metadata (evidence: `components/search-results.tsx`)
- Chat assistant → GPT endpoint: posts messages (evidence: `components/potential-section-with-chat.tsx`)
- GPT endpoint → Chat history: reads and saves (evidence: `app/api/gpt/route.ts`)
- GPT endpoint → GPT service: sends prompt (evidence: `app/api/gpt/route.ts`)
- Chat assistant → Firebase Storage: uploads images (evidence: `components/potential-section-with-chat.tsx`)
- Chat assistant → Form Recognizer: processes document (evidence: `components/potential-section-with-chat.tsx`)
- Chat assistant → Button control: uses controls (evidence: `components/potential-section-with-chat.tsx`)
- Chat assistant → Card layout: uses layout (evidence: `components/potential-section-with-chat.tsx`)
- Chat assistant → Input control: uses input (evidence: `components/potential-section-with-chat.tsx`)
- Chat assistant → Scroll area: uses scrolling (evidence: `components/potential-section-with-chat.tsx`)
- Search hero → Button control: uses control (evidence: `components/hero-section.tsx`)
- Search hero → Input control: uses input (evidence: `components/hero-section.tsx`)
- Site footer → Button control: uses control (evidence: `components/footer.tsx`)
- Button control → Class utilities: merges classes (evidence: `components/ui/button.tsx`)
- Card layout → Class utilities: merges classes (evidence: `components/ui/card.tsx`)
- Input control → Class utilities: merges classes (evidence: `components/ui/input.tsx`)
- Scroll area → Class utilities: merges classes (evidence: `components/ui/scroll-area.tsx`)
