# rajkumarceo/funtobots architecture

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

- Interactive diagram: https://gitdiagram.com/rajkumarceo/funtobots
- Repository: https://github.com/rajkumarceo/funtobots

## Overview

Funobotz is an adaptive STEM learning platform with a web experience and an Express API. Learners select a kit and use FunoGuide for kit-grounded help, follow missions, try STEM simulations, and review learning dashboards; voice interaction is another route into the tutor. The API also exposes entitlement, lab-attempt, mission, and analytics routes. The excerpts establish the application composition and the chat controller’s entitlement, retrieval, and tutoring calls. Other UI-to-API links and unsampled integrations are not inferred.

Main entry points: [`apps/web/src/App.jsx`](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/App.jsx) (App shell), [`apps/api/src/server.js`](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/server.js) (API router), [`apps/api/src/modules/chat/chatController.js`](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/chat/chatController.js) (Chat controller), [`apps/web/src/components/voice/VoiceContainer.jsx`](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/voice/VoiceContainer.jsx) (Voice experience)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Learning experience"]
  node_web_app["App shell<br/>[App.jsx]"]
  node_app_state["Learning context<br/>[AppContext.jsx]"]
  node_chat_ui["Chat experience<br/>[ChatContainer.jsx]"]
  node_guide_widget["FunoGuide widget"]
  node_missions_ui["Missions experience"]
  node_lab_ui["STEM lab experience<br/>[LabContainer.jsx]"]
  node_voice_ui["Voice experience<br/>[VoiceContainer.jsx]"]
  node_dashboard_ui["Learning dashboard"]
end

subgraph group_api["Learning API"]
  node_api_server["API router<br/>[server.js]"]
  node_chat_api["Chat controller<br/>[chatController.js]"]
  node_entitlements[("Kit entitlements")]
  node_missions_api[("Mission catalog")]
  node_lab_api[("Lab attempts<br/>[labController.js]")]
  node_analytics_api["Analytics routes"]
end

subgraph group_tutor["Tutor intelligence"]
  node_knowledge[("Kit knowledge base<br/>[knowledgeBase.js]")]
  node_socratic["Socratic response<br/>[funoGuidePrompt.js]"]
  node_llm_adapter["LLM adapter<br/>[llmAdapter.js]"]
end

subgraph group_packages["Reusable learning packages"]
  node_simulations["STEM simulations<br/>[index.jsx]"]
  node_widget_package["Chatbot widget package<br/>[index.js]"]
  node_schemas["Shared schemas<br/>[index.js]"]
end

node_learner(("Learner"))
node_speech_service["ElevenLabs speech"]

node_learner -->|"uses"| node_web_app
node_web_app -->|"reads state"| node_app_state
node_web_app -->|"renders"| node_chat_ui
node_web_app -->|"renders"| node_guide_widget
node_web_app -->|"renders"| node_missions_ui
node_web_app -->|"renders"| node_lab_ui
node_web_app -->|"renders"| node_voice_ui
node_web_app -->|"renders"| node_dashboard_ui
node_api_server -->|"routes requests"| node_chat_api
node_api_server -->|"routes requests"| node_entitlements
node_api_server -->|"routes requests"| node_missions_api
node_api_server -->|"routes requests"| node_lab_api
node_api_server -->|"routes requests"| node_analytics_api
node_chat_api -->|"checks access"| node_entitlements
node_entitlements -->|"validates kit IDs"| node_knowledge
node_chat_api -->|"retrieves knowledge"| node_knowledge
node_chat_api -->|"generates answer"| node_socratic
node_socratic -->|"references kit knowledge"| node_knowledge
node_lab_ui -->|"uses simulations"| node_simulations
node_voice_ui -->|"posts question"| node_chat_api
node_voice_ui -->|"requests speech"| node_speech_service

click node_web_app "https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/App.jsx"
click node_app_state "https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/context/AppContext.jsx"
click node_chat_ui "https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/chat/ChatContainer.jsx"
click node_guide_widget "https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/chat/FunoGuideWidget.jsx"
click node_missions_ui "https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/missions/MissionContainer.jsx"
click node_lab_ui "https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/stem-lab/LabContainer.jsx"
click node_voice_ui "https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/voice/VoiceContainer.jsx"
click node_dashboard_ui "https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/dashboard/DashboardContainer.jsx"
click node_api_server "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/server.js"
click node_chat_api "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/chat/chatController.js"
click node_entitlements "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/auth/entitlementController.js"
click node_knowledge "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/ai/retrieval/knowledgeBase.js"
click node_socratic "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/ai/prompts/funoGuidePrompt.js"
click node_llm_adapter "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/ai/providers/llmAdapter.js"
click node_missions_api "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/missions/missionController.js"
click node_lab_api "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/lab/labController.js"
click node_analytics_api "https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/analytics/analyticsController.js"
click node_simulations "https://github.com/rajkumarceo/funtobots/blob/main/packages/stem-simulations/index.jsx"
click node_widget_package "https://github.com/rajkumarceo/funtobots/blob/main/packages/chatbot-widget/index.js"
click node_schemas "https://github.com/rajkumarceo/funtobots/blob/main/packages/shared-schemas/index.js"

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_app_state,node_chat_ui,node_guide_widget,node_missions_ui,node_lab_ui,node_voice_ui,node_dashboard_ui toneBlue
class node_api_server,node_chat_api,node_entitlements,node_missions_api,node_lab_api,node_analytics_api toneAmber
class node_knowledge,node_socratic,node_llm_adapter toneMint
class node_simulations,node_widget_package,node_schemas toneRose
class node_learner,node_speech_service toneIndigo
```

## Components

### Learning experience

- [App shell](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/App.jsx): `apps/web/src/App.jsx`
- [Learning context](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/context/AppContext.jsx): `apps/web/src/context/AppContext.jsx`
- [Chat experience](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/chat/ChatContainer.jsx): `apps/web/src/components/chat/ChatContainer.jsx`
- [FunoGuide widget](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/chat/FunoGuideWidget.jsx): `apps/web/src/components/chat/FunoGuideWidget.jsx`
- [Missions experience](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/missions/MissionContainer.jsx): `apps/web/src/components/missions/MissionContainer.jsx`
- [STEM lab experience](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/stem-lab/LabContainer.jsx): `apps/web/src/components/stem-lab/LabContainer.jsx`
- [Voice experience](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/voice/VoiceContainer.jsx): `apps/web/src/components/voice/VoiceContainer.jsx`
- [Learning dashboard](https://github.com/rajkumarceo/funtobots/blob/main/apps/web/src/components/dashboard/DashboardContainer.jsx): `apps/web/src/components/dashboard/DashboardContainer.jsx`

### Learning API

- [API router](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/server.js): `apps/api/src/server.js`
- [Chat controller](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/chat/chatController.js): `apps/api/src/modules/chat/chatController.js`
- [Kit entitlements](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/auth/entitlementController.js): `apps/api/src/modules/auth/entitlementController.js`
- [Mission catalog](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/missions/missionController.js): `apps/api/src/modules/missions/missionController.js`
- [Lab attempts](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/lab/labController.js): `apps/api/src/modules/lab/labController.js`
- [Analytics routes](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/modules/analytics/analyticsController.js): `apps/api/src/modules/analytics/analyticsController.js`

### Tutor intelligence

- [Kit knowledge base](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/ai/retrieval/knowledgeBase.js): `apps/api/src/ai/retrieval/knowledgeBase.js`
- [Socratic response](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/ai/prompts/funoGuidePrompt.js): `apps/api/src/ai/prompts/funoGuidePrompt.js`
- [LLM adapter](https://github.com/rajkumarceo/funtobots/blob/main/apps/api/src/ai/providers/llmAdapter.js): `apps/api/src/ai/providers/llmAdapter.js`

### Reusable learning packages

- [STEM simulations](https://github.com/rajkumarceo/funtobots/blob/main/packages/stem-simulations/index.jsx): `packages/stem-simulations/index.jsx`
- [Chatbot widget package](https://github.com/rajkumarceo/funtobots/blob/main/packages/chatbot-widget/index.js): `packages/chatbot-widget/index.js`
- [Shared schemas](https://github.com/rajkumarceo/funtobots/blob/main/packages/shared-schemas/index.js): `packages/shared-schemas/index.js`

### Other components

- **Learner**
- **ElevenLabs speech**

## Connections

- Learner → App shell: uses (evidence: `apps/web/src/App.jsx`)
- App shell → Learning context: reads state (evidence: `apps/web/src/App.jsx`)
- App shell → Chat experience: renders (evidence: `apps/web/src/App.jsx`)
- App shell → FunoGuide widget: renders (evidence: `apps/web/src/App.jsx`)
- App shell → Missions experience: renders (evidence: `apps/web/src/App.jsx`)
- App shell → STEM lab experience: renders (evidence: `apps/web/src/App.jsx`)
- App shell → Voice experience: renders (evidence: `apps/web/src/App.jsx`)
- App shell → Learning dashboard: renders (evidence: `apps/web/src/App.jsx`)
- API router → Chat controller: routes requests (evidence: `apps/api/src/server.js`)
- API router → Kit entitlements: routes requests (evidence: `apps/api/src/server.js`)
- API router → Mission catalog: routes requests (evidence: `apps/api/src/server.js`)
- API router → Lab attempts: routes requests (evidence: `apps/api/src/server.js`)
- API router → Analytics routes: routes requests (evidence: `apps/api/src/server.js`)
- Chat controller → Kit entitlements: checks access (evidence: `apps/api/src/modules/chat/chatController.js`)
- Kit entitlements → Kit knowledge base: validates kit IDs (evidence: `apps/api/src/modules/auth/entitlementController.js`)
- Chat controller → Kit knowledge base: retrieves knowledge (evidence: `apps/api/src/modules/chat/chatController.js`)
- Chat controller → Socratic response: generates answer (evidence: `apps/api/src/modules/chat/chatController.js`)
- Socratic response → Kit knowledge base: references kit knowledge (evidence: `apps/api/src/ai/prompts/funoGuidePrompt.js`)
- STEM lab experience → STEM simulations: uses simulations (evidence: `apps/web/src/components/stem-lab/LabContainer.jsx`)
- Voice experience → Chat controller: posts question (evidence: `apps/web/src/components/voice/VoiceContainer.jsx`)
- Voice experience → ElevenLabs speech: requests speech (evidence: `apps/web/src/components/voice/VoiceContainer.jsx`)
