# nkvtd/lazhni-vesti architecture

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

- Interactive diagram: https://gitdiagram.com/nkvtd/lazhni-vesti
- Repository: https://github.com/nkvtd/lazhni-vesti

## Overview

Лажни вести? is a daily Macedonian headline-guessing game with guest and registered play, archive replay, gamification, leaderboards, and an editorial pipeline. The main player flow runs from the game page through session state and server RPCs to challenge/gameplay persistence; separate branches cover account features, archive/debrief, rankings, and editorial publishing. README statements and indexed references support the documented links; some page loaders and RPC implementations were not sampled, so their internal calls are not expanded.

Main entry points: [`src/database/drizzle/db.ts`](https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/db.ts) (Drizzle database), [`src/database/drizzle/queries/gameplay.ts`](https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/gameplay.ts) (Gameplay queries), [`src/composables/useGameSession.ts`](https://github.com/nkvtd/lazhni-vesti/blob/main/src/composables/useGameSession.ts) (Session state), [`src/pages/index/Game.telefunc.ts`](https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/index/Game.telefunc.ts) (Game RPC)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Gameplay"]
  node_gamepage["Game page<br/>[+Page.vue]"]
  node_gameplay["Game interface<br/>[GamePlay.vue]"]
  node_session["Session state<br/>[useGameSession.ts]"]
  node_game_rpc["Game RPC<br/>[Game.telefunc.ts]"]
  node_challenge_queries["Challenge queries<br/>[challenges.ts]"]
  node_game_queries["Gameplay queries<br/>[gameplay.ts]"]
end

subgraph group_engagement["Player features"]
  node_archive["Archive and heatmap"]
  node_debrief["Debrief"]
  node_gamification["Streaks and badges<br/>[gamification.ts]"]
  node_leaderboard["Leaderboards<br/>[leaderboard.ts]"]
  node_account["Player account"]
end

subgraph group_editorial["Editorial pipeline"]
  node_staging["Staging queue<br/>[staging.ts]"]
  node_admin["Admin console<br/>[+Page.vue]"]
  node_editor["Challenge editor"]
  node_admin_rpc["Admin RPC<br/>[Admin.telefunc.ts]"]
  node_scraper["RSS scraper<br/>[scraper.service.ts]"]
  node_llm["LLM assistant<br/>[llm.service.ts]"]
end

subgraph group_platform["Services and storage"]
  node_auth["Authentication<br/>[better-auth.ts]"]
  node_db[("Drizzle database<br/>[db.ts]")]
  node_schema["Data schema"]
end

node_player(("Player"))
node_feeds["News feeds"]
node_llm_service["LLM provider"]

node_player -->|"plays"| node_gamepage
node_gamepage -->|"renders"| node_gameplay
node_gameplay -->|"uses"| node_session
node_session -->|"submits guesses"| node_game_rpc
node_session -->|"calculates score"| node_game_queries
node_game_rpc -->|"loads challenge"| node_challenge_queries
node_game_rpc -.->|"records gameplay"| node_game_queries
node_player -->|"replays dates"| node_archive
node_player -->|"reviews result"| node_debrief
node_game_queries -->|"awards progress"| node_gamification
node_player -->|"views rankings"| node_leaderboard
node_player -->|"manages profile"| node_account
node_account -->|"changes credentials"| node_auth
node_feeds -->|"provides articles"| node_scraper
node_scraper -->|"inserts matches"| node_staging
node_player -->|"edits challenges"| node_admin
node_admin -->|"opens editor"| node_editor
node_editor -->|"requests edits"| node_admin_rpc
node_admin_rpc -->|"manages articles"| node_staging
node_admin_rpc -.->|"requests proposal"| node_llm
node_llm -->|"generates proposal"| node_llm_service
node_llm -.->|"returns proposal"| node_editor
node_challenge_queries -->|"queries challenges"| node_db
node_game_queries -->|"writes gameplay"| node_db
node_gamification -->|"stores awards"| node_db
node_staging -.->|"stores articles"| node_db
node_db -->|"uses schema"| node_schema

click node_gamepage "https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/play/%2BPage.vue"
click node_gameplay "https://github.com/nkvtd/lazhni-vesti/blob/main/src/components/game/GamePlay.vue"
click node_session "https://github.com/nkvtd/lazhni-vesti/blob/main/src/composables/useGameSession.ts"
click node_game_rpc "https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/index/Game.telefunc.ts"
click node_challenge_queries "https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/challenges.ts"
click node_game_queries "https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/gameplay.ts"
click node_archive "https://github.com/nkvtd/lazhni-vesti/tree/main/src/pages/archive"
click node_debrief "https://github.com/nkvtd/lazhni-vesti/tree/main/src/pages/debrief"
click node_gamification "https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/gamification.ts"
click node_leaderboard "https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/leaderboard.ts"
click node_account "https://github.com/nkvtd/lazhni-vesti/tree/main/src/pages/account"
click node_auth "https://github.com/nkvtd/lazhni-vesti/blob/main/src/server/better-auth.ts"
click node_staging "https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/staging.ts"
click node_admin "https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/admin/%2BPage.vue"
click node_editor "https://github.com/nkvtd/lazhni-vesti/blob/main/src/components/admin/ChallengeEditorModal.vue"
click node_admin_rpc "https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/admin/Admin.telefunc.ts"
click node_scraper "https://github.com/nkvtd/lazhni-vesti/blob/main/src/server/services/scraper.service.ts"
click node_llm "https://github.com/nkvtd/lazhni-vesti/blob/main/src/server/services/llm.service.ts"
click node_db "https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/db.ts"
click node_schema "https://github.com/nkvtd/lazhni-vesti/tree/main/src/database/drizzle/schema"

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_gamepage,node_gameplay,node_session,node_game_rpc,node_challenge_queries,node_game_queries toneBlue
class node_archive,node_debrief,node_gamification,node_leaderboard,node_account toneAmber
class node_staging,node_admin,node_editor,node_admin_rpc,node_scraper,node_llm toneMint
class node_auth,node_db,node_schema toneRose
class node_player,node_feeds,node_llm_service toneIndigo
```

## Components

### Gameplay

- [Game page](https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/play/%2BPage.vue): `src/pages/play/+Page.vue`
- [Game interface](https://github.com/nkvtd/lazhni-vesti/blob/main/src/components/game/GamePlay.vue): `src/components/game/GamePlay.vue`
- [Session state](https://github.com/nkvtd/lazhni-vesti/blob/main/src/composables/useGameSession.ts): `src/composables/useGameSession.ts`
- [Game RPC](https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/index/Game.telefunc.ts): `src/pages/index/Game.telefunc.ts`
- [Challenge queries](https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/challenges.ts): `src/database/drizzle/queries/challenges.ts`
- [Gameplay queries](https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/gameplay.ts): `src/database/drizzle/queries/gameplay.ts`

### Player features

- [Archive and heatmap](https://github.com/nkvtd/lazhni-vesti/tree/main/src/pages/archive): `src/pages/archive`
- [Debrief](https://github.com/nkvtd/lazhni-vesti/tree/main/src/pages/debrief): `src/pages/debrief`
- [Streaks and badges](https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/gamification.ts): `src/database/drizzle/queries/gamification.ts`
- [Leaderboards](https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/leaderboard.ts): `src/database/drizzle/queries/leaderboard.ts`
- [Player account](https://github.com/nkvtd/lazhni-vesti/tree/main/src/pages/account): `src/pages/account`

### Editorial pipeline

- [Staging queue](https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/queries/staging.ts): `src/database/drizzle/queries/staging.ts`
- [Admin console](https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/admin/%2BPage.vue): `src/pages/admin/+Page.vue`
- [Challenge editor](https://github.com/nkvtd/lazhni-vesti/blob/main/src/components/admin/ChallengeEditorModal.vue): `src/components/admin/ChallengeEditorModal.vue`
- [Admin RPC](https://github.com/nkvtd/lazhni-vesti/blob/main/src/pages/admin/Admin.telefunc.ts): `src/pages/admin/Admin.telefunc.ts`
- [RSS scraper](https://github.com/nkvtd/lazhni-vesti/blob/main/src/server/services/scraper.service.ts): `src/server/services/scraper.service.ts`
- [LLM assistant](https://github.com/nkvtd/lazhni-vesti/blob/main/src/server/services/llm.service.ts): `src/server/services/llm.service.ts`

### Services and storage

- [Authentication](https://github.com/nkvtd/lazhni-vesti/blob/main/src/server/better-auth.ts): `src/server/better-auth.ts`
- [Drizzle database](https://github.com/nkvtd/lazhni-vesti/blob/main/src/database/drizzle/db.ts): `src/database/drizzle/db.ts`
- [Data schema](https://github.com/nkvtd/lazhni-vesti/tree/main/src/database/drizzle/schema): `src/database/drizzle/schema`

### Other components

- **Player**
- **News feeds**
- **LLM provider**

## Connections

- Player → Game page: plays (evidence: `README.md`)
- Game page → Game interface: renders (evidence: `src/pages/play/+Page.vue`)
- Game interface → Session state: uses (evidence: `src/components/game/GamePlay.vue`)
- Session state → Game RPC: submits guesses (evidence: `src/composables/useGameSession.ts`)
- Session state → Gameplay queries: calculates score (evidence: `src/composables/useGameSession.ts`)
- Game RPC → Challenge queries: loads challenge (evidence: `src/composables/useGameSession.ts`)
- Game RPC → Gameplay queries: records gameplay
- Player → Archive and heatmap: replays dates (evidence: `README.md`)
- Player → Debrief: reviews result
- Gameplay queries → Streaks and badges: awards progress (evidence: `src/database/drizzle/queries/gameplay.ts`)
- Player → Leaderboards: views rankings (evidence: `README.md`)
- Player → Player account: manages profile (evidence: `src/pages/account/+Page.vue`)
- Player account → Authentication: changes credentials (evidence: `src/pages/account/+Page.vue`)
- News feeds → RSS scraper: provides articles (evidence: `src/server/services/scraper.service.ts`)
- RSS scraper → Staging queue: inserts matches (evidence: `src/server/services/scraper.service.ts`)
- Player → Admin console: edits challenges (evidence: `README.md`)
- Admin console → Challenge editor: opens editor (evidence: `src/pages/admin/+Page.vue`)
- Challenge editor → Admin RPC: requests edits (evidence: `src/components/admin/ChallengeEditorModal.vue`)
- Admin RPC → Staging queue: manages articles (evidence: `src/pages/admin/Admin.telefunc.ts`)
- Admin RPC → LLM assistant: requests proposal
- LLM assistant → LLM provider: generates proposal (evidence: `src/server/services/llm.service.ts`)
- LLM assistant → Challenge editor: returns proposal
- Challenge queries → Drizzle database: queries challenges (evidence: `src/database/drizzle/queries/challenges.ts`)
- Gameplay queries → Drizzle database: writes gameplay (evidence: `src/database/drizzle/queries/gameplay.ts`)
- Streaks and badges → Drizzle database: stores awards (evidence: `src/database/drizzle/queries/gamification.ts`)
- Staging queue → Drizzle database: stores articles
- Drizzle database → Data schema: uses schema (evidence: `src/database/drizzle/db.ts`)
