A modern, browser-based word guessing game built with vanilla TypeScript. Challenge yourself to guess words of varying lengths with real-time feedback and track your stats!
- Customizable word length (3-10 letters)
- Interactive color-coded feedback system
- ✅ Green: Perfect! Correct letter in the correct position
- 🟡 Yellow: Good! The letter is in the word, but in the wrong position
- ❌ Red: Nope! The letter is not in the word
- Real-time timer tracking
- Persistent stats
- Interactive on-screen keyboard
- Responsive design with smooth animations
- Integration with Datamuse API for word dictionary
- Progressive Web App (PWA) capabilities
- Works offline with service worker caching
- Installable on mobile and desktop devices
- Production-grade optimizations
- Code splitting for faster loading
- Gzip compression for smaller file sizes
- Environment variable configuration
- Vanilla TypeScript (ESNext)
- HTML5
- CSS3
- Vite for bundling and optimization
- Fast development server with HMR
- Code splitting for performance
- Asset optimization and compression
- Environment variables support
- Progressive Web App (PWA) features
- Service Worker for offline functionality
- Installable web app with manifest
- ESLint for code quality
- Datamuse API for word dictionary
-
Clone the repository:
git clone https://github.com/idmcalculus/wordGameChallenge.git cd wordGameChallenge -
Install dependencies:
bun install
-
Set up environment variables:
cp .env.example .env # Edit .env file with your configurationLogging and client error capture:
VITE_ENABLE_DEBUG_LOGS=trueenables browser logs in development/testing.- Keep it
falsein production for a silent console. VITE_CLIENT_ERROR_ENDPOINTcan be set to capture runtime errors server-side.- Captured client errors are also stored locally and can be viewed with:
window.getWordGameClientErrors()window.clearWordGameClientErrors()
-
Development mode:
bun run dev
-
Production build:
bun run build
-
Preview production build locally:
bun run preview
-
Lint code:
bun run lint # Or to automatically fix issues: bun run lint:fix -
Type-check core game modules:
bun run typecheck
-
Open your browser and navigate to:
http://localhost:8080
- Enter a word length between 3 and 10 letters
- Click "Start Game"
- Type your guess using your keyboard or click the on-screen keyboard tiles
- The on-screen keyboard also shows the current status of each letter
- Get feedback through colors:
- ✅ Green: Perfect! Correct letter in the correct position
- 🟡 Yellow: Good! The letter is in the word, but in the wrong position
- ❌ Red: Nope! The letter is not in the word
- You have 5 attempts to guess the word
- Try to beat your best time!
wordGameChallenge/
├── src/
│ ├── index.html # Main HTML file
│ ├── scss/ # SCSS styling files
│ ├── js/
│ │ ├── app.ts # Application entry point
│ │ ├── controllers/ # Game + UI controllers
│ │ │ ├── GameController.ts # Gameplay orchestration
│ │ │ ├── BoardController.ts
│ │ │ ├── KeyboardController.ts
│ │ │ └── TimerController.ts
│ │ ├── apiHandler.ts # Word API integration
│ │ ├── uiHandler.ts # Game UI rendering helpers
│ │ ├── modals.ts # Modal setup and alert handling
│ │ ├── hintHandler.ts # Hint button logic
│ │ ├── themeManager.ts # Theme toggle and system syncing
│ │ ├── core/
│ │ │ ├── gameEngine.ts # Pure guess evaluation rules
│ │ │ └── gameSession.ts # Canonical in-memory gameplay state
│ │ ├── repositories/
│ │ │ └── statsRepository.ts # Stats migration/persistence
│ │ ├── components/
│ │ │ └── StatsManager.ts # Stats table/filter/sort/pagination
│ │ ├── types/
│ │ │ ├── types.ts # Shared union/value types
│ │ │ └── interface.ts # Shared interfaces/contracts
│ │ └── utils/ # Timer, logger, error reporting, filters/sort
├── public/ # Static assets served as-is
├── docs/
│ └── ARCHITECTURE.md # Module boundaries and runtime flow
├── dist/ # Production build output
├── vite.config.js # Vite configuration
├── package.json # Dependencies and scripts
├── eslint.config.js # ESLint configuration
├── .env # Environment variables (production)
├── .env.example # Environment variables template
└── README.md
- See
docs/ARCHITECTURE.mdfor module responsibilities and contribution guidelines. - Stats table rendering is incremental for scale (20 initial rows, then 10-row append batches).
- Test coverage gate (
95%) targets deterministic core/data modules; UI behavior is validated with jsdom tests.
Feel free to submit issues and enhancement requests!
- Fork the repo
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.