# hala-alkeddeh/market-entry-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/hala-alkeddeh/market-entry-assistant
- Repository: https://github.com/hala-alkeddeh/market-entry-assistant

## Overview

Bosla guides an investor from a bilingual market-entry profile to a source-grounded analysis, then supports cited follow-up questions. The backend retrieves English-normalized source material from Pinecone and uses Gemini to produce answers; a separate ingestion path indexes the private knowledge base. The README documents the end-to-end retrieval flow, while the sampled server code confirms route validation and query delegation. Some page-level API wiring and unsampled analysis details are documented but not visible in the excerpts.

Main entry points: [`src/router/AppRouter.jsx`](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/router/AppRouter.jsx) (Page router), [`server/query.js`](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/query.js) (Retrieval and generation), [`server/ingest.js`](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/ingest.js) (Source ingestion), [`server/app.js`](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/app.js) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Bilingual frontend"]
  node_app["App shell<br/>[App.jsx]"]
  node_router["Page router<br/>[AppRouter.jsx]"]
  node_home["Home page<br/>[Home.jsx]"]
  node_input["Profile input<br/>[Input.jsx]"]
  node_analysis["Analysis flow<br/>[Analysis.jsx]"]
  node_result["Results and follow-up<br/>[Result.jsx]"]
  node_markdown["Markdown renderer<br/>[MarkdownText.jsx]"]
  node_language["Language context"]
  node_arabic["Arabic strings<br/>[ar.js]"]
  node_english["English strings<br/>[en.js]"]
  node_decision["Decision engine<br/>[decisionEngine.js]"]
end

subgraph group_api["Analysis API"]
  node_routes["API routes<br/>[app.js]"]
  node_query["Retrieval and generation<br/>[query.js]"]
  node_mock["Mock answers<br/>[mock.js]"]
  node_config["Runtime configuration<br/>[config.js]"]
  node_vercel["Serverless entrypoint<br/>[index.js]"]
end

subgraph group_knowledge["Knowledge pipeline"]
  node_ingest["Source ingestion<br/>[ingest.js]"]
  node_sources["Reference documents"]
end

subgraph group_integrations["External services"]
  node_pinecone[("Pinecone index")]
  node_gemini["Google Gemini"]
end

node_investor(("Investor"))

node_investor -->|"starts at"| node_home
node_app -->|"renders"| node_router
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_input
node_router -->|"routes to"| node_analysis
node_router -->|"routes to"| node_result
node_input -->|"submits profile"| node_analysis
node_analysis -->|"posts analysis"| node_routes
node_result -->|"posts follow-up"| node_routes
node_routes -->|"delegates answers"| node_query
node_query -->|"retrieves matches"| node_pinecone
node_query -->|"embeds and generates"| node_gemini
node_ingest -->|"reads documents"| node_sources
node_ingest -->|"embeds chunks"| node_gemini
node_ingest -->|"upserts vectors"| node_pinecone
node_query -->|"uses mock mode"| node_mock
node_query -->|"reads settings"| node_config
node_ingest -->|"reads settings"| node_config
node_vercel -->|"re-exports app"| node_routes
node_language -->|"loads dictionary"| node_arabic
node_language -->|"loads dictionary"| node_english
node_app -->|"uses context"| node_language
node_result -->|"renders answers"| node_markdown

click node_app "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/App.jsx"
click node_router "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/router/AppRouter.jsx"
click node_home "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/pages/Home.jsx"
click node_input "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/pages/Input.jsx"
click node_analysis "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/pages/Analysis.jsx"
click node_result "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/pages/Result.jsx"
click node_markdown "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/components/MarkdownText.jsx"
click node_language "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/i18n/LanguageContext.jsx"
click node_arabic "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/i18n/ar.js"
click node_english "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/i18n/en.js"
click node_decision "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/decisionEngine.js"
click node_routes "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/app.js"
click node_query "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/query.js"
click node_mock "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/mock.js"
click node_config "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/config.js"
click node_vercel "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/api/index.js"
click node_ingest "https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/ingest.js"
click node_sources "https://github.com/hala-alkeddeh/market-entry-assistant/tree/main/sources"

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_router,node_home,node_input,node_analysis,node_result,node_markdown,node_language,node_arabic,node_english,node_decision toneBlue
class node_routes,node_query,node_mock,node_config,node_vercel toneAmber
class node_ingest,node_sources toneMint
class node_pinecone,node_gemini toneRose
class node_investor toneIndigo
```

## Components

### Bilingual frontend

- [App shell](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/App.jsx): `src/App.jsx`
- [Page router](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/router/AppRouter.jsx): `src/router/AppRouter.jsx`
- [Home page](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Profile input](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/pages/Input.jsx): `src/pages/Input.jsx`
- [Analysis flow](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/pages/Analysis.jsx): `src/pages/Analysis.jsx`
- [Results and follow-up](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/pages/Result.jsx): `src/pages/Result.jsx`
- [Markdown renderer](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/components/MarkdownText.jsx): `src/components/MarkdownText.jsx`
- [Language context](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/i18n/LanguageContext.jsx): `src/i18n/LanguageContext.jsx`
- [Arabic strings](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/i18n/ar.js): `src/i18n/ar.js`
- [English strings](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/i18n/en.js): `src/i18n/en.js`
- [Decision engine](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/src/decisionEngine.js): `src/decisionEngine.js`

### Analysis API

- [API routes](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/app.js): `server/app.js`
- [Retrieval and generation](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/query.js): `server/query.js`
- [Mock answers](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/mock.js): `server/mock.js`
- [Runtime configuration](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/config.js): `server/config.js`
- [Serverless entrypoint](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/api/index.js): `api/index.js`

### Knowledge pipeline

- [Source ingestion](https://github.com/hala-alkeddeh/market-entry-assistant/blob/main/server/ingest.js): `server/ingest.js`
- [Reference documents](https://github.com/hala-alkeddeh/market-entry-assistant/tree/main/sources): `sources`

### External services

- **Pinecone index**
- **Google Gemini**

### Other components

- **Investor**

## Connections

- Investor → Home page: starts at
- App shell → Page router: renders (evidence: `src/App.jsx`)
- Page router → Home page: routes to (evidence: `src/router/AppRouter.jsx`)
- Page router → Profile input: routes to (evidence: `src/router/AppRouter.jsx`)
- Page router → Analysis flow: routes to (evidence: `src/router/AppRouter.jsx`)
- Page router → Results and follow-up: routes to (evidence: `src/router/AppRouter.jsx`)
- Profile input → Analysis flow: submits profile (evidence: `src/pages/Input.jsx`)
- Analysis flow → API routes: posts analysis (evidence: `README.md`)
- Results and follow-up → API routes: posts follow-up (evidence: `src/pages/Result.jsx`)
- API routes → Retrieval and generation: delegates answers (evidence: `server/app.js`)
- Retrieval and generation → Pinecone index: retrieves matches (evidence: `README.md`)
- Retrieval and generation → Google Gemini: embeds and generates (evidence: `server/query.js`)
- Source ingestion → Reference documents: reads documents (evidence: `server/ingest.js`)
- Source ingestion → Google Gemini: embeds chunks (evidence: `server/ingest.js`)
- Source ingestion → Pinecone index: upserts vectors (evidence: `server/ingest.js`)
- Retrieval and generation → Mock answers: uses mock mode (evidence: `server/query.js`)
- Retrieval and generation → Runtime configuration: reads settings (evidence: `server/query.js`)
- Source ingestion → Runtime configuration: reads settings (evidence: `server/ingest.js`)
- Serverless entrypoint → API routes: re-exports app (evidence: `README.md`)
- Language context → Arabic strings: loads dictionary (evidence: `src/i18n/LanguageContext.jsx`)
- Language context → English strings: loads dictionary (evidence: `src/i18n/LanguageContext.jsx`)
- App shell → Language context: uses context (evidence: `src/App.jsx`)
- Results and follow-up → Markdown renderer: renders answers (evidence: `src/pages/Result.jsx`)
