How pxpatel/wordle works
Project type and purpose
• No dedicated backend or API; it’s purely client-side, using localStorage for persistence and Tailwind CSS for styling.
File structure
• Top-level config and metadata:
• package.json, package-lock.json (npm dependencies)
• .eslintrc.json, prettier.config.cjs, tailwind.config.js (lint & style)
• public/ (static assets: index.html, manifest.json, robots.txt)
• Source code in src/:
• index.js → React root, injects App into public/index.html
• App.js + App.css → overall layout & tailwind import
• hooks/ → custom React hooks (dark mode, autofocus, localStorage state, saved game state)
• util/ → pure logic modules (base game logic, constants, React context for game state)
Extract additional insights from README
• It’s a blank Create React App template with standard scripts (start, build, test, eject).
• No mention of backend endpoints or microservices.
• Intends to be further customized/extended by the developer.
Main components
a. User’s Browser / Client
b. Static Asset Server (hosting the built bundle + public assets)
c. Create React App Build Process (Webpack/Babel → bundle.js + CSS)
d. React Application run‐time components:
• EntryPoint (index.html, index.js)
• App Container (App.js + Tailwind CSS)
• State Management:
• React Context (gameContext)
• Custom Hooks (useLocalStorage, useSavedGameState, useDarkMode, useAutoFocus)
• Utility Modules (base logic, constants)
e. Persistence/Browser APIs: LocalStorage, Document Title, Dark Mode flag
f. Developer Tooling / Workflow (ESLint, Prettier, Tailwind config, Codespaces devcontainer)
Relationships & interactions
• Browser requests index.html → served by Static Server
• index.js bootstraps React into the DOM
• App renders UI components; components dispatch actions into Context/hooks → util logic → update state
• Hooks update/persist to localStorage and trigger re-renders
• Tailwind CSS classes applied at build time; PostCSS in CRA optimizes styles
• npm scripts (start → dev server, build → optimized bundle) feed into Static Server
Key architectural patterns & design principles
• Component-based UI (React)
• Unidirectional data flow via Context + Hooks
• Separation of concerns:
• Presentation (components)
• State management (hooks & context)
• Business logic (util modules)
• Configuration (ESLint, Prettier, Tailwind)
• Client-only architecture with local persistence
• All major components: Browser, Static Server, Build Process, React runtime, Hooks/Context, Util modules, LocalStorage