# kakaotechcampus-4/ktc4-pusan-5 architecture

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

- Interactive diagram: https://gitdiagram.com/kakaotechcampus-4/ktc4-pusan-5
- Repository: https://github.com/kakaotechcampus-4/ktc4-pusan-5

## Overview

This repository implements a Korean-market stock research and briefing product: a React client presents market, stock, concept, watchlist and account views; a FastAPI backend serves data and user operations; separate collectors gather market and news data. The AI package adds analyst-report and Telegram ingestion, report summarization, and stock-move analysis storage. The README documents the main collection jobs and their external data sources. Several feature paths are supported by the tree and README, but their internal calls were not sampled, so those links are omitted rather than inferred.

Main entry points: [`backend/app/main.py`](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/main.py) (HTTP application), [`frontend/src/App.tsx`](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/App.tsx) (Web application), [`backend/app/collectors/market.py`](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/collectors/market.py) (Market collector), [`backend/app/routers/market.py`](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/market.py) (Market endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_home["Market home<br/>[HomePage.tsx]"]
  node_stocks_ui["Stock briefing"]
  node_concept_ui["Concept learning<br/>[ConceptPage.tsx]"]
  node_account_ui["Account and watchlist<br/>[MyPage.tsx]"]
end

subgraph group_api["Backend API"]
  node_api_app["HTTP application<br/>[main.py]"]
  node_auth["Kakao authentication<br/>[auth.py]"]
  node_market_routes["Market endpoints<br/>[market.py]"]
  node_stock_routes["Stock endpoints<br/>[stocks.py]"]
  node_concept_routes["Concept endpoints<br/>[concepts.py]"]
  node_watchlist_routes["Watchlist endpoints<br/>[watchlist.py]"]
end

subgraph group_collection["Market collection"]
  node_market_collect["Market collector<br/>[market.py]"]
  node_stock_collect["Stock collector<br/>[stocks.py]"]
  node_news_collect["News collector<br/>[news.py]"]
end

subgraph group_ai["AI research"]
  node_analyst_collect["Analyst and Telegram ingestion<br/>[telegram.py]"]
  node_news_link["News link processing"]
  node_llm["LLM summaries<br/>[client.py]"]
end

subgraph group_state["Persistence"]
  node_ai_reports[("Analyst reports<br/>[analyst_report.py]")]
  node_move_analysis[("Stock-move analyses")]
  node_backend_db[("Backend data store<br/>[database.py]")]
  node_market_repo["Market repositories<br/>[market.py]"]
  node_ranking_repo["Ranking repositories<br/>[ranking.py]"]
  node_user_repo["User repository<br/>[user.py]"]
end

node_user(("Investor"))
node_external_data{{"Market data providers"}}

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_home
node_webapp -->|"routes to"| node_stocks_ui
node_webapp -->|"routes to"| node_concept_ui
node_webapp -->|"routes to"| node_account_ui
node_api_app -->|"registers"| node_auth
node_api_app -->|"registers"| node_market_routes
node_api_app -->|"registers"| node_stock_routes
node_api_app -->|"registers"| node_concept_routes
node_api_app -->|"registers"| node_watchlist_routes
node_auth -->|"gets or creates"| node_user_repo
node_market_routes -->|"queries"| node_market_repo
node_market_routes -->|"queries"| node_ranking_repo
node_market_collect -->|"invokes"| node_stock_collect
node_market_collect -->|"collects from"| node_external_data
node_stock_collect -->|"collects from"| node_external_data
node_news_collect -->|"collects from"| node_external_data
node_market_collect -->|"writes through"| node_market_repo
node_market_collect -->|"writes through"| node_ranking_repo
node_stock_collect -->|"uses"| node_backend_db
node_analyst_collect -->|"persists reports"| node_ai_reports
node_analyst_collect -.->|"uses shared database"| node_backend_db
node_llm -.->|"requests summaries"| node_external_data

click node_webapp "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/App.tsx"
click node_home "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/features/home/HomePage.tsx"
click node_stocks_ui "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/features/stock/StockBriefingPage.tsx"
click node_concept_ui "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/features/concepts/ConceptPage.tsx"
click node_account_ui "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/features/mypage/MyPage.tsx"
click node_api_app "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/main.py"
click node_auth "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/auth.py"
click node_market_routes "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/market.py"
click node_stock_routes "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/stocks.py"
click node_concept_routes "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/concepts.py"
click node_watchlist_routes "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/watchlist.py"
click node_market_collect "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/collectors/market.py"
click node_stock_collect "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/collectors/stocks.py"
click node_news_collect "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/collectors/news.py"
click node_analyst_collect "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/ai/app/collectors/telegram.py"
click node_news_link "https://github.com/kakaotechcampus-4/ktc4-pusan-5/tree/develop/ai/app/services/news_link"
click node_llm "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/ai/app/llm/client.py"
click node_ai_reports "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/ai/app/models/analyst_report.py"
click node_move_analysis "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/ai/app/models/stock_move_analysis.py"
click node_backend_db "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/core/database.py"
click node_market_repo "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/repositories/market.py"
click node_ranking_repo "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/repositories/ranking.py"
click node_user_repo "https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/repositories/user.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_webapp,node_home,node_stocks_ui,node_concept_ui,node_account_ui toneBlue
class node_api_app,node_auth,node_market_routes,node_stock_routes,node_concept_routes,node_watchlist_routes toneAmber
class node_market_collect,node_stock_collect,node_news_collect toneMint
class node_analyst_collect,node_news_link,node_llm toneRose
class node_ai_reports,node_move_analysis,node_backend_db,node_market_repo,node_ranking_repo,node_user_repo,node_user,node_external_data toneIndigo
```

## Components

### Web client

- [Web application](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Market home](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/features/home/HomePage.tsx): `frontend/src/features/home/HomePage.tsx`
- [Stock briefing](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/features/stock/StockBriefingPage.tsx): `frontend/src/features/stock/StockBriefingPage.tsx`
- [Concept learning](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/features/concepts/ConceptPage.tsx): `frontend/src/features/concepts/ConceptPage.tsx`
- [Account and watchlist](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/frontend/src/features/mypage/MyPage.tsx): `frontend/src/features/mypage/MyPage.tsx`

### Backend API

- [HTTP application](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/main.py): `backend/app/main.py`
- [Kakao authentication](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Market endpoints](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/market.py): `backend/app/routers/market.py`
- [Stock endpoints](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/stocks.py): `backend/app/routers/stocks.py`
- [Concept endpoints](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/concepts.py): `backend/app/routers/concepts.py`
- [Watchlist endpoints](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/routers/watchlist.py): `backend/app/routers/watchlist.py`

### Market collection

- [Market collector](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/collectors/market.py): `backend/app/collectors/market.py`
- [Stock collector](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/collectors/stocks.py): `backend/app/collectors/stocks.py`
- [News collector](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/collectors/news.py): `backend/app/collectors/news.py`

### AI research

- [Analyst and Telegram ingestion](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/ai/app/collectors/telegram.py): `ai/app/collectors/telegram.py`
- [News link processing](https://github.com/kakaotechcampus-4/ktc4-pusan-5/tree/develop/ai/app/services/news_link): `ai/app/services/news_link`
- [LLM summaries](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/ai/app/llm/client.py): `ai/app/llm/client.py`

### Persistence

- [Analyst reports](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/ai/app/models/analyst_report.py): `ai/app/models/analyst_report.py`
- [Stock-move analyses](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/ai/app/models/stock_move_analysis.py): `ai/app/models/stock_move_analysis.py`
- [Backend data store](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/core/database.py): `backend/app/core/database.py`
- [Market repositories](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/repositories/market.py): `backend/app/repositories/market.py`
- [Ranking repositories](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/repositories/ranking.py): `backend/app/repositories/ranking.py`
- [User repository](https://github.com/kakaotechcampus-4/ktc4-pusan-5/blob/develop/backend/app/repositories/user.py): `backend/app/repositories/user.py`

### Other components

- **Investor**
- **Market data providers**

## Connections

- Investor → Web application: uses (evidence: `frontend/src/App.tsx`)
- Web application → Market home: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Stock briefing: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Concept learning: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Account and watchlist: routes to (evidence: `frontend/src/App.tsx`)
- HTTP application → Kakao authentication: registers (evidence: `backend/app/main.py`)
- HTTP application → Market endpoints: registers (evidence: `backend/app/main.py`)
- HTTP application → Stock endpoints: registers (evidence: `backend/app/main.py`)
- HTTP application → Concept endpoints: registers (evidence: `backend/app/main.py`)
- HTTP application → Watchlist endpoints: registers (evidence: `backend/app/main.py`)
- Kakao authentication → User repository: gets or creates (evidence: `backend/app/routers/auth.py`)
- Market endpoints → Market repositories: queries (evidence: `backend/app/routers/market.py`)
- Market endpoints → Ranking repositories: queries (evidence: `backend/app/routers/market.py`)
- Market collector → Stock collector: invokes (evidence: `backend/app/collectors/market.py`)
- Market collector → Market data providers: collects from (evidence: `README.md`)
- Stock collector → Market data providers: collects from (evidence: `README.md`)
- News collector → Market data providers: collects from (evidence: `README.md`)
- Market collector → Market repositories: writes through (evidence: `backend/app/collectors/market.py`)
- Market collector → Ranking repositories: writes through (evidence: `backend/app/collectors/market.py`)
- Stock collector → Backend data store: uses (evidence: `backend/app/collectors/stocks.py`)
- Analyst and Telegram ingestion → Analyst reports: persists reports (evidence: `ai/app/collectors/telegram.py`)
- Analyst and Telegram ingestion → Backend data store: uses shared database
- LLM summaries → Market data providers: requests summaries
