How lucabn/canegattostivali works
Project type and purpose
• This is a client-side, single-page web application (a word-chain game) built with React and TypeScript. It’s hosted as a static site on Cloudflare Pages and uses Vite for build and development. There is no separate backend service—everything runs in the user’s browser and communicates only with local storage or embedded JSON data.
High-level components
a. User’s Browser (Client)
b. React Application
• Entry point (main.tsx)
• UI Layer (Atomic → Molecules → Organisms → Templates)
• State & Context Providers (ThemeProvider, KeyboardStatusProvider, ReactRouterProvider)
• Utilities (game logic, storage, encoding, etc.)
• Assets & Data (static JSON word lists, images, styles)
c. Build & Deployment Pipeline
• Vite (dev server, bundling, HMR)
• GitHub (source repo) → Cloudflare Pages (CDN‐backed static host)
Relationships & Data Flows
• Browser requests index.html from Cloudflare CDN → retrieves bundled JS/CSS/assets.
• React app boots, wraps <App> with Providers.
• UI components render based on internal state or static JSON data (wordList, newsData).
• User interactions (typing guesses, clicking buttons) → events propagate through React components → update Context or call utility functions (game-logic, local-storage).
• Local storage (via utils/local-storage.ts) persists user preferences or progress.
• Static assets (images, manifest.json) served by the same CDN.
Architectural Patterns & Design Principles
• Component-driven UI using Atomic Design (Atoms → Molecules → Organisms → Templates).
• Context providers for theme and keyboard status, enabling global state without prop drilling.
• Separation of concerns:
• UI (components)
• Business logic (utils/game-logic.ts)
• Data layer (static JSON in src/assets/data)
• Styling (SCSS modules, global overrides)
• Build-time bundling and optimization via Vite, TypeScript ensures type safety.