# kezakage/pfe-help architecture

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

- Interactive diagram: https://gitdiagram.com/kezakage/pfe-help
- Repository: https://github.com/kezakage/pfe-help

## Overview

PatrimoineHub appears to be a collaborative heritage platform: users explore Algerian heritage resources, authenticate, and work on projects with media, annotations, discussions, and exports. The frontend routes public and authenticated experiences; its API client connects those experiences to a Django backend. Chatbot retrieval and asynchronous media/export processing are distinct supporting workflows. The README provides no architecture detail, and many backend views and frontend pages were not sampled, so links between those unsampled implementations are omitted rather than inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/kezakage/pfe-help/blob/main/frontend/src/App.jsx) (Application routes), [`frontend/src/context/NotificationsContext.jsx`](https://github.com/kezakage/pfe-help/blob/main/frontend/src/context/NotificationsContext.jsx) (Notification state), [`backend/apps/chatbot/services/retriever.py`](https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/services/retriever.py) (Chunk retrieval), [`backend/apps/exports/services/pdf.py`](https://github.com/kezakage/pfe-help/blob/main/backend/apps/exports/services/pdf.py) (PDF builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_routes["Application routes<br/>[App.jsx]"]
  node_search["Heritage search<br/>[AdvancedSearch.jsx]"]
  node_workspace["Project workspace"]
  node_annotation_ui["Auto annotation<br/>[AutoAnnotation.jsx]"]
  node_chat_ui["Chatbot interface<br/>[Chatbot.jsx]"]
  node_export_ui["Export center<br/>[ExportCenter.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_identity["Identity and updates"]
  node_auth_context["Authentication state<br/>[AuthContext.jsx]"]
  node_accounts["Accounts"]
  node_notification_context["Notification state"]
  node_notifications["Notifications"]
end

subgraph group_heritage["Heritage collaboration"]
  node_heritage_views["Heritage projects<br/>[views.py]"]
  node_heritage_data[("Heritage records<br/>[models.py]")]
  node_pages["Project pages"]
  node_discussions["Discussions"]
end

subgraph group_assistance["AI assistance"]
  node_chat_service["RAG service<br/>[rag.py]"]
  node_retriever["Chunk retrieval<br/>[retriever.py]"]
  node_knowledge[("Knowledge chunks<br/>[models.py]")]
  node_embeddings["Embedding service<br/>[embeddings.py]"]
end

subgraph group_operations["Media and exports"]
  node_media_ui["Media annotation UI<br/>[MediaAnnotator.jsx]"]
  node_media_data[("Media records<br/>[models.py]")]
  node_media_tasks["Media processing<br/>[tasks.py]"]
  node_classifier["CLIP classifier<br/>[clip_classifier.py]"]
  node_export_tasks["Export jobs<br/>[tasks.py]"]
  node_export_data[("Export records<br/>[models.py]")]
  node_pdf_service["PDF builder<br/>[pdf.py]"]
end

node_visitor(("Visitor or researcher"))

node_visitor -->|"uses"| node_routes
node_routes -->|"routes to"| node_search
node_routes -->|"routes to"| node_workspace
node_routes -->|"routes to"| node_annotation_ui
node_routes -->|"routes to"| node_chat_ui
node_routes -->|"routes to"| node_export_ui
node_search -->|"queries"| node_api_client
node_auth_context -->|"authenticates through"| node_api_client
node_notification_context -->|"loads notifications"| node_api_client
node_notification_context -->|"opens socket"| node_notifications
node_notification_context -->|"reads user"| node_auth_context
node_chat_service -->|"retrieves chunks"| node_retriever
node_retriever -->|"queries"| node_knowledge
node_retriever -->|"embeds query"| node_embeddings
node_media_tasks -->|"loads and updates"| node_media_data
node_media_tasks -->|"classifies image"| node_classifier
node_export_tasks -->|"loads and updates"| node_export_data
node_export_tasks -->|"builds PDF"| node_pdf_service
node_pdf_service -->|"reads project resource"| node_heritage_data
node_pdf_service -->|"reads media"| node_media_data

click node_routes "https://github.com/kezakage/pfe-help/blob/main/frontend/src/App.jsx"
click node_search "https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/AdvancedSearch.jsx"
click node_workspace "https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/ProjectWorkspace.jsx"
click node_annotation_ui "https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/AutoAnnotation.jsx"
click node_chat_ui "https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/Chatbot.jsx"
click node_export_ui "https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/ExportCenter.jsx"
click node_api_client "https://github.com/kezakage/pfe-help/blob/main/frontend/src/lib/api.js"
click node_auth_context "https://github.com/kezakage/pfe-help/blob/main/frontend/src/context/AuthContext.jsx"
click node_accounts "https://github.com/kezakage/pfe-help/tree/main/backend/apps/accounts"
click node_notification_context "https://github.com/kezakage/pfe-help/blob/main/frontend/src/context/NotificationsContext.jsx"
click node_notifications "https://github.com/kezakage/pfe-help/tree/main/backend/apps/notifications"
click node_heritage_views "https://github.com/kezakage/pfe-help/blob/main/backend/apps/heritage/views.py"
click node_heritage_data "https://github.com/kezakage/pfe-help/blob/main/backend/apps/heritage/models.py"
click node_pages "https://github.com/kezakage/pfe-help/tree/main/backend/apps/pages"
click node_discussions "https://github.com/kezakage/pfe-help/tree/main/backend/apps/discussions"
click node_chat_service "https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/services/rag.py"
click node_retriever "https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/services/retriever.py"
click node_knowledge "https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/models.py"
click node_embeddings "https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/services/embeddings.py"
click node_media_ui "https://github.com/kezakage/pfe-help/blob/main/frontend/src/components/MediaAnnotator.jsx"
click node_media_data "https://github.com/kezakage/pfe-help/blob/main/backend/apps/media/models.py"
click node_media_tasks "https://github.com/kezakage/pfe-help/blob/main/backend/apps/media/tasks.py"
click node_classifier "https://github.com/kezakage/pfe-help/blob/main/backend/apps/media/services/clip_classifier.py"
click node_export_tasks "https://github.com/kezakage/pfe-help/blob/main/backend/apps/exports/tasks.py"
click node_export_data "https://github.com/kezakage/pfe-help/blob/main/backend/apps/exports/models.py"
click node_pdf_service "https://github.com/kezakage/pfe-help/blob/main/backend/apps/exports/services/pdf.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_routes,node_search,node_workspace,node_annotation_ui,node_chat_ui,node_export_ui,node_api_client toneBlue
class node_auth_context,node_accounts,node_notification_context,node_notifications toneAmber
class node_heritage_views,node_heritage_data,node_pages,node_discussions toneMint
class node_chat_service,node_retriever,node_knowledge,node_embeddings toneRose
class node_media_ui,node_media_data,node_media_tasks,node_classifier,node_export_tasks,node_export_data,node_pdf_service,node_visitor toneIndigo
```

## Components

### Web client

- [Application routes](https://github.com/kezakage/pfe-help/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Heritage search](https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/AdvancedSearch.jsx): `frontend/src/pages/app/AdvancedSearch.jsx`
- [Project workspace](https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/ProjectWorkspace.jsx): `frontend/src/pages/app/ProjectWorkspace.jsx`
- [Auto annotation](https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/AutoAnnotation.jsx): `frontend/src/pages/app/AutoAnnotation.jsx`
- [Chatbot interface](https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/Chatbot.jsx): `frontend/src/pages/app/Chatbot.jsx`
- [Export center](https://github.com/kezakage/pfe-help/blob/main/frontend/src/pages/app/ExportCenter.jsx): `frontend/src/pages/app/ExportCenter.jsx`
- [API client](https://github.com/kezakage/pfe-help/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`

### Identity and updates

- [Authentication state](https://github.com/kezakage/pfe-help/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Accounts](https://github.com/kezakage/pfe-help/tree/main/backend/apps/accounts): `backend/apps/accounts`
- [Notification state](https://github.com/kezakage/pfe-help/blob/main/frontend/src/context/NotificationsContext.jsx): `frontend/src/context/NotificationsContext.jsx`
- [Notifications](https://github.com/kezakage/pfe-help/tree/main/backend/apps/notifications): `backend/apps/notifications`

### Heritage collaboration

- [Heritage projects](https://github.com/kezakage/pfe-help/blob/main/backend/apps/heritage/views.py): `backend/apps/heritage/views.py`
- [Heritage records](https://github.com/kezakage/pfe-help/blob/main/backend/apps/heritage/models.py): `backend/apps/heritage/models.py`
- [Project pages](https://github.com/kezakage/pfe-help/tree/main/backend/apps/pages): `backend/apps/pages`
- [Discussions](https://github.com/kezakage/pfe-help/tree/main/backend/apps/discussions): `backend/apps/discussions`

### AI assistance

- [RAG service](https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/services/rag.py): `backend/apps/chatbot/services/rag.py`
- [Chunk retrieval](https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/services/retriever.py): `backend/apps/chatbot/services/retriever.py`
- [Knowledge chunks](https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/models.py): `backend/apps/chatbot/models.py`
- [Embedding service](https://github.com/kezakage/pfe-help/blob/main/backend/apps/chatbot/services/embeddings.py): `backend/apps/chatbot/services/embeddings.py`

### Media and exports

- [Media annotation UI](https://github.com/kezakage/pfe-help/blob/main/frontend/src/components/MediaAnnotator.jsx): `frontend/src/components/MediaAnnotator.jsx`
- [Media records](https://github.com/kezakage/pfe-help/blob/main/backend/apps/media/models.py): `backend/apps/media/models.py`
- [Media processing](https://github.com/kezakage/pfe-help/blob/main/backend/apps/media/tasks.py): `backend/apps/media/tasks.py`
- [CLIP classifier](https://github.com/kezakage/pfe-help/blob/main/backend/apps/media/services/clip_classifier.py): `backend/apps/media/services/clip_classifier.py`
- [Export jobs](https://github.com/kezakage/pfe-help/blob/main/backend/apps/exports/tasks.py): `backend/apps/exports/tasks.py`
- [Export records](https://github.com/kezakage/pfe-help/blob/main/backend/apps/exports/models.py): `backend/apps/exports/models.py`
- [PDF builder](https://github.com/kezakage/pfe-help/blob/main/backend/apps/exports/services/pdf.py): `backend/apps/exports/services/pdf.py`

### Other components

- **Visitor or researcher**

## Connections

- Visitor or researcher → Application routes: uses (evidence: `frontend/src/App.jsx`)
- Application routes → Heritage search: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Project workspace: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Auto annotation: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Chatbot interface: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Export center: routes to (evidence: `frontend/src/App.jsx`)
- Heritage search → API client: queries (evidence: `frontend/src/pages/app/AdvancedSearch.jsx`)
- Authentication state → API client: authenticates through (evidence: `frontend/src/context/AuthContext.jsx`)
- Notification state → API client: loads notifications (evidence: `frontend/src/context/NotificationsContext.jsx`)
- Notification state → Notifications: opens socket (evidence: `frontend/src/context/NotificationsContext.jsx`)
- Notification state → Authentication state: reads user (evidence: `frontend/src/context/NotificationsContext.jsx`)
- RAG service → Chunk retrieval: retrieves chunks (evidence: `backend/apps/chatbot/services/rag.py`)
- Chunk retrieval → Knowledge chunks: queries (evidence: `backend/apps/chatbot/services/retriever.py`)
- Chunk retrieval → Embedding service: embeds query (evidence: `backend/apps/chatbot/services/retriever.py`)
- Media processing → Media records: loads and updates (evidence: `backend/apps/media/tasks.py`)
- Media processing → CLIP classifier: classifies image (evidence: `backend/apps/media/tasks.py`)
- Export jobs → Export records: loads and updates (evidence: `backend/apps/exports/tasks.py`)
- Export jobs → PDF builder: builds PDF (evidence: `backend/apps/exports/tasks.py`)
- PDF builder → Heritage records: reads project resource (evidence: `backend/apps/exports/services/pdf.py`)
- PDF builder → Media records: reads media (evidence: `backend/apps/exports/services/pdf.py`)
