# mudiambat13/assistant-foncier-rdc architecture

> Architecture diagram of the GitHub repository mudiambat13/assistant-foncier-rdc, 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/mudiambat13/assistant-foncier-rdc
- Repository: https://github.com/mudiambat13/assistant-foncier-rdc

## Overview

Assistant foncier RDC is a French-language legal Q&A product for Congolese land law. A user submits a question in the React interface; Flask validates the conversation, retrieves relevant official-text excerpts, combines them with the legal system prompt, and streams a response from a configured AI provider. The interface displays citations and stores conversations locally. The graph also shows the documented provider choices and optional Google grounding. Source excerpts establish the main backend calls; some frontend status and provider-selection wiring is not shown, so those links are omitted.

Main entry points: [`backend/app.py`](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/app.py) (Chat API), [`frontend/src/App.jsx`](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/frontend/src/App.jsx) (Chat interface), [`backend/providers.py`](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/providers.py) (Provider adapters), [`backend/knowledge.py`](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/knowledge.py) (Text retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_react_entry["React entry<br/>[main.jsx]"]
  node_chat_ui["Chat interface<br/>[App.jsx]"]
  node_browser_store[("Conversation storage")]
end

subgraph group_backend["Chat backend"]
  node_flask_api["Chat API<br/>[app.py]"]
end

subgraph group_legal["Legal knowledge"]
  node_legal_index["Text retrieval<br/>[knowledge.py]"]
  node_legal_texts["Official legal texts"]
  node_legal_prompt["Legal instructions<br/>[prompts.py]"]
end

subgraph group_ai["AI providers"]
  node_provider_adapter["Provider adapters<br/>[providers.py]"]
  node_ai_services{{"Configured AI services"}}
end

node_user(("Legal questioner"))
node_google_search{{"Google search"}}

node_user -->|"asks question"| node_chat_ui
node_react_entry -->|"renders"| node_chat_ui
node_chat_ui -->|"reads and writes"| node_browser_store
node_chat_ui -->|"posts chat"| node_flask_api
node_flask_api -->|"streams answer"| node_chat_ui
node_flask_api -->|"searches and formats"| node_legal_index
node_flask_api -->|"adds instructions"| node_legal_prompt
node_flask_api -->|"selects and streams"| node_provider_adapter
node_legal_index -->|"loads documents"| node_legal_texts
node_provider_adapter -->|"streams completions"| node_ai_services
node_provider_adapter -.->|"optionally grounds"| node_google_search

click node_react_entry "https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/frontend/src/main.jsx"
click node_chat_ui "https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/frontend/src/App.jsx"
click node_flask_api "https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/app.py"
click node_legal_index "https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/knowledge.py"
click node_legal_texts "https://github.com/mudiambat13/assistant-foncier-rdc/tree/main/backend/knowledge"
click node_legal_prompt "https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/prompts.py"
click node_provider_adapter "https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/providers.py"

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_react_entry,node_chat_ui,node_browser_store toneBlue
class node_flask_api toneAmber
class node_legal_index,node_legal_texts,node_legal_prompt toneMint
class node_provider_adapter,node_ai_services toneRose
class node_user,node_google_search toneIndigo
```

## Components

### User interface

- [React entry](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Chat interface](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- **Conversation storage**

### Chat backend

- [Chat API](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/app.py): `backend/app.py`

### Legal knowledge

- [Text retrieval](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/knowledge.py): `backend/knowledge.py`
- [Official legal texts](https://github.com/mudiambat13/assistant-foncier-rdc/tree/main/backend/knowledge): `backend/knowledge`
- [Legal instructions](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/prompts.py): `backend/prompts.py`

### AI providers

- [Provider adapters](https://github.com/mudiambat13/assistant-foncier-rdc/blob/main/backend/providers.py): `backend/providers.py`
- **Configured AI services**

### Other components

- **Legal questioner**
- **Google search**

## Connections

- Legal questioner → Chat interface: asks question (evidence: `frontend/src/App.jsx`)
- React entry → Chat interface: renders (evidence: `frontend/src/main.jsx`)
- Chat interface → Conversation storage: reads and writes (evidence: `frontend/src/App.jsx`)
- Chat interface → Chat API: posts chat (evidence: `frontend/src/App.jsx`)
- Chat API → Chat interface: streams answer (evidence: `frontend/src/App.jsx`)
- Chat API → Text retrieval: searches and formats (evidence: `backend/app.py`)
- Chat API → Legal instructions: adds instructions (evidence: `backend/app.py`)
- Chat API → Provider adapters: selects and streams (evidence: `backend/app.py`)
- Text retrieval → Official legal texts: loads documents (evidence: `README.md`)
- Provider adapters → Configured AI services: streams completions (evidence: `README.md`)
- Provider adapters → Google search: optionally grounds (evidence: `backend/providers.py`)
