# moshang-ax/lottery architecture

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

- Interactive diagram: https://gitdiagram.com/moshang-ax/lottery
- Repository: https://github.com/moshang-ax/lottery

## Overview

Lottery is a Vue-based annual-dinner raffle with an Express data service. The workflow initializes participants and prize configuration, presents them in a 3D name-ball interface, runs draws and supports redraw/reset, then saves and exports results. The graph includes the documented persistence and Excel capabilities. Some API-to-server wiring is not visible in the supplied excerpts, so that relationship is marked unverified.

Main entry points: [`product/src/App.vue`](https://github.com/moshang-ax/lottery/blob/vue/product/src/App.vue) (Vue app), [`product/src/lottery/engine.js`](https://github.com/moshang-ax/lottery/blob/vue/product/src/lottery/engine.js) (3D draw engine), [`product/src/lottery/store.js`](https://github.com/moshang-ax/lottery/blob/vue/product/src/lottery/store.js) (Draw state), [`server/server.js`](https://github.com/moshang-ax/lottery/blob/vue/server/server.js) (Express service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Raffle interface"]
  node_app["Vue app<br/>[App.vue]"]
  node_controls["Draw controls<br/>[ControlPanel.vue]"]
  node_prizes_ui["Prize display<br/>[PrizeBar.vue]"]
  node_bubble_ui["Status bubbles<br/>[QipaoList.vue]"]
  node_music["Music control<br/>[MusicControl.vue]"]
  node_stars["Star background<br/>[StarCanvas.vue]"]
end

subgraph group_lottery["Draw runtime"]
  node_engine["3D draw engine<br/>[engine.js]"]
  node_state["Draw state<br/>[store.js]"]
  node_prize_config["Prize settings<br/>[config.js]"]
end

subgraph group_service["Data service"]
  node_api["API client<br/>[index.js]"]
  node_server["Express service<br/>[server.js]"]
  node_server_config["Prize configuration<br/>[config.js]"]
end

subgraph group_records["Lottery records"]
  node_helpers["Excel and persistence<br/>[help.js]"]
  node_participants["Participant workbook<br/>[users.xlsx]"]
  node_results["Exported results<br/>[抽奖结果.xlsx]"]
end

node_organizer(("Organizer"))

node_organizer -->|"operates"| node_controls
node_app -->|"boots"| node_engine
node_app -->|"renders"| node_controls
node_app -->|"renders"| node_prizes_ui
node_app -->|"renders"| node_bubble_ui
node_app -->|"renders"| node_music
node_app -->|"renders"| node_stars
node_controls -->|"dispatches actions"| node_engine
node_engine -->|"updates"| node_state
node_engine -->|"reads"| node_prize_config
node_engine -->|"requests data"| node_api
node_prizes_ui -->|"reads"| node_state
node_bubble_ui -->|"reads"| node_state
node_music -->|"posts alerts"| node_state
node_api -.->|"calls service"| node_server
node_server -->|"loads"| node_server_config
node_server -->|"loads and saves"| node_helpers
node_helpers -->|"reads workbook"| node_participants
node_helpers -->|"writes workbook"| node_results

click node_app "https://github.com/moshang-ax/lottery/blob/vue/product/src/App.vue"
click node_controls "https://github.com/moshang-ax/lottery/blob/vue/product/src/components/ControlPanel.vue"
click node_prizes_ui "https://github.com/moshang-ax/lottery/blob/vue/product/src/components/PrizeBar.vue"
click node_bubble_ui "https://github.com/moshang-ax/lottery/blob/vue/product/src/components/QipaoList.vue"
click node_music "https://github.com/moshang-ax/lottery/blob/vue/product/src/components/MusicControl.vue"
click node_stars "https://github.com/moshang-ax/lottery/blob/vue/product/src/components/StarCanvas.vue"
click node_engine "https://github.com/moshang-ax/lottery/blob/vue/product/src/lottery/engine.js"
click node_state "https://github.com/moshang-ax/lottery/blob/vue/product/src/lottery/store.js"
click node_prize_config "https://github.com/moshang-ax/lottery/blob/vue/product/src/lottery/config.js"
click node_api "https://github.com/moshang-ax/lottery/blob/vue/product/src/api/index.js"
click node_server "https://github.com/moshang-ax/lottery/blob/vue/server/server.js"
click node_server_config "https://github.com/moshang-ax/lottery/blob/vue/server/config.js"
click node_helpers "https://github.com/moshang-ax/lottery/blob/vue/server/help.js"
click node_participants "https://github.com/moshang-ax/lottery/blob/vue/server/data/users.xlsx"
click node_results "https://github.com/moshang-ax/lottery/blob/vue/server/%E6%8A%BD%E5%A5%96%E7%BB%93%E6%9E%9C.xlsx"

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_app,node_controls,node_prizes_ui,node_bubble_ui,node_music,node_stars toneBlue
class node_engine,node_state,node_prize_config toneAmber
class node_api,node_server,node_server_config toneMint
class node_helpers,node_participants,node_results toneRose
class node_organizer toneIndigo
```

## Components

### Raffle interface

- [Vue app](https://github.com/moshang-ax/lottery/blob/vue/product/src/App.vue): `product/src/App.vue`
- [Draw controls](https://github.com/moshang-ax/lottery/blob/vue/product/src/components/ControlPanel.vue): `product/src/components/ControlPanel.vue`
- [Prize display](https://github.com/moshang-ax/lottery/blob/vue/product/src/components/PrizeBar.vue): `product/src/components/PrizeBar.vue`
- [Status bubbles](https://github.com/moshang-ax/lottery/blob/vue/product/src/components/QipaoList.vue): `product/src/components/QipaoList.vue`
- [Music control](https://github.com/moshang-ax/lottery/blob/vue/product/src/components/MusicControl.vue): `product/src/components/MusicControl.vue`
- [Star background](https://github.com/moshang-ax/lottery/blob/vue/product/src/components/StarCanvas.vue): `product/src/components/StarCanvas.vue`

### Draw runtime

- [3D draw engine](https://github.com/moshang-ax/lottery/blob/vue/product/src/lottery/engine.js): `product/src/lottery/engine.js`
- [Draw state](https://github.com/moshang-ax/lottery/blob/vue/product/src/lottery/store.js): `product/src/lottery/store.js`
- [Prize settings](https://github.com/moshang-ax/lottery/blob/vue/product/src/lottery/config.js): `product/src/lottery/config.js`

### Data service

- [API client](https://github.com/moshang-ax/lottery/blob/vue/product/src/api/index.js): `product/src/api/index.js`
- [Express service](https://github.com/moshang-ax/lottery/blob/vue/server/server.js): `server/server.js`
- [Prize configuration](https://github.com/moshang-ax/lottery/blob/vue/server/config.js): `server/config.js`

### Lottery records

- [Excel and persistence](https://github.com/moshang-ax/lottery/blob/vue/server/help.js): `server/help.js`
- [Participant workbook](https://github.com/moshang-ax/lottery/blob/vue/server/data/users.xlsx): `server/data/users.xlsx`
- [Exported results](https://github.com/moshang-ax/lottery/blob/vue/server/%E6%8A%BD%E5%A5%96%E7%BB%93%E6%9E%9C.xlsx): `server/抽奖结果.xlsx`

### Other components

- **Organizer**

## Connections

- Organizer → Draw controls: operates (evidence: `product/src/components/ControlPanel.vue`)
- Vue app → 3D draw engine: boots (evidence: `product/src/App.vue`)
- Vue app → Draw controls: renders (evidence: `product/src/App.vue`)
- Vue app → Prize display: renders (evidence: `product/src/App.vue`)
- Vue app → Status bubbles: renders (evidence: `product/src/App.vue`)
- Vue app → Music control: renders (evidence: `product/src/App.vue`)
- Vue app → Star background: renders (evidence: `product/src/App.vue`)
- Draw controls → 3D draw engine: dispatches actions (evidence: `product/src/components/ControlPanel.vue`)
- 3D draw engine → Draw state: updates (evidence: `product/src/lottery/engine.js`)
- 3D draw engine → Prize settings: reads (evidence: `product/src/lottery/engine.js`)
- 3D draw engine → API client: requests data (evidence: `product/src/lottery/engine.js`)
- Prize display → Draw state: reads (evidence: `product/src/components/PrizeBar.vue`)
- Status bubbles → Draw state: reads (evidence: `product/src/components/QipaoList.vue`)
- Music control → Draw state: posts alerts (evidence: `product/src/components/MusicControl.vue`)
- API client → Express service: calls service
- Express service → Prize configuration: loads (evidence: `server/server.js`)
- Express service → Excel and persistence: loads and saves (evidence: `server/server.js`)
- Excel and persistence → Participant workbook: reads workbook (evidence: `server/help.js`)
- Excel and persistence → Exported results: writes workbook (evidence: `server/help.js`)
