# mdsalmantd/tenzies-game architecture

> Architecture diagram of the GitHub repository mdsalmantd/tenzies-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mdsalmantd/tenzies-game
- Repository: https://github.com/mdsalmantd/tenzies-game

## Overview

##### Project type and purpose
- This is a single-page frontend application: a React + Vite + Tailwind CSS dice game called “Tenzies.”
- It has no separate backend or database; it runs entirely in the browser, with minimal persistence via cookies.

##### File structure
- Top level:
- index.html – the SPA shell
- package.json / package-lock.json – frontend dependencies & scripts
- vite.config.js, tailwind.config.js, eslint.config.js – build & lint config
- src/
- main.jsx – Vite’s entrypoint, renders <App/> into the DOM
- App.jsx – root component, contains layout & DiceGame
- components/
– DiceGame.jsx – core game logic, state management (dice array, timer, cookies)
– Dice.jsx – presentation of an individual die
- App.css, index.css – global & Tailwind imports

##### Key insights from the README
- Tech stack: React (components, hooks), Vite (dev + build), Tailwind CSS (styling), react-confetti (win animation), js-cookie (score persistence).
- Features: click-to-hold dice, rolling logic, timer, best-score cookies, confetti on win.

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Developer Environment"
    direction TB
    Dev["Developer"]:::build
    package["package.json\npackage-lock.json"]:::build
    viteCfg["vite.config.js"]:::build
    tailwindCfg["tailwind.config.js"]:::build
    eslintCfg["eslint.config.js"]:::build
  end

  subgraph "Build & Dev Server"
    direction TB
    Vite["Vite Dev Server"]:::build
  end

  subgraph "Source Code"
    direction TB
    html["index.html"]:::code
    main["main.jsx"]:::code
    app["App.jsx"]:::code
    indexCss["index.css"]:::code
    appCss["App.css"]:::code
    DiceGame["DiceGame.jsx"]:::code
    DiceComp["Dice.jsx"]:::code
  end

  subgraph "External Libraries"
    direction TB
    React["React"]:::ext
    ViteLib["Vite"]:::ext
    Tailwind["Tailwind CSS"]:::ext
    Confetti["react-confetti"]:::ext
    CookiesLib["js-cookie"]:::ext
  end

  subgraph "Browser Runtime"
    direction TB
    Browser["Browser DOM & JS Runtime"]:::build
    CookieStore["Cookies"]:::storage
  end

  Dev -->|"npm run dev"| Vite
  Dev --> package
  Dev --> viteCfg
  Dev --> tailwindCfg
  Dev --> eslintCfg

  Vite -->|"serves assets"| html

  html --> Browser
  Browser --> main
  Browser --> indexCss
  Browser --> appCss

  main --> app
  app --> DiceGame
  DiceGame --> DiceComp

  main --> React
  app --> React
  DiceGame --> React
  DiceComp --> React

  DiceGame -->|"useEffect→readCookie"| CookieStore
  DiceGame -->|"onwin→setCookie"| CookiesLib
  DiceGame --> Confetti

  classDef code fill:#cfe2f3,stroke:#000
  classDef ext fill:#d9ead3,stroke:#000
  classDef build fill:#f9cb9c,stroke:#000
  classDef storage fill:#fff2cc,stroke:#000

  click package "https://github.com/mdsalmantd/tenzies-game/blob/main/package.json"
  click viteCfg "https://github.com/mdsalmantd/tenzies-game/blob/main/vite.config.js"
  click tailwindCfg "https://github.com/mdsalmantd/tenzies-game/blob/main/tailwind.config.js"
  click eslintCfg "https://github.com/mdsalmantd/tenzies-game/blob/main/eslint.config.js"
  click html "https://github.com/mdsalmantd/tenzies-game/blob/main/index.html"
  click main "https://github.com/mdsalmantd/tenzies-game/blob/main/src/main.jsx"
  click app "https://github.com/mdsalmantd/tenzies-game/blob/main/src/App.jsx"
  click indexCss "https://github.com/mdsalmantd/tenzies-game/blob/main/src/index.css"
  click appCss "https://github.com/mdsalmantd/tenzies-game/blob/main/src/App.css"
  click DiceGame "https://github.com/mdsalmantd/tenzies-game/blob/main/src/components/DiceGame.jsx"
  click DiceComp "https://github.com/mdsalmantd/tenzies-game/blob/main/src/components/Dice.jsx"
```
