# siddrwt/one-front-door architecture

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

- Interactive diagram: https://gitdiagram.com/siddrwt/one-front-door
- Repository: https://github.com/siddrwt/one-front-door

## Overview

One Front Door is a student-facing campus assistant: students authenticate, submit single- or multi-domain questions, and receive routed answers with explanations or an escalation ticket. The frontend sends chat requests through the Express backend, which applies conversation context and student-specific grounding before invoking the AI routing service; conversations and turns are stored in MongoDB. The README documents ONNX classification, citations, guardrails, ticketing, feedback, and ticket history. Some implementation files were not sampled, so links for those documented capabilities are limited to README evidence.

Main entry points: [`backend/src/controllers/chatController.js`](https://github.com/siddrwt/one-front-door/blob/main/backend/src/controllers/chatController.js) (Chat orchestration), [`frontend/src/pages/ChatPage.jsx`](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/pages/ChatPage.jsx) (Chat workspace), [`backend/src/services/aiService.js`](https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/aiService.js) (AI adapter), [`frontend/src/services/api.js`](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/services/api.js) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_student_portal["Student portal"]
  node_login["Login and identity<br/>[AuthContext.jsx]"]
  node_auth_client["Auth API client<br/>[authService.js]"]
  node_chat_ui["Chat workspace<br/>[ChatPage.jsx]"]
  node_chat_state["Chat state<br/>[ChatContext.jsx]"]
  node_chat_client["Chat API client<br/>[chatService.js]"]
  node_http_client["HTTP client<br/>[api.js]"]
  node_ticket_history["Ticket history<br/>[TicketsPage.jsx]"]
end

subgraph group_backend["Backend services"]
  node_backend_app["Express API<br/>[app.js]"]
  node_chat_routes["Chat routes<br/>[chat.js]"]
  node_chat_controller["Chat orchestration<br/>[chatController.js]"]
  node_conversation_context["Conversation context"]
  node_student_context["Student grounding"]
  node_ai_adapter["AI adapter<br/>[aiService.js]"]
  node_domain_map["Domain mapping<br/>[domains.js]"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_auth_controller["Auth controller<br/>[authController.js]"]
end

subgraph group_ai_routing["AI routing"]
  node_ai_service["AI routing service<br/>[app.py]"]
  node_classifier["ONNX classifier<br/>[app.py]"]
end

subgraph group_state_support["State and support"]
  node_conversation_models["Conversation and turn records<br/>[Conversation.js]"]
  node_student_model["Student records<br/>[User.js]"]
  node_ticket_service["Escalation ticketing<br/>[ticketService.js]"]
  node_mongodb[("MongoDB")]
end

node_student(("Student"))

node_student -->|"signs in"| node_login
node_login -->|"calls"| node_auth_client
node_auth_client -->|"sends requests"| node_http_client
node_student -->|"asks questions"| node_chat_ui
node_chat_ui -->|"submits messages"| node_chat_state
node_chat_state -->|"sends chat"| node_chat_client
node_chat_client -->|"uses"| node_http_client
node_http_client -->|"HTTP JSON"| node_backend_app
node_backend_app -->|"mounts"| node_chat_routes
node_chat_routes -->|"routes to"| node_chat_controller
node_chat_controller -->|"builds context"| node_conversation_context
node_chat_controller -->|"retrieves record"| node_student_context
node_chat_controller -->|"calls pipeline"| node_ai_adapter
node_chat_controller -->|"creates ticket"| node_ticket_service
node_chat_controller -->|"stores turns"| node_conversation_models
node_conversation_context -->|"reads and updates"| node_conversation_models
node_student_context -->|"reads student"| node_student_model
node_ai_adapter -->|"HTTP inference"| node_ai_service
node_ai_service -->|"classifies intents"| node_classifier
node_ai_adapter -->|"maps labels"| node_domain_map
node_ticket_service -->|"persists tickets"| node_mongodb
node_conversation_models -->|"persists records"| node_mongodb
node_student_model -->|"stores student data"| node_mongodb
node_chat_ui -.->|"views ticket history"| node_ticket_history

click node_login "https://github.com/siddrwt/one-front-door/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_client "https://github.com/siddrwt/one-front-door/blob/main/frontend/src/services/authService.js"
click node_chat_ui "https://github.com/siddrwt/one-front-door/blob/main/frontend/src/pages/ChatPage.jsx"
click node_chat_state "https://github.com/siddrwt/one-front-door/blob/main/frontend/src/context/ChatContext.jsx"
click node_chat_client "https://github.com/siddrwt/one-front-door/blob/main/frontend/src/services/chatService.js"
click node_http_client "https://github.com/siddrwt/one-front-door/blob/main/frontend/src/services/api.js"
click node_backend_app "https://github.com/siddrwt/one-front-door/blob/main/backend/src/app.js"
click node_chat_routes "https://github.com/siddrwt/one-front-door/blob/main/backend/src/routes/chat.js"
click node_chat_controller "https://github.com/siddrwt/one-front-door/blob/main/backend/src/controllers/chatController.js"
click node_conversation_context "https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/conversationContextService.js"
click node_student_context "https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/studentContextService.js"
click node_ai_adapter "https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/aiService.js"
click node_domain_map "https://github.com/siddrwt/one-front-door/blob/main/backend/src/config/domains.js"
click node_auth_routes "https://github.com/siddrwt/one-front-door/blob/main/backend/src/routes/auth.js"
click node_auth_controller "https://github.com/siddrwt/one-front-door/blob/main/backend/src/controllers/authController.js"
click node_ai_service "https://github.com/siddrwt/one-front-door/blob/main/ai_service/app.py"
click node_classifier "https://github.com/siddrwt/one-front-door/blob/main/ai_service/app.py"
click node_conversation_models "https://github.com/siddrwt/one-front-door/blob/main/backend/src/models/Conversation.js"
click node_student_model "https://github.com/siddrwt/one-front-door/blob/main/backend/src/models/User.js"
click node_ticket_service "https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/ticketService.js"
click node_ticket_history "https://github.com/siddrwt/one-front-door/blob/main/frontend/src/pages/TicketsPage.jsx"

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_login,node_auth_client,node_chat_ui,node_chat_state,node_chat_client,node_http_client,node_ticket_history toneBlue
class node_backend_app,node_chat_routes,node_chat_controller,node_conversation_context,node_student_context,node_ai_adapter,node_domain_map,node_auth_routes,node_auth_controller toneAmber
class node_ai_service,node_classifier toneMint
class node_conversation_models,node_student_model,node_ticket_service,node_mongodb toneRose
class node_student toneIndigo
```

## Components

### Student portal

- [Login and identity](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auth API client](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/services/authService.js): `frontend/src/services/authService.js`
- [Chat workspace](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/pages/ChatPage.jsx): `frontend/src/pages/ChatPage.jsx`
- [Chat state](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/context/ChatContext.jsx): `frontend/src/context/ChatContext.jsx`
- [Chat API client](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/services/chatService.js): `frontend/src/services/chatService.js`
- [HTTP client](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Ticket history](https://github.com/siddrwt/one-front-door/blob/main/frontend/src/pages/TicketsPage.jsx): `frontend/src/pages/TicketsPage.jsx`

### Backend services

- [Express API](https://github.com/siddrwt/one-front-door/blob/main/backend/src/app.js): `backend/src/app.js`
- [Chat routes](https://github.com/siddrwt/one-front-door/blob/main/backend/src/routes/chat.js): `backend/src/routes/chat.js`
- [Chat orchestration](https://github.com/siddrwt/one-front-door/blob/main/backend/src/controllers/chatController.js): `backend/src/controllers/chatController.js`
- [Conversation context](https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/conversationContextService.js): `backend/src/services/conversationContextService.js`
- [Student grounding](https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/studentContextService.js): `backend/src/services/studentContextService.js`
- [AI adapter](https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/aiService.js): `backend/src/services/aiService.js`
- [Domain mapping](https://github.com/siddrwt/one-front-door/blob/main/backend/src/config/domains.js): `backend/src/config/domains.js`
- [Auth routes](https://github.com/siddrwt/one-front-door/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Auth controller](https://github.com/siddrwt/one-front-door/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`

### AI routing

- [AI routing service](https://github.com/siddrwt/one-front-door/blob/main/ai_service/app.py): `ai_service/app.py`
- [ONNX classifier](https://github.com/siddrwt/one-front-door/blob/main/ai_service/app.py): `ai_service/app.py`

### State and support

- [Conversation and turn records](https://github.com/siddrwt/one-front-door/blob/main/backend/src/models/Conversation.js): `backend/src/models/Conversation.js`
- [Student records](https://github.com/siddrwt/one-front-door/blob/main/backend/src/models/User.js): `backend/src/models/User.js`
- [Escalation ticketing](https://github.com/siddrwt/one-front-door/blob/main/backend/src/services/ticketService.js): `backend/src/services/ticketService.js`
- **MongoDB**

### Other components

- **Student**

## Connections

- Student → Login and identity: signs in
- Login and identity → Auth API client: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- Auth API client → HTTP client: sends requests (evidence: `frontend/src/services/authService.js`)
- Student → Chat workspace: asks questions (evidence: `README.md`)
- Chat workspace → Chat state: submits messages (evidence: `frontend/src/pages/ChatPage.jsx`)
- Chat state → Chat API client: sends chat (evidence: `frontend/src/context/ChatContext.jsx`)
- Chat API client → HTTP client: uses (evidence: `frontend/src/services/chatService.js`)
- HTTP client → Express API: HTTP JSON (evidence: `README.md`)
- Express API → Chat routes: mounts (evidence: `backend/src/app.js`)
- Chat routes → Chat orchestration: routes to (evidence: `backend/src/routes/chat.js`)
- Chat orchestration → Conversation context: builds context (evidence: `backend/src/controllers/chatController.js`)
- Chat orchestration → Student grounding: retrieves record (evidence: `backend/src/controllers/chatController.js`)
- Chat orchestration → AI adapter: calls pipeline (evidence: `backend/src/controllers/chatController.js`)
- Chat orchestration → Escalation ticketing: creates ticket (evidence: `backend/src/controllers/chatController.js`)
- Chat orchestration → Conversation and turn records: stores turns (evidence: `backend/src/controllers/chatController.js`)
- Conversation context → Conversation and turn records: reads and updates (evidence: `backend/src/services/conversationContextService.js`)
- Student grounding → Student records: reads student (evidence: `backend/src/services/studentContextService.js`)
- AI adapter → AI routing service: HTTP inference (evidence: `README.md`)
- AI routing service → ONNX classifier: classifies intents (evidence: `README.md`)
- AI adapter → Domain mapping: maps labels (evidence: `backend/src/services/aiService.js`)
- Escalation ticketing → MongoDB: persists tickets (evidence: `README.md`)
- Conversation and turn records → MongoDB: persists records (evidence: `README.md`)
- Student records → MongoDB: stores student data (evidence: `README.md`)
- Chat workspace → Ticket history: views ticket history (evidence: `README.md`)
