# pecs-mate/pesc-mate architecture

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

- Interactive diagram: https://gitdiagram.com/pecs-mate/pesc-mate
- Repository: https://github.com/pecs-mate/pesc-mate

## Overview

PECS MATE is a browser-based AAC platform: users select picture, text, or RFID cards, assemble an utterance, and communicate it through speech; caregivers and support staff extend this workflow by managing cards, boards, practice, and records. The map includes documented product branches whose implementation was not sampled, using exact paths from the tree. Sampled source supports the application/API entry and several service relationships; unsampled domain wiring is omitted rather than inferred. Optional AI speech and offline behavior are shown as distinct capabilities.

Main entry points: [`backend/app/api/router.py`](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/router.py) (Domain API routes), [`frontend/src/services/api.js`](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/services/api.js) (API client), [`frontend/src/pages/SupportWorkspacePage.jsx`](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/pages/SupportWorkspacePage.jsx) (Support workspace), [`frontend/src/hooks/use-speech-controller.js`](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/hooks/use-speech-controller.js) (Speech controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["AAC experience"]
  node_web_app["Web application<br/>[App.jsx]"]
  node_communication_ui["Communication workspace"]
  node_speech_controller["Speech controller"]
  node_offline_client["Offline session"]
  node_rfid_ui["RFID board<br/>[RfidBoard.jsx]"]
end

subgraph group_content["Cards and boards"]
  node_card_library["Card catalog"]
  node_card_authoring["Card registration"]
  node_a4_tools["A4 editor and sharing<br/>[A4Workspace.jsx]"]
  node_board_editor["Board management"]
end

subgraph group_learning["Practice and support"]
  node_practice_ui["Practice and courses"]
  node_support_workspace["Support workspace"]
  node_records_ui["Records and insights"]
end

subgraph group_backend["API and services"]
  node_api_client["API client<br/>[api.js]"]
  node_api_entry["FastAPI application<br/>[main.py]"]
  node_api_routes["Domain API routes<br/>[router.py]"]
  node_auth_accounts["Identity and permissions<br/>[accounts.py]"]
  node_card_api["Card API<br/>[cards.py]"]
  node_board_api["Board API<br/>[boards.py]"]
  node_communication_api["Communication API<br/>[communication.py]"]
  node_learning_api["Learning APIs<br/>[learning.py]"]
  node_records_api["Records API<br/>[records.py]"]
  node_rfid_api["RFID API<br/>[rfid.py]"]
  node_practice_suggestions["Practice suggestions"]
  node_card_submissions["Card submission service"]
  node_communication_service["Sentence and history service<br/>[communication.py]"]
  node_sentence_model["Sentence generation<br/>[model.py]"]
  node_image_storage["Image storage<br/>[image_storage.py]"]
end

subgraph group_persistence["State and speech"]
  node_mongo[("MongoDB")]
  node_offline_store[("Browser offline store<br/>[offlineStore.js]")]
  node_speech_service["Speech synthesis<br/>[speech_runtime.py]"]
  node_melotts["MeloTTS<br/>[server.py]"]
end

node_aac_user(("AAC user"))
node_support_user(("Caregiver / staff"))
node_rfid_device(("RFID reader"))

node_aac_user -->|"uses"| node_web_app
node_support_user -->|"manages through"| node_web_app
node_rfid_device -->|"tags cards"| node_rfid_ui
node_web_app -->|"renders"| node_communication_ui
node_web_app -->|"renders"| node_support_workspace
node_communication_ui -->|"refreshes"| node_card_library
node_communication_ui -.->|"controls speech"| node_speech_controller
node_rfid_ui -.->|"sends mapping requests"| node_api_client
node_support_workspace -->|"renders"| node_card_authoring
node_support_workspace -.->|"offers"| node_a4_tools
node_support_workspace -.->|"offers"| node_board_editor
node_support_workspace -->|"renders"| node_records_ui
node_practice_ui -.->|"requests practice"| node_api_client
node_speech_controller -->|"requests audio"| node_api_client
node_speech_controller -->|"queues events"| node_offline_store
node_card_library -->|"loads cards"| node_api_client
node_api_client -->|"calls"| node_api_entry
node_api_entry -->|"mounts"| node_api_routes
node_api_routes -->|"registers"| node_auth_accounts
node_api_routes -->|"registers"| node_card_api
node_api_routes -->|"registers"| node_board_api
node_api_routes -->|"registers"| node_communication_api
node_api_routes -->|"registers"| node_learning_api
node_api_routes -->|"registers"| node_records_api
node_api_routes -->|"registers"| node_rfid_api
node_api_routes -->|"registers"| node_practice_suggestions
node_card_api -->|"calls"| node_card_submissions
node_communication_api -.->|"uses"| node_communication_service
node_communication_service -->|"generates with"| node_sentence_model
node_api_entry -.->|"configures access"| node_mongo
node_speech_service -.->|"uses"| node_melotts
node_card_authoring -.->|"submits cards"| node_api_client
node_card_submissions -.->|"stores images"| node_image_storage
node_image_storage -.->|"stores derivatives"| node_mongo
node_communication_service -->|"persists history"| node_mongo
node_speech_controller -->|"saves settings"| node_api_client
node_offline_client -.->|"manages offline state"| node_offline_store
node_practice_suggestions -.->|"supports practice"| node_learning_api

click node_web_app "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/App.jsx"
click node_communication_ui "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/pages/CommunicatorPage.jsx"
click node_speech_controller "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/hooks/use-speech-controller.js"
click node_offline_client "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/hooks/use-offline-session.js"
click node_rfid_ui "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/RfidBoard.jsx"
click node_card_library "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/hooks/useLiveCardCatalog.js"
click node_card_authoring "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/PhysicalCardImporter.jsx"
click node_a4_tools "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/A4Workspace.jsx"
click node_board_editor "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/BoardConfiguration.jsx"
click node_practice_ui "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/PracticeOverview.jsx"
click node_support_workspace "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/pages/SupportWorkspacePage.jsx"
click node_records_ui "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/SupportRecordTabs.jsx"
click node_api_client "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/services/api.js"
click node_api_entry "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/main.py"
click node_api_routes "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/router.py"
click node_auth_accounts "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/accounts.py"
click node_card_api "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/cards.py"
click node_board_api "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/boards.py"
click node_communication_api "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/communication.py"
click node_learning_api "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/learning.py"
click node_records_api "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/records.py"
click node_rfid_api "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/rfid.py"
click node_practice_suggestions "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/practice_suggestions.py"
click node_card_submissions "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/card_submissions.py"
click node_communication_service "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/communication.py"
click node_sentence_model "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/model.py"
click node_image_storage "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/image_storage.py"
click node_offline_store "https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/services/offlineStore.js"
click node_speech_service "https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/speech_runtime.py"
click node_melotts "https://github.com/pecs-mate/pesc-mate/blob/main/services/melotts/server.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_web_app,node_communication_ui,node_speech_controller,node_offline_client,node_rfid_ui,node_aac_user toneBlue
class node_card_library,node_card_authoring,node_a4_tools,node_board_editor toneAmber
class node_practice_ui,node_support_workspace,node_records_ui toneMint
class node_api_client,node_api_entry,node_api_routes,node_auth_accounts,node_card_api,node_board_api,node_communication_api,node_learning_api,node_records_api,node_rfid_api,node_practice_suggestions,node_card_submissions,node_communication_service,node_sentence_model,node_image_storage toneRose
class node_mongo,node_offline_store,node_speech_service,node_melotts,node_support_user,node_rfid_device toneIndigo
```

## Components

### AAC experience

- [Web application](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Communication workspace](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/pages/CommunicatorPage.jsx): `frontend/src/pages/CommunicatorPage.jsx`
- [Speech controller](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/hooks/use-speech-controller.js): `frontend/src/hooks/use-speech-controller.js`
- [Offline session](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/hooks/use-offline-session.js): `frontend/src/hooks/use-offline-session.js`
- [RFID board](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/RfidBoard.jsx): `frontend/src/RfidBoard.jsx`

### Cards and boards

- [Card catalog](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/hooks/useLiveCardCatalog.js): `frontend/src/hooks/useLiveCardCatalog.js`
- [Card registration](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/PhysicalCardImporter.jsx): `frontend/src/PhysicalCardImporter.jsx`
- [A4 editor and sharing](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/A4Workspace.jsx): `frontend/src/A4Workspace.jsx`
- [Board management](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/BoardConfiguration.jsx): `frontend/src/BoardConfiguration.jsx`

### Practice and support

- [Practice and courses](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/PracticeOverview.jsx): `frontend/src/PracticeOverview.jsx`
- [Support workspace](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/pages/SupportWorkspacePage.jsx): `frontend/src/pages/SupportWorkspacePage.jsx`
- [Records and insights](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/SupportRecordTabs.jsx): `frontend/src/SupportRecordTabs.jsx`

### API and services

- [API client](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [FastAPI application](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/main.py): `backend/app/main.py`
- [Domain API routes](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Identity and permissions](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/accounts.py): `backend/app/api/accounts.py`
- [Card API](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/cards.py): `backend/app/api/cards.py`
- [Board API](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/boards.py): `backend/app/api/boards.py`
- [Communication API](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/communication.py): `backend/app/api/communication.py`
- [Learning APIs](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/learning.py): `backend/app/api/learning.py`
- [Records API](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/records.py): `backend/app/api/records.py`
- [RFID API](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/rfid.py): `backend/app/api/rfid.py`
- [Practice suggestions](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/api/practice_suggestions.py): `backend/app/api/practice_suggestions.py`
- [Card submission service](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/card_submissions.py): `backend/app/services/card_submissions.py`
- [Sentence and history service](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/communication.py): `backend/app/services/communication.py`
- [Sentence generation](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/model.py): `backend/app/services/model.py`
- [Image storage](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/image_storage.py): `backend/app/services/image_storage.py`

### State and speech

- **MongoDB**
- [Browser offline store](https://github.com/pecs-mate/pesc-mate/blob/main/frontend/src/services/offlineStore.js): `frontend/src/services/offlineStore.js`
- [Speech synthesis](https://github.com/pecs-mate/pesc-mate/blob/main/backend/app/services/speech_runtime.py): `backend/app/services/speech_runtime.py`
- [MeloTTS](https://github.com/pecs-mate/pesc-mate/blob/main/services/melotts/server.py): `services/melotts/server.py`

### Other components

- **AAC user**
- **Caregiver / staff**
- **RFID reader**

## Connections

- AAC user → Web application: uses
- Caregiver / staff → Web application: manages through
- RFID reader → RFID board: tags cards
- Web application → Communication workspace: renders (evidence: `frontend/src/App.jsx`)
- Web application → Support workspace: renders (evidence: `frontend/src/App.jsx`)
- Communication workspace → Card catalog: refreshes (evidence: `frontend/src/hooks/useLiveCardCatalog.js`)
- Communication workspace → Speech controller: controls speech
- RFID board → API client: sends mapping requests
- Support workspace → Card registration: renders (evidence: `frontend/src/pages/SupportWorkspacePage.jsx`)
- Support workspace → A4 editor and sharing: offers
- Support workspace → Board management: offers (evidence: `frontend/src/pages/SupportWorkspacePage.jsx`)
- Support workspace → Records and insights: renders (evidence: `frontend/src/pages/SupportWorkspacePage.jsx`)
- Practice and courses → API client: requests practice
- Speech controller → API client: requests audio (evidence: `frontend/src/hooks/use-speech-controller.js`)
- Speech controller → Browser offline store: queues events (evidence: `frontend/src/hooks/use-speech-controller.js`)
- Card catalog → API client: loads cards (evidence: `frontend/src/hooks/useLiveCardCatalog.js`)
- API client → FastAPI application: calls
- FastAPI application → Domain API routes: mounts (evidence: `backend/app/main.py`)
- Domain API routes → Identity and permissions: registers (evidence: `backend/app/api/router.py`)
- Domain API routes → Card API: registers (evidence: `backend/app/api/router.py`)
- Domain API routes → Board API: registers (evidence: `backend/app/api/router.py`)
- Domain API routes → Communication API: registers (evidence: `backend/app/api/router.py`)
- Domain API routes → Learning APIs: registers (evidence: `backend/app/api/router.py`)
- Domain API routes → Records API: registers (evidence: `backend/app/api/router.py`)
- Domain API routes → RFID API: registers (evidence: `backend/app/api/router.py`)
- Domain API routes → Practice suggestions: registers (evidence: `backend/app/api/router.py`)
- Card API → Card submission service: calls (evidence: `backend/app/api/cards.py`)
- Communication API → Sentence and history service: uses
- Sentence and history service → Sentence generation: generates with (evidence: `backend/app/services/communication.py`)
- FastAPI application → MongoDB: configures access
- Speech synthesis → MeloTTS: uses
- Card registration → API client: submits cards
- Card submission service → Image storage: stores images
- Image storage → MongoDB: stores derivatives
- Sentence and history service → MongoDB: persists history (evidence: `backend/app/services/communication.py`)
- Speech controller → API client: saves settings (evidence: `frontend/src/hooks/use-speech-controller.js`)
- Offline session → Browser offline store: manages offline state
- Practice suggestions → Learning APIs: supports practice
