# kairyu1207/sokdaksokdak architecture

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

- Interactive diagram: https://gitdiagram.com/kairyu1207/sokdaksokdak
- Repository: https://github.com/kairyu1207/sokdaksokdak

## Overview

SokdakSokdak is a student mental-wellbeing web app for student/teacher access, supportive chat, and teacher-facing analysis of chat history. Students log in, chat with an AI, and can view teacher messages and daily goals; teachers log in to view students, save notes/goals, and request an analysis. The graph reflects sampled routes and client code; template contents were not sampled, so chat-page submission wiring and other page behavior are not assumed.

Main entry points: [`static/script.js`](https://github.com/kairyu1207/sokdaksokdak/blob/main/static/script.js) (Client interactions), [`main.py`](https://github.com/kairyu1207/sokdaksokdak/blob/main/main.py) (Chat endpoint), [`firebase_config.py`](https://github.com/kairyu1207/sokdaksokdak/blob/main/firebase_config.py) (Server Firebase client), [`templates/teacher.html`](https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/teacher.html) (Teacher page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_client["Client interactions<br/>[script.js]"]
  node_home["Home page<br/>[index.html]"]
end

subgraph group_identity["Login and roles"]
  node_login["Login page<br/>[login.html]"]
  node_firebase[("Firebase database")]
  node_firebase_setup["Server Firebase client<br/>[firebase_config.py]"]
end

subgraph group_support["Student support"]
  node_student_page["Student page<br/>[student.html]"]
  node_chat_page["Chat page<br/>[chat.html]"]
  node_chat_service["Chat endpoint<br/>[main.py]"]
  node_history["Chat history<br/>[main.py]"]
  node_openai{{"OpenAI API"}}
end

subgraph group_analysis["Teacher analysis"]
  node_teacher_page["Teacher page<br/>[teacher.html]"]
  node_analysis_service["Analysis endpoint<br/>[main.py]"]
end

node_student(("Student"))
node_teacher(("Teacher"))

node_student -->|"opens"| node_home
node_teacher -->|"opens"| node_home
node_client -->|"navigates to"| node_login
node_client -->|"reads credentials"| node_firebase
node_client -->|"navigates to"| node_student_page
node_client -->|"navigates to"| node_teacher_page
node_client -->|"reads class data"| node_firebase
node_client -->|"writes notes and goals"| node_firebase
node_client -->|"reads notes and goals"| node_firebase
node_client -->|"requests results"| node_analysis_service
node_student -->|"submits message"| node_chat_service
node_chat_service -->|"uses database"| node_firebase_setup
node_firebase_setup -->|"connects to"| node_firebase
node_chat_service -->|"requests reply"| node_openai
node_chat_service -->|"saves exchange"| node_history
node_history -->|"writes history"| node_firebase
node_teacher -->|"uses"| node_teacher_page
node_analysis_service -->|"loads history"| node_firebase_setup
node_analysis_service -->|"requests analysis"| node_openai
node_teacher_page -->|"requests analysis"| node_analysis_service

click node_client "https://github.com/kairyu1207/sokdaksokdak/blob/main/static/script.js"
click node_home "https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/index.html"
click node_login "https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/login.html"
click node_student_page "https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/student.html"
click node_chat_page "https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/chat.html"
click node_teacher_page "https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/teacher.html"
click node_firebase_setup "https://github.com/kairyu1207/sokdaksokdak/blob/main/firebase_config.py"
click node_chat_service "https://github.com/kairyu1207/sokdaksokdak/blob/main/main.py"
click node_history "https://github.com/kairyu1207/sokdaksokdak/blob/main/main.py"
click node_analysis_service "https://github.com/kairyu1207/sokdaksokdak/blob/main/main.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_client,node_home toneBlue
class node_login,node_firebase,node_firebase_setup toneAmber
class node_student_page,node_chat_page,node_chat_service,node_history,node_openai toneMint
class node_teacher_page,node_analysis_service toneRose
class node_student,node_teacher toneIndigo
```

## Components

### Web interface

- [Client interactions](https://github.com/kairyu1207/sokdaksokdak/blob/main/static/script.js): `static/script.js`
- [Home page](https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/index.html): `templates/index.html`

### Login and roles

- [Login page](https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/login.html): `templates/login.html`
- **Firebase database**
- [Server Firebase client](https://github.com/kairyu1207/sokdaksokdak/blob/main/firebase_config.py): `firebase_config.py`

### Student support

- [Student page](https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/student.html): `templates/student.html`
- [Chat page](https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/chat.html): `templates/chat.html`
- [Chat endpoint](https://github.com/kairyu1207/sokdaksokdak/blob/main/main.py): `main.py`
- [Chat history](https://github.com/kairyu1207/sokdaksokdak/blob/main/main.py): `main.py`
- **OpenAI API**

### Teacher analysis

- [Teacher page](https://github.com/kairyu1207/sokdaksokdak/blob/main/templates/teacher.html): `templates/teacher.html`
- [Analysis endpoint](https://github.com/kairyu1207/sokdaksokdak/blob/main/main.py): `main.py`

### Other components

- **Student**
- **Teacher**

## Connections

- Student → Home page: opens
- Teacher → Home page: opens
- Client interactions → Login page: navigates to (evidence: `static/script.js`)
- Client interactions → Firebase database: reads credentials (evidence: `static/script.js`)
- Client interactions → Student page: navigates to (evidence: `static/script.js`)
- Client interactions → Teacher page: navigates to (evidence: `static/script.js`)
- Client interactions → Firebase database: reads class data (evidence: `static/script.js`)
- Client interactions → Firebase database: writes notes and goals (evidence: `static/script.js`)
- Client interactions → Firebase database: reads notes and goals (evidence: `static/script.js`)
- Client interactions → Analysis endpoint: requests results (evidence: `static/script.js`)
- Student → Chat endpoint: submits message (evidence: `main.py`)
- Chat endpoint → Server Firebase client: uses database (evidence: `main.py`)
- Server Firebase client → Firebase database: connects to (evidence: `firebase_config.py`)
- Chat endpoint → OpenAI API: requests reply (evidence: `main.py`)
- Chat endpoint → Chat history: saves exchange (evidence: `main.py`)
- Chat history → Firebase database: writes history (evidence: `main.py`)
- Teacher → Teacher page: uses
- Analysis endpoint → Server Firebase client: loads history (evidence: `main.py`)
- Analysis endpoint → OpenAI API: requests analysis (evidence: `main.py`)
- Teacher page → Analysis endpoint: requests analysis
