A Fully accessible, interactive memory card matching game built with React. Test your memory by matching pairs of emojis across different categories!
The app allows users to select an emoji category and the number of cards, then play a classic memory matching game.
The goal of this project is to practice deploying a modern React application using Docker and GitHub Actions.
Visit the Memory Game on GitHub Pages.
demo.mov
-
Select Your Preferences
- Choose an emoji category (Animals, Food, Travel, Objects, or Symbols).
- Select the number of cards (10 to 50).
-
Start the Game
- Click "Start Game" to begin.
- All cards will be face down.
-
Match the Pairs
- Click on any card to reveal the emoji.
- Click on a second card to find its match.
- If they match, they stay revealed.
- If they don't match, they flip back over.
-
Win the Game
- Continue matching pairs until all cards are revealed.
- The game celebrates your victory! π.
-
Play Again
- Click "Play Again" to start a new game with different emojis.
-
Multiple Categories: Choose from 5 different emoji categories:
-
Animals and Nature π¦
-
Food and Drink π
-
Travel and Places
βοΈ -
Objects π¨
-
Symbols π£
-
-
Adjust Difficulty: Select from 10 to 50 cards.
-
Real-time Matching: Instant visual feedback for card selection and matches.
-
Smooth Animations: Card flip animations for an engaging user experience.
-
Game Completion Detection: Celebrates when all pairs are matched.
-
Full ARIA Support: Comprehensive screen reader compatibility.
-
Live Regions: Real-time game status updates for assistive technologies.
-
Keyboard Navigation: Complete keyboard accessibility.
-
Focus Management: Automatically handles focus for better UX.
-
Semantic HTML: Follows semantic heading structure and landmarks for screen readers.
-
API Integration: Dynamic emoji data from EmojiHub API.
-
Error Handling: Implemented Graceful error management with user-friendly messages.
-
Responsive Design: Mobile-first, works on all screen sizes.
-
Modern UI: Clean, minimalist interface with CSS animations.
-
Nostr Integration: Like button powered by Nostr protocol.
-
Custom Styling: Beautifully styled Nostr component with gradient effects.
flowchart TD
Start([Start Game])
FetchEmojis[Fetch Emojis from API]
Error[Show Error State]
Shuffle[Shuffle & Duplicate Emojis]
Render[Render Cards on UI]
Select[Player Selects Two Cards]
MatchCheck{Do Cards Match?}
UpdateMatch[Mark Cards as Matched]
Reset[Reset Selection]
AllMatched{All Pairs Matched?}
GameOver[Show Game Over Screen]
Start --> FetchEmojis
FetchEmojis -->|Success| Shuffle
FetchEmojis -->|Failure| Error
Shuffle --> Render
Render --> Select
Select --> MatchCheck
MatchCheck -->|Yes| UpdateMatch
MatchCheck -->|No| Reset
UpdateMatch --> AllMatched
Reset --> Render
AllMatched -->|No| Render
AllMatched -->|Yes| GameOver
| Category | Technologies |
|---|---|
| Frontend | React 19, HTML5, CSS3 |
| Build Tool | Vite 7.2.4 |
| Deployment | GitHub Actions, GitHub Pages |
| Containerization | Docker (Node.js 22 Alpine) |
| API | EmojiHub REST API |
| Dependencies | nostr-components, html-entities |
-
State Management: Complex state interactions with
useStatefor game logic. -
Effect Hooks:
useEffectfor side effects like match detection and game completion. -
Ref Hooks:
useReffor focus management and DOM manipulation. -
Component Composition: Building reusable, modular components.
-
Props Drilling: Efficient data flow through component hierarchy.
-
Conditional Rendering: Dynamic UI based on game state.
-
Async/Await: API data fetching with proper error handling.
-
Array Methods: Advanced use of
map,reduce,filter, andfind. -
Fisher-Yates Shuffle: Implementing proper randomization algorithm.
-
Random Selection: Generating unique random indices without duplicates.
-
ARIA Attributes: Proper use of
aria-live,aria-label,aria-atomic. -
Screen Reader Support: Comprehensive assistive technology compatibility.
-
Focus Management: Programmatic focus control for better UX.
-
Vite: Modern build tool configuration and optimization.
-
GitHub Actions: CI/CD pipeline for automated deployment.
-
GitHub Pages: Static site deployment with custom base path.
-
Docker: Containerization for consistent development environments.
-
Error Boundaries: Graceful error handling and user feedback.
-
Loading States: User-friendly loading and error states.
-
Code Organization: Clean file structure and separation of concerns.
-
DRY Principle: Reusable components and utility functions.
-
Git Workflow: Proper version control and deployment process.
Visit the Memory Game on GitHub Pages.
-
Error Handling: Try-catch blocks with user-friendly error messages.
-
Data Processing: Slicing, pairing, and shuffling API responses.
-
Dynamic Categories: Fetches emojis based on user-selected category.
-
Automated CI/CD: GitHub Actions workflow for testing and deployment.
-
Build Optimization: Vite's production build with code splitting.
-
Path Configuration: Proper base path setup for GitHub Pages subdirectory.
memory-game/
βββ src/
β βββ components/
β β βββ App.jsx # Main app component
β β βββ Form.jsx # Game setup form
β β βββ MemoryCard.jsx # Card container
β β βββ EmojiButton.jsx # Individual card button
β β βββ GameOver.jsx # Victory screen
β β βββ ErrorCard.jsx # Error display
β β βββ AssistiveTechInfo.jsx # Screen reader info
β β βββ Select.jsx # Form select component
β β βββ Option.jsx # Select options
β β βββ RegularButton.jsx # Reusable button
β βββ data/
β β βββ data.js # Game configuration data
β βββ index.jsx # React entry point
βββ .dockerignore # Docker ignore rules
βββ .github/
β βββ workflows/
β βββ node.js.yml # CI/CD workflow
βββ Dockerfile # Docker configuration
βββ index.html # HTML entry point
βββ index.css # Global styles
βββ vite.config.js # Vite configuration
βββ package.json # Project dependencies
- Node.js (v20.19.0+ or v22.12.0+)
- npm (v8.0.0+)
# Clone the repository
git clone https://github.com/gmarav005/memory-game.git
cd memory-game
# Install dependencies
npm install
# Start development server
npm run devThe game will be available at http://localhost:5173
# Build the Docker image
docker build -t memory-game .
# Run the container
docker run -p 5173:5173 memory-gameAccess the game at http://localhost:5173
| Command | Description |
|---|---|
npm run dev |
Start development server with hot reload |
npm run build |
Build optimized production bundle |
npm run preview |
Preview production build locally |
npm run lint |
Run ESLint for code quality checks |
npm run deploy |
Deploy to GitHub Pages |
npm test |
Run tests (placeholder for future tests) |
The project includes a Dockerfile for containerized development:
-
Uses Node.js 22 Alpine for minimal image size.
-
Exposes port 5173 for development server.
-
Includes
.dockerignoreto exclude unnecessary files.
The project uses GitHub Actions for automated deployment:
-
Pushes to
mainbranch trigger the CI/CD pipeline. -
Runs tests (currently placeholder).
-
Builds the production bundle.
-
Deploys to GitHub Pages automatically.
-
EmojiHub API for emoji data.
-
Nostr Components for social integration.
- The project demonstrates best practices in React, accessibility, containerization, and CI/CD.
- The code is modular, easy to extend, and open for contributions.
Accessibility Focus: Every part of the UI is accessible by keyboard and provides live updates for screen readers.
| Feature | Description |
|---|---|
| βΏ Accessibility First | Every UI element is keyboard accessible with screen reader support |
| π³ Docker Ready | Containerized for consistent development across environments |
| π Auto Deploy | CI/CD pipeline automatically deploys on every push |
| π¨ Modern Stack | Built with React 19, Vite, and modern web standards |
Made with β€οΈ and React | Deployed with GitHub Actions | Powered by EmojiHub API
Enjoy your game! π§ π

