A fast-paced, interactive React-based guessing game where players test their knowledge of NBA players by identifying them from their images. Built with React 19, Vite, and Tailwind CSS.
The NBA Player Guessing Game is a real-time guessing challenge where you have 5 rounds to identify as many NBA players as possible.
Each Round:
- 15 seconds on the clock
- An NBA player image is displayed
- Type the player's first and/or last name to make your guess
- The faster you guess, the more points you earn!
Points are based on accuracy and speed:
| Accuracy | Points | Description |
|---|---|---|
| Perfect | Up to 1000 | Both first AND last name correct |
| Partial | Up to 500 | Either first OR last name correct |
| Incorrect | 0 | Player name not recognized |
Maximum Game Score: 5,000 points (1,000 points × 5 rounds)
Your final score determines your tier based on efficiency:
| Efficiency | Tier | Status |
|---|---|---|
| 90%+ | GOAT | Greatest of All Time |
| 70-89% | MVP | Most Valuable Player |
| 50-69% | All-Star | Elite Performer |
| 30-49% | Starter | Solid Player |
| 10-29% | Rookie | Newcomer |
| <10% | Bench | Keep Practicing |
Click the "Play" button on the home page to begin your guessing challenge.
| Dark Theme | Light Theme |
|---|---|
![]() |
![]() |
Each round displays a player's image. Study their appearance carefully!
| Dark Theme | Light Theme |
|---|---|
![]() |
![]() |
- Type the player's first name, last name, or both
- Names are case-insensitive
- Press Enter or click Submit to lock in your guess
Instant feedback shows you:
- Whether your guess was Perfect, Close, or Incorrect
- The points you earned for that round
- Your cumulative score
After each round, advance to the next player. Complete all 5 rounds to finish the game.
After completing all 5 rounds, check your:
- Total Score (0-5,000)
- Performance Tier (GOAT to Bench)
- Leaderboard to see how you rank against other players
- Accuracy (number of perfect guesses)
Track your performance and compete with other players on the global leaderboard. See where you rank based on:
- Total Score - Your final game score
- Performance Tier - GOAT to Bench ranking
- Accuracy Rate - Percentage of correct guesses
- Personal Best - Your highest score ever
- Real-Time Scoring - Watch your points accumulate instantly
- Interactive Feedback - Get immediate results on each guess
- Sound Effects - Audio feedback for perfect guesses
- Dark/Light Theme - Toggle between themes for comfortable viewing
- Responsive Design - Play on desktop, tablet, or mobile
- Leaderboard - Compete with other players and track rankings
- NBA Player Database - Guess from a curated collection of legendary NBA players
- Node.js 16+
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd guessingGame- Install dependencies:
npm install- Create environment file:
cp .env.example .env- Configure your environment variables:
VITE_API_BASE_URL=http://localhost:3000/api
VITE_APP_NAME=NBA Guessing Game- Start the development server:
npm run devThe application will be available at http://localhost:5173
npm run dev- Start development server with Vitenpm run build- Build for productionnpm run preview- Preview production build locallynpm run lint- Run ESLint to check code qualitynpm run format- Format code with Prettier
src/
├── components/ # Reusable UI components
│ ├── Navbar.jsx # Navigation bar with theme toggle
│ ├── LeaderboardModal.jsx # Display rankings
│ ├── ThemeToggle.jsx # Dark/light theme switcher
│ └── ui/ # Basic UI components
├── config/
│ ├── constants.js # Game constants (rounds, duration, etc.)
│ └── env.js # Environment configuration
├── data/
│ └── players.js # NBA players database
├── pages/public/game/
│ ├── GameView.jsx # Main game component
│ ├── game.css # Game styling
│ └── sections/
│ ├── Result.jsx # Result display after guess
│ └── Score.jsx # Score display during game
├── router/
│ └── router.jsx # Route configuration
├── services/ # API communication
│ ├── axiosInstance.js
│ └── httpMethods.js
└── utils/
├── cookies.js
├── storage.js
└── validators.js
The game is configured with the following constants (in src/config/constants.js):
- ROUNDS: 5 rounds per game
- DURATION: 15 seconds per round
- MAX_PER_ROUND: 1,000 points maximum per round
- TOTAL_SCORE: 5,000 points maximum
The game features legendary NBA players stored in src/data/players.js:
- LeBron James
- Stephen Curry
- Michael Jordan
- Kobe Bryant
- Kevin Durant
You can easily add more players to expand the game database!
The game supports dark and light themes with automatic persistence to localStorage:
- Light Theme - Clean, bright interface perfect for daytime
- Dark Theme - Easy on the eyes for comfortable gaming sessions
- Toggle Button - Located in the Navbar for easy access
The scoring system rewards speed and accuracy:
Points = (Time Remaining / Total Duration) × 1000 × Accuracy Multiplier
Where Accuracy Multiplier is:
- 1.0 for perfect guesses (both names)
- 0.5 for partial guesses (one name)
- 0.0 for incorrect guesses
npm run devThe server runs on http://localhost:5173 with hot module reloading enabled.
npm run buildCreates an optimized production bundle in the dist/ directory.
npm run lintChecks code quality using ESLint.
npm run formatFormats code using Prettier for consistent style.
- React 19 - Latest React with hooks
- Vite - Ultra-fast build tool
- Tailwind CSS 4 - Utility-first styling
- React Router v7 - Client-side routing
- Lucide React - Icon library
- JavaScript ES6+ - Modern JavaScript
The game is fully responsive and optimized for:
- 📱 Mobile (320px and up)
- 📲 Tablets (768px and up)
- 💻 Desktop (1024px and up)
All UI elements scale beautifully across devices.
- Have Node.js 16+ installed
- Project built successfully with
npm run build - Environment variables properly configured
npm install -g vercel
vercelnpm run build
# Upload the dist/ folder to Netlifynpm run build
# Deploy the dist/ folder to gh-pages branch- Study the Images - Take time to carefully examine each player's face
- Know Your NBA History - Players span different eras (90s to 2010s)
- Speed Counts - Don't hesitate; guessing quickly earns more points
- Partial Guesses - If unsure, guessing just a first or last name is better than nothing
- Practice - Play multiple games to build familiarity with the players
- Refresh the page
- Clear browser cache
- Check internet connection
- Ensure your browser allows audio playback
- Check system volume
- Verify browser permissions for audio
- Check that localStorage is enabled in your browser
- Clear browser cache and cookies
- Try a different browser
For issues or feedback:
- Check the browser console for error messages
- Verify all dependencies are installed:
npm install - Restart the development server:
npm run dev
This project is open source and available under the MIT License.
- Fork the repository
- Create a 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.
- React - The web framework used
- Redux Toolkit - State management
- Tailwind CSS - Styling framework
- Vite - Build tool
- Lucide - Icon library
If you have any questions or need help getting started:
- 📧 Email: hello@reactboilerplate.dev
- 💬 Discord: Join our community
- 🐛 Issues: GitHub Issues
- 📖 Docs: Documentation
Happy Coding! 🎉
npm run lint- Run ESLint to check code qualitynpm run format- Format code with Prettier
src/
├── api/
│ ├── apiClient.js
│ └── endpoints/
│ └── exampleApi.js
├── app/
│ ├── store.js
│ └── rootReducer.js
├── components/
│ ├── common/
│ │ ├── Button/
│ │ │ ├── Button.jsx
│ │ │ └── index.js
│ │ ├── Input/
│ │ │ ├── Input.jsx
│ │ │ └── index.js
│ │ └── LoadingSpinner/
│ │ ├── LoadingSpinner.jsx
│ │ └── index.js
│ └── layout/
│ ├── Header/
│ │ ├── Header.jsx
│ │ └── index.js
│ └── Footer/
│ ├── Footer.jsx
│ └── index.js
├── features/
│ ├── auth/
│ │ ├── components/
│ │ ├── hooks/
│ │ ├── authSlice.js
│ │ └── authApi.js
│ ├── todos/
│ │ ├── components/
│ │ ├── hooks/
│ │ ├── todosSlice.js
│ │ └── todosApi.js
│ └── counter/
│ ├── components/
│ ├── hooks/
│ ├── counterSlice.js
│ └── counterApi.js
├── hooks/
│ ├── useDebounce.js
│ ├── useLocalStorage.js
│ └── useMediaQuery.js
├── utils/
│ ├── constants.js
│ ├── helpers.js
│ └── validators.js
├── styles/
│ └── globals.css
├── routes/
│ ├── PrivateRoute.jsx
│ └── AppRoutes.jsx
└── App.jsx
The Tailwind CSS configuration is located in tailwind.config.js. Customize your design tokens here:
export default {
content: ['./index.html', './src/**/*.{js,jsx}'],
theme: {
extend: {
colors: { /* ... */ },
spacing: { /* ... */ },
},
},
darkMode: 'class',
};Redux slices are located in src/store/slices/. Create new slices for different features:
import { createSlice } from '@reduxjs/toolkit';
const initialState = { /* ... */ };
export const featureSlice = createSlice({
name: 'feature',
initialState,
reducers: {
// Add your reducers here
},
});
export const { /* actions */ } = featureSlice.actions;
export default featureSlice.reducer;Then register the slice in src/store/store.js:
import featureReducer from './slices/featureSlice';
export const store = configureStore({
reducer: {
// ... other reducers
feature: featureReducer,
},
});import { useDispatch, useSelector } from 'react-redux';
import { toggleTheme } from '../store/slices/appSlice';
export default function Component() {
const dispatch = useDispatch();
const theme = useSelector((state) => state.app.theme);
return (
<button onClick={() => dispatch(toggleTheme())}>
Current theme: {theme}
</button>
);
}import Button from '../components/ui/Button';
import Card from '../components/ui/Card';
export default function Example() {
return (
<Card>
<h2 className="text-xl font-bold">Welcome</h2>
<p className="mt-2 text-gray-600">Hello, World!</p>
<Button variant="primary" size="md" className="mt-4">
Click Me
</Button>
</Card>
);
}export default function Component() {
return (
<div className="flex items-center justify-center rounded-lg bg-blue-500 px-6 py-4 text-white shadow-lg hover:bg-blue-600 dark:bg-blue-900">
Tailwind styled component
</div>
);
}Versatile button component with multiple variants and sizes.
<Button variant="primary" size="md">
Primary Button
</Button>
<Button variant="secondary" size="sm">
Secondary Button
</Button>
<Button variant="danger" size="lg">
Danger Button
</Button>Props:
variant:'primary'|'secondary'|'danger'(default:'primary')size:'sm'|'md'|'lg'(default:'md')className: Additional CSS classes- All standard HTML button attributes
Container component for grouping content.
<Card className="max-w-md">
<h3 className="font-bold">Card Title</h3>
<p>Card content goes here</p>
</Card>Props:
children: Card contentclassName: Additional CSS classes
Component to switch between light and dark modes.
<ThemeToggle />Dark mode is built-in using Tailwind's class-based dark mode. To enable dark mode:
// In your component
<div className="bg-white text-gray-900 dark:bg-gray-900 dark:text-white">
Content
</div>The ThemeToggle component is already integrated and manages the theme state via Redux.
- react - UI library
- react-dom - DOM rendering
- react-redux - Redux bindings for React
- @reduxjs/toolkit - Redux state management
- tailwindcss - Utility-first CSS framework
- @tailwindcss/vite - Vite plugin for Tailwind CSS
- clsx - Utility for constructing className strings
- react-router-dom - Client-side routing
- axios - HTTP client
- react-toastify - Toast notifications
- vite - Build tool
- eslint - Code quality
- prettier - Code formatter
- prettier-plugin-tailwindcss - Tailwind CSS class sorting
- Component Organization - Keep components modular and focused on single responsibility
- Redux Slices - Use Redux Toolkit slices for cleaner state management
- Styling - Prefer Tailwind CSS utility classes over custom CSS
- Type Safety - Consider using TypeScript for larger projects
- Performance - Use React.memo and useMemo for performance optimization
- Testing - Add tests using Jest and React Testing Library
- Code Quality - Run ESLint and Prettier regularly
- Environment Variables - Use
.envfiles for sensitive data
npm run buildThis generates an optimized build in the dist/ directory.
npm run preview- Install Vercel CLI:
npm i -g vercel - Run:
vercel - Follow the prompts
- Push code to GitHub
- Connect repository to Netlify
- Set build command:
npm run build - Set publish directory:
dist
- React Documentation
- Redux Toolkit Documentation
- Tailwind CSS Documentation
- Vite Documentation
- React Router Documentation
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create a 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.
- Use the Redux DevTools browser extension for better state debugging
- Leverage Tailwind's responsive prefixes (sm:, md:, lg:) for responsive design
- Create custom Tailwind components using
@applyin your CSS - Keep your Redux slices small and focused
- Consider using Redux Thunk or Redux Saga for async operations
If port 5173 is already in use, Vite will automatically use the next available port.
- Ensure content paths in
tailwind.config.jsare correct - Clear Tailwind cache:
rm -rf node_modules/.vite - Restart the dev server
Ensure Provider wraps your app in main.jsx and the store is properly configured.
Built with ❤️ using React, Redux, and Tailwind CSS






