# jin1ee-02/fiveguys architecture

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

- Interactive diagram: https://gitdiagram.com/jin1ee-02/fiveguys
- Repository: https://github.com/jin1ee-02/fiveguys

## Overview

KU래쪄용 is a two-person chat conflict-mediation app: participants create or join a room, exchange messages, and can review softened drafts, expressed-emotion and likely-reaction previews, then request a verdict and appeal. The Expo client keeps chat/session state and calls a FastAPI backend backed by SQLite. Backend analysis supports LLM and offline paths; verdicts use a separate debate-and-judging pipeline. README documents the major capabilities; some frontend and backend modules were not excerpted, so uncertain internal links are omitted.

Main entry points: [`backend/app/analysis.py`](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/analysis.py) (Message analysis), [`backend/app/provider.py`](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/provider.py) (Model provider), [`backend/app/main.py`](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/main.py) (FastAPI routes), [`backend/app/verdict.py`](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/verdict.py) (Debate and judgment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat client"]
  node_chat["Chat screens<br/>[ChatScreen.tsx]"]
  node_verdict_ui["Verdict screen<br/>[VerdictScreen.tsx]"]
  node_context["Chat session state<br/>[ChatContext.tsx]"]
  node_client_api["HTTP client<br/>[client.ts]"]
  node_feature_api["Feature API<br/>[features.ts]"]
  node_room_api["Room API<br/>[rooms.ts]"]
  node_draft_hook["Draft review<br/>[useDraftReview.ts]"]
  node_reaction_hook["Reaction preview"]
  node_types["Feature contracts<br/>[features.ts]"]
end

subgraph group_api["Backend API"]
  node_main["FastAPI routes<br/>[main.py]"]
  node_store[("Room and message store<br/>[store.py]")]
  node_schemas["Request and result schemas<br/>[schemas.py]"]
end

subgraph group_analysis["Message analysis"]
  node_analysis["Message analysis<br/>[analysis.py]"]
  node_hybrid["Hybrid analysis<br/>[hybrid.py]"]
  node_jev["JEV analysis<br/>[jev.py]"]
  node_offline["Offline rules<br/>[offline.py]"]
  node_scoring["Conflict scoring<br/>[scoring.py]"]
  node_promptset["Model prompts<br/>[prompts.py]"]
  node_provider["Model provider<br/>[provider.py]"]
  node_runtime["Model runtime controls<br/>[runtime.py]"]
end

subgraph group_verdict["Verdict pipeline"]
  node_verdict["Debate and judgment<br/>[verdict.py]"]
end

node_people(("Two participants"))
node_openai{{"OpenAI service"}}

node_people -->|"send messages"| node_chat
node_chat -->|"uses session"| node_context
node_verdict_ui -->|"uses session"| node_context
node_context -->|"delivers messages"| node_client_api
node_context -->|"manages rooms"| node_room_api
node_context -->|"requests emotion"| node_feature_api
node_chat -->|"reviews drafts"| node_draft_hook
node_chat -->|"previews reactions"| node_reaction_hook
node_draft_hook -->|"requests review"| node_feature_api
node_reaction_hook -->|"requests preview"| node_feature_api
node_client_api -->|"sends requests"| node_main
node_feature_api -->|"posts features"| node_client_api
node_room_api -->|"uses transport"| node_client_api
node_main -->|"routes analysis"| node_analysis
node_main -->|"reads and writes"| node_store
node_main -->|"runs verdicts"| node_verdict
node_main -->|"validates requests"| node_schemas
node_analysis -->|"requests model output"| node_provider
node_analysis -->|"uses offline path"| node_offline
node_analysis -->|"uses JEV path"| node_jev
node_analysis -->|"uses hybrid path"| node_hybrid
node_analysis -->|"uses contracts"| node_schemas
node_provider -->|"uses prompts"| node_promptset
node_provider -->|"uses controls"| node_runtime
node_provider -->|"produces structured output"| node_schemas
node_provider -->|"calls model"| node_openai
node_offline -->|"returns typed results"| node_schemas
node_store -->|"uses scoring"| node_scoring
node_verdict -->|"requests judgments"| node_provider
node_verdict -->|"uses verdict prompts"| node_promptset
node_verdict -->|"uses verdict contracts"| node_schemas
node_verdict -.->|"loads room snapshot"| node_store

click node_chat "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/screens/ChatScreen.tsx"
click node_verdict_ui "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/screens/VerdictScreen.tsx"
click node_context "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/state/ChatContext.tsx"
click node_client_api "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/api/client.ts"
click node_feature_api "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/api/features.ts"
click node_room_api "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/api/rooms.ts"
click node_draft_hook "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/hooks/useDraftReview.ts"
click node_reaction_hook "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/hooks/useReactionPreview.ts"
click node_main "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/main.py"
click node_store "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/store.py"
click node_schemas "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/schemas.py"
click node_analysis "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/analysis.py"
click node_hybrid "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/hybrid.py"
click node_jev "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/jev.py"
click node_offline "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/offline.py"
click node_scoring "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/scoring.py"
click node_promptset "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/prompts.py"
click node_provider "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/provider.py"
click node_runtime "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/runtime.py"
click node_verdict "https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/verdict.py"
click node_types "https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/types/features.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_chat,node_verdict_ui,node_context,node_client_api,node_feature_api,node_room_api,node_draft_hook,node_reaction_hook,node_types toneBlue
class node_main,node_store,node_schemas toneAmber
class node_analysis,node_hybrid,node_jev,node_offline,node_scoring,node_promptset,node_provider,node_runtime toneMint
class node_verdict toneRose
class node_people,node_openai toneIndigo
```

## Components

### Chat client

- [Chat screens](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/screens/ChatScreen.tsx): `frontend/src/screens/ChatScreen.tsx`
- [Verdict screen](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/screens/VerdictScreen.tsx): `frontend/src/screens/VerdictScreen.tsx`
- [Chat session state](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/state/ChatContext.tsx): `frontend/src/state/ChatContext.tsx`
- [HTTP client](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Feature API](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/api/features.ts): `frontend/src/api/features.ts`
- [Room API](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/api/rooms.ts): `frontend/src/api/rooms.ts`
- [Draft review](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/hooks/useDraftReview.ts): `frontend/src/hooks/useDraftReview.ts`
- [Reaction preview](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/hooks/useReactionPreview.ts): `frontend/src/hooks/useReactionPreview.ts`
- [Feature contracts](https://github.com/jin1ee-02/fiveguys/blob/main/frontend/src/types/features.ts): `frontend/src/types/features.ts`

### Backend API

- [FastAPI routes](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/main.py): `backend/app/main.py`
- [Room and message store](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/store.py): `backend/app/store.py`
- [Request and result schemas](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/schemas.py): `backend/app/schemas.py`

### Message analysis

- [Message analysis](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/analysis.py): `backend/app/analysis.py`
- [Hybrid analysis](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/hybrid.py): `backend/app/hybrid.py`
- [JEV analysis](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/jev.py): `backend/app/jev.py`
- [Offline rules](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/offline.py): `backend/app/offline.py`
- [Conflict scoring](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/scoring.py): `backend/app/scoring.py`
- [Model prompts](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/prompts.py): `backend/app/prompts.py`
- [Model provider](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/provider.py): `backend/app/provider.py`
- [Model runtime controls](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/runtime.py): `backend/app/runtime.py`

### Verdict pipeline

- [Debate and judgment](https://github.com/jin1ee-02/fiveguys/blob/main/backend/app/verdict.py): `backend/app/verdict.py`

### Other components

- **Two participants**
- **OpenAI service**

## Connections

- Two participants → Chat screens: send messages (evidence: `README.md`)
- Chat screens → Chat session state: uses session (evidence: `frontend/src/screens/ChatScreen.tsx`)
- Verdict screen → Chat session state: uses session (evidence: `frontend/src/screens/VerdictScreen.tsx`)
- Chat session state → HTTP client: delivers messages (evidence: `frontend/src/state/ChatContext.tsx`)
- Chat session state → Room API: manages rooms (evidence: `frontend/src/state/ChatContext.tsx`)
- Chat session state → Feature API: requests emotion (evidence: `frontend/src/state/ChatContext.tsx`)
- Chat screens → Draft review: reviews drafts (evidence: `frontend/src/screens/ChatScreen.tsx`)
- Chat screens → Reaction preview: previews reactions (evidence: `frontend/src/screens/ChatScreen.tsx`)
- Draft review → Feature API: requests review (evidence: `frontend/src/hooks/useDraftReview.ts`)
- Reaction preview → Feature API: requests preview (evidence: `frontend/src/hooks/useReactionPreview.ts`)
- HTTP client → FastAPI routes: sends requests (evidence: `frontend/src/api/client.ts`)
- Feature API → HTTP client: posts features (evidence: `frontend/src/api/features.ts`)
- Room API → HTTP client: uses transport (evidence: `frontend/src/api/rooms.ts`)
- FastAPI routes → Message analysis: routes analysis (evidence: `backend/app/main.py`)
- FastAPI routes → Room and message store: reads and writes (evidence: `backend/app/main.py`)
- FastAPI routes → Debate and judgment: runs verdicts (evidence: `backend/app/main.py`)
- FastAPI routes → Request and result schemas: validates requests (evidence: `backend/app/main.py`)
- Message analysis → Model provider: requests model output (evidence: `backend/app/analysis.py`)
- Message analysis → Offline rules: uses offline path (evidence: `backend/app/analysis.py`)
- Message analysis → JEV analysis: uses JEV path (evidence: `backend/app/analysis.py`)
- Message analysis → Hybrid analysis: uses hybrid path (evidence: `backend/app/analysis.py`)
- Message analysis → Request and result schemas: uses contracts (evidence: `backend/app/analysis.py`)
- Model provider → Model prompts: uses prompts (evidence: `backend/app/provider.py`)
- Model provider → Model runtime controls: uses controls (evidence: `backend/app/provider.py`)
- Model provider → Request and result schemas: produces structured output (evidence: `backend/app/provider.py`)
- Model provider → OpenAI service: calls model (evidence: `backend/app/provider.py`)
- Offline rules → Request and result schemas: returns typed results (evidence: `backend/app/offline.py`)
- Room and message store → Conflict scoring: uses scoring (evidence: `backend/app/store.py`)
- Debate and judgment → Model provider: requests judgments (evidence: `backend/app/verdict.py`)
- Debate and judgment → Model prompts: uses verdict prompts (evidence: `backend/app/verdict.py`)
- Debate and judgment → Request and result schemas: uses verdict contracts (evidence: `backend/app/verdict.py`)
- Debate and judgment → Room and message store: loads room snapshot
