# energyshifter8/survey-filling-site architecture

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

- Interactive diagram: https://gitdiagram.com/energyshifter8/survey-filling-site
- Repository: https://github.com/energyshifter8/survey-filling-site

## Overview

This is a Mongolian-language survey and invitation-based talent-assessment frontend. Participants enter a survey or talent invitation, review consent and any required setup, answer questions or assessment sections, and submit their responses. Survey and recruitment flows use separate hooks and API modules; browser session storage preserves survey progress and recruitment state. The graph reflects documented imports and the sampled calls; some assessment details and tracking behavior are unsampled, so their relationships are not inferred.

Main entry points: [`src/app/talent/[token]/page.tsx`](https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/talent/%5Btoken%5D/page.tsx) (Talent invitation), [`src/app/s/[shortUrl]/page.tsx`](https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/s/%5BshortUrl%5D/page.tsx) (Survey landing), [`src/app/s/[shortUrl]/questions/page.tsx`](https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/s/%5BshortUrl%5D/questions/page.tsx) (Survey questions), [`src/lib/use-survey.ts`](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/use-survey.ts) (Survey workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_survey["Survey experience"]
  node_survey_entry["Survey landing<br/>[page.tsx]"]
  node_survey_questions["Survey questions<br/>[page.tsx]"]
  node_survey_completion["Survey completion<br/>[page.tsx]"]
  node_question_field["Question fields<br/>[QuestionField.tsx]"]
  node_survey_flow_legacy["Survey flow<br/>[SurveyFlow.jsx]"]
end

subgraph group_talent["Talent assessment"]
  node_talent_entry["Talent invitation<br/>[page.tsx]"]
  node_talent_fullscreen["Fullscreen controls"]
  node_talent_screens["Talent status screens<br/>[TalentScreens.tsx]"]
  node_recruitment_flow_legacy["Recruitment flow"]
  node_talent_tracking["Talent tracking<br/>[talent-tracking.ts]"]
end

subgraph group_shared["Shared interface"]
  node_consent["Consent modal<br/>[ConsentModal.tsx]"]
  node_font_toggle["Font-size toggle<br/>[FontSizeToggle.tsx]"]
  node_font_context["Font-size state"]
end

subgraph group_backend["API and state"]
  node_survey_hook["Survey workflow<br/>[use-survey.ts]"]
  node_recruitment_hook["Recruitment workflow<br/>[use-recruitment.ts]"]
  node_survey_api["Survey API<br/>[survey.ts]"]
  node_recruitment_api["Recruitment API<br/>[recruitment.ts]"]
  node_api_client["Fetch client<br/>[client.ts]"]
  node_survey_state["Survey session state<br/>[survey-session.ts]"]
  node_recruitment_state["Recruitment session state"]
  node_browser_storage[("Browser session storage")]
end

node_participant(("Participant"))
node_survey_service{{"Survey backend"}}
node_recruitment_service{{"Recruitment backend"}}

node_participant -->|"opens survey"| node_survey_entry
node_survey_entry -->|"requests consent"| node_consent
node_survey_entry -->|"starts session"| node_survey_hook
node_survey_entry -->|"routes to"| node_survey_questions
node_survey_questions -->|"loads and submits"| node_survey_hook
node_survey_questions -->|"renders"| node_question_field
node_survey_questions -->|"uses progress"| node_survey_state
node_survey_completion -->|"submits completion"| node_survey_api
node_survey_hook -->|"calls"| node_survey_api
node_survey_hook -->|"persists session"| node_survey_state
node_survey_api -->|"sends requests"| node_api_client
node_api_client -.->|"HTTP requests"| node_survey_service
node_survey_state -->|"reads and writes"| node_browser_storage
node_participant -->|"opens invitation"| node_talent_entry
node_talent_entry -->|"requests consent"| node_consent
node_talent_entry -->|"controls fullscreen"| node_talent_fullscreen
node_talent_entry -->|"renders status"| node_talent_screens
node_talent_entry -->|"loads invitation"| node_recruitment_hook
node_recruitment_hook -->|"calls"| node_recruitment_api
node_recruitment_hook -->|"persists state"| node_recruitment_state
node_recruitment_api -->|"sends requests"| node_api_client
node_api_client -.->|"HTTP requests"| node_recruitment_service
node_recruitment_state -.->|"reads and writes"| node_browser_storage
node_survey_flow_legacy -.->|"uses client"| node_survey_service
node_recruitment_flow_legacy -.->|"uses client"| node_recruitment_service
node_font_toggle -->|"reads and updates"| node_font_context

click node_survey_entry "https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/s/%5BshortUrl%5D/page.tsx"
click node_survey_questions "https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/s/%5BshortUrl%5D/questions/page.tsx"
click node_survey_completion "https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/s/%5BshortUrl%5D/end/page.tsx"
click node_question_field "https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/QuestionField.tsx"
click node_survey_flow_legacy "https://github.com/energyshifter8/survey-filling-site/blob/master/SurveyFlow.jsx"
click node_talent_entry "https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/talent/%5Btoken%5D/page.tsx"
click node_talent_fullscreen "https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/TalentFullscreen.tsx"
click node_talent_screens "https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/TalentScreens.tsx"
click node_recruitment_flow_legacy "https://github.com/energyshifter8/survey-filling-site/blob/master/RecruitmentTestFlow.jsx"
click node_talent_tracking "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/talent-tracking.ts"
click node_consent "https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/ConsentModal.tsx"
click node_font_toggle "https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/FontSizeToggle.tsx"
click node_font_context "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/font-size-context.tsx"
click node_survey_hook "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/use-survey.ts"
click node_recruitment_hook "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/use-recruitment.ts"
click node_survey_api "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/api/survey.ts"
click node_recruitment_api "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/api/recruitment.ts"
click node_api_client "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/api/client.ts"
click node_survey_state "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/survey-session.ts"
click node_recruitment_state "https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/recruitment-session.ts"

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_survey_entry,node_survey_questions,node_survey_completion,node_question_field,node_survey_flow_legacy toneBlue
class node_talent_entry,node_talent_fullscreen,node_talent_screens,node_recruitment_flow_legacy,node_talent_tracking toneAmber
class node_consent,node_font_toggle,node_font_context toneMint
class node_survey_hook,node_recruitment_hook,node_survey_api,node_recruitment_api,node_api_client,node_survey_state,node_recruitment_state,node_browser_storage toneRose
class node_participant,node_survey_service,node_recruitment_service toneIndigo
```

## Components

### Survey experience

- [Survey landing](https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/s/%5BshortUrl%5D/page.tsx): `src/app/s/[shortUrl]/page.tsx`
- [Survey questions](https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/s/%5BshortUrl%5D/questions/page.tsx): `src/app/s/[shortUrl]/questions/page.tsx`
- [Survey completion](https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/s/%5BshortUrl%5D/end/page.tsx): `src/app/s/[shortUrl]/end/page.tsx`
- [Question fields](https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/QuestionField.tsx): `src/components/QuestionField.tsx`
- [Survey flow](https://github.com/energyshifter8/survey-filling-site/blob/master/SurveyFlow.jsx): `SurveyFlow.jsx`

### Talent assessment

- [Talent invitation](https://github.com/energyshifter8/survey-filling-site/blob/master/src/app/talent/%5Btoken%5D/page.tsx): `src/app/talent/[token]/page.tsx`
- [Fullscreen controls](https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/TalentFullscreen.tsx): `src/components/TalentFullscreen.tsx`
- [Talent status screens](https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/TalentScreens.tsx): `src/components/TalentScreens.tsx`
- [Recruitment flow](https://github.com/energyshifter8/survey-filling-site/blob/master/RecruitmentTestFlow.jsx): `RecruitmentTestFlow.jsx`
- [Talent tracking](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/talent-tracking.ts): `src/lib/talent-tracking.ts`

### Shared interface

- [Consent modal](https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/ConsentModal.tsx): `src/components/ConsentModal.tsx`
- [Font-size toggle](https://github.com/energyshifter8/survey-filling-site/blob/master/src/components/FontSizeToggle.tsx): `src/components/FontSizeToggle.tsx`
- [Font-size state](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/font-size-context.tsx): `src/lib/font-size-context.tsx`

### API and state

- [Survey workflow](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/use-survey.ts): `src/lib/use-survey.ts`
- [Recruitment workflow](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/use-recruitment.ts): `src/lib/use-recruitment.ts`
- [Survey API](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/api/survey.ts): `src/lib/api/survey.ts`
- [Recruitment API](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/api/recruitment.ts): `src/lib/api/recruitment.ts`
- [Fetch client](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/api/client.ts): `src/lib/api/client.ts`
- [Survey session state](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/survey-session.ts): `src/lib/survey-session.ts`
- [Recruitment session state](https://github.com/energyshifter8/survey-filling-site/blob/master/src/lib/recruitment-session.ts): `src/lib/recruitment-session.ts`
- **Browser session storage**

### Other components

- **Participant**
- **Survey backend**
- **Recruitment backend**

## Connections

- Participant → Survey landing: opens survey (evidence: `src/app/s/[shortUrl]/page.tsx`)
- Survey landing → Consent modal: requests consent (evidence: `src/app/s/[shortUrl]/page.tsx`)
- Survey landing → Survey workflow: starts session (evidence: `src/app/s/[shortUrl]/page.tsx`)
- Survey landing → Survey questions: routes to (evidence: `src/app/s/[shortUrl]/page.tsx`)
- Survey questions → Survey workflow: loads and submits (evidence: `src/app/s/[shortUrl]/questions/page.tsx`)
- Survey questions → Question fields: renders (evidence: `src/app/s/[shortUrl]/questions/page.tsx`)
- Survey questions → Survey session state: uses progress (evidence: `src/app/s/[shortUrl]/questions/page.tsx`)
- Survey completion → Survey API: submits completion (evidence: `src/app/s/[shortUrl]/end/page.tsx`)
- Survey workflow → Survey API: calls (evidence: `src/lib/use-survey.ts`)
- Survey workflow → Survey session state: persists session (evidence: `src/lib/use-survey.ts`)
- Survey API → Fetch client: sends requests (evidence: `src/lib/api/survey.ts`)
- Fetch client → Survey backend: HTTP requests
- Survey session state → Browser session storage: reads and writes (evidence: `src/lib/survey-session.ts`)
- Participant → Talent invitation: opens invitation (evidence: `src/app/talent/[token]/page.tsx`)
- Talent invitation → Consent modal: requests consent (evidence: `src/app/talent/[token]/page.tsx`)
- Talent invitation → Fullscreen controls: controls fullscreen (evidence: `src/app/talent/[token]/page.tsx`)
- Talent invitation → Talent status screens: renders status (evidence: `src/app/talent/[token]/page.tsx`)
- Talent invitation → Recruitment workflow: loads invitation (evidence: `src/app/talent/[token]/page.tsx`)
- Recruitment workflow → Recruitment API: calls (evidence: `src/lib/use-recruitment.ts`)
- Recruitment workflow → Recruitment session state: persists state (evidence: `src/lib/use-recruitment.ts`)
- Recruitment API → Fetch client: sends requests (evidence: `src/lib/api/recruitment.ts`)
- Fetch client → Recruitment backend: HTTP requests
- Recruitment session state → Browser session storage: reads and writes
- Survey flow → Survey backend: uses client
- Recruitment flow → Recruitment backend: uses client
- Font-size toggle → Font-size state: reads and updates (evidence: `src/components/FontSizeToggle.tsx`)
