# ktaffy/rket architecture

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

- Interactive diagram: https://gitdiagram.com/ktaffy/rket
- Repository: https://github.com/ktaffy/rket

## Overview

$RKET is a community-driven rocket-dodging game: players vote for a lane, votes determine the rocket’s position, and the game loop advances obstacles and updates score and lives. The React game screen coordinates voting, gameplay, stats, and score and market-cap milestones; shared hooks synchronize votes and game state through Firebase. Market-cap milestones separately fetch token data from Dexscreener. Some component and hook excerpts were partial, so the graph shows documented composition and sampled integrations without inferring internal details of unsampled components.

Main entry points: [`src/components/Game.jsx`](https://github.com/ktaffy/rket/blob/master/src/components/Game.jsx) (Game coordinator), [`src/hooks/useSharedVoting.js`](https://github.com/ktaffy/rket/blob/master/src/hooks/useSharedVoting.js) (Shared voting), [`src/hooks/useSharedGameLoop.js`](https://github.com/ktaffy/rket/blob/master/src/hooks/useSharedGameLoop.js) (Shared game loop), [`src/components/VotingPanel.jsx`](https://github.com/ktaffy/rket/blob/master/src/components/VotingPanel.jsx) (Voting panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app["App entry<br/>[App.js]"]
end

subgraph group_gameplay["Game and voting"]
  node_game["Game coordinator<br/>[Game.jsx]"]
  node_voting["Shared voting<br/>[useSharedVoting.js]"]
  node_game_loop["Shared game loop"]
  node_voting_panel["Voting panel<br/>[VotingPanel.jsx]"]
  node_canvas["Game canvas<br/>[GameCanvas.jsx]"]
  node_obstacle["Obstacle display<br/>[Obstacle.jsx]"]
  node_timer["Vote timer<br/>[VoteTimer.jsx]"]
  node_stats["Game stats<br/>[GameStats.jsx]"]
end

subgraph group_milestones["Progress milestones"]
  node_market_milestones["Market milestones"]
  node_score_milestones["Score milestones"]
end

subgraph group_services["External services"]
  node_firebase_config["Firebase setup<br/>[firebase.js]"]
  node_firebase_db[("Firebase Realtime Database")]
  node_dexscreener["Dexscreener API"]
end

node_player(("Player"))

node_player -->|"opens game"| node_app
node_app -->|"renders"| node_game
node_player -->|"chooses direction"| node_voting_panel
node_game -->|"reads votes"| node_voting
node_game -->|"runs game"| node_game_loop
node_voting -->|"returns position"| node_game
node_game_loop -->|"returns state"| node_game
node_game -->|"supplies vote data"| node_voting_panel
node_voting_panel -->|"submits vote"| node_game
node_game -->|"supplies game state"| node_canvas
node_game -->|"supplies game state"| node_stats
node_game -->|"renders"| node_timer
node_game -->|"renders"| node_obstacle
node_game -->|"renders"| node_market_milestones
node_game -->|"supplies score"| node_score_milestones
node_voting -->|"uses database"| node_firebase_config
node_game_loop -->|"uses database"| node_firebase_config
node_firebase_config -->|"initializes"| node_firebase_db
node_voting -->|"reads and updates votes"| node_firebase_db
node_game_loop -->|"syncs game state"| node_firebase_db
node_market_milestones -->|"fetches market cap"| node_dexscreener

click node_app "https://github.com/ktaffy/rket/blob/master/src/App.js"
click node_game "https://github.com/ktaffy/rket/blob/master/src/components/Game.jsx"
click node_voting "https://github.com/ktaffy/rket/blob/master/src/hooks/useSharedVoting.js"
click node_game_loop "https://github.com/ktaffy/rket/blob/master/src/hooks/useSharedGameLoop.js"
click node_voting_panel "https://github.com/ktaffy/rket/blob/master/src/components/VotingPanel.jsx"
click node_canvas "https://github.com/ktaffy/rket/blob/master/src/components/GameCanvas.jsx"
click node_obstacle "https://github.com/ktaffy/rket/blob/master/src/components/Obstacle.jsx"
click node_timer "https://github.com/ktaffy/rket/blob/master/src/components/VoteTimer.jsx"
click node_stats "https://github.com/ktaffy/rket/blob/master/src/components/GameStats.jsx"
click node_market_milestones "https://github.com/ktaffy/rket/blob/master/src/components/MarketCapMilestones.jsx"
click node_score_milestones "https://github.com/ktaffy/rket/blob/master/src/components/ScoreMilestones.jsx"
click node_firebase_config "https://github.com/ktaffy/rket/blob/master/src/firebase.js"

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 toneBlue
class node_game,node_voting,node_game_loop,node_voting_panel,node_canvas,node_obstacle,node_timer,node_stats toneAmber
class node_market_milestones,node_score_milestones toneMint
class node_firebase_config,node_firebase_db,node_dexscreener toneRose
class node_player toneIndigo
```

## Components

### Application

- [App entry](https://github.com/ktaffy/rket/blob/master/src/App.js): `src/App.js`

### Game and voting

- [Game coordinator](https://github.com/ktaffy/rket/blob/master/src/components/Game.jsx): `src/components/Game.jsx`
- [Shared voting](https://github.com/ktaffy/rket/blob/master/src/hooks/useSharedVoting.js): `src/hooks/useSharedVoting.js`
- [Shared game loop](https://github.com/ktaffy/rket/blob/master/src/hooks/useSharedGameLoop.js): `src/hooks/useSharedGameLoop.js`
- [Voting panel](https://github.com/ktaffy/rket/blob/master/src/components/VotingPanel.jsx): `src/components/VotingPanel.jsx`
- [Game canvas](https://github.com/ktaffy/rket/blob/master/src/components/GameCanvas.jsx): `src/components/GameCanvas.jsx`
- [Obstacle display](https://github.com/ktaffy/rket/blob/master/src/components/Obstacle.jsx): `src/components/Obstacle.jsx`
- [Vote timer](https://github.com/ktaffy/rket/blob/master/src/components/VoteTimer.jsx): `src/components/VoteTimer.jsx`
- [Game stats](https://github.com/ktaffy/rket/blob/master/src/components/GameStats.jsx): `src/components/GameStats.jsx`

### Progress milestones

- [Market milestones](https://github.com/ktaffy/rket/blob/master/src/components/MarketCapMilestones.jsx): `src/components/MarketCapMilestones.jsx`
- [Score milestones](https://github.com/ktaffy/rket/blob/master/src/components/ScoreMilestones.jsx): `src/components/ScoreMilestones.jsx`

### External services

- [Firebase setup](https://github.com/ktaffy/rket/blob/master/src/firebase.js): `src/firebase.js`
- **Firebase Realtime Database**
- **Dexscreener API**

### Other components

- **Player**

## Connections

- Player → App entry: opens game
- App entry → Game coordinator: renders
- Player → Voting panel: chooses direction
- Game coordinator → Shared voting: reads votes
- Game coordinator → Shared game loop: runs game
- Shared voting → Game coordinator: returns position
- Shared game loop → Game coordinator: returns state
- Game coordinator → Voting panel: supplies vote data
- Voting panel → Game coordinator: submits vote
- Game coordinator → Game canvas: supplies game state
- Game coordinator → Game stats: supplies game state
- Game coordinator → Vote timer: renders
- Game coordinator → Obstacle display: renders
- Game coordinator → Market milestones: renders
- Game coordinator → Score milestones: supplies score
- Shared voting → Firebase setup: uses database
- Shared game loop → Firebase setup: uses database
- Firebase setup → Firebase Realtime Database: initializes
- Shared voting → Firebase Realtime Database: reads and updates votes
- Shared game loop → Firebase Realtime Database: syncs game state
- Market milestones → Dexscreener API: fetches market cap
