A developer-themed memory card matching game built with React and TypeScript. Flip cards to match programming questions with their answers — and race against yourself to match them all!
- Choose a difficulty level
- Cards start face-down — click any card to flip it
- Try to find its matching pair (question ↔ answer)
- Match all pairs to win 🎉
- 4 difficulty levels — Easy Peasy → Unforgettable
- Dynamic flashcard data fetched from an Express backend per level
- Skeleton loading screen while cards are being fetched
- Confetti celebration on every matched pair via
canvas-confetti - Win screen with a Play Again option
| Tool | Purpose |
|---|---|
| React 19 | UI and state management |
| TypeScript | Type safety |
| Vite | Dev server and bundler |
canvas-confetti |
Confetti effect on match |
| Tool | Purpose |
|---|---|
| Express | REST API serving flashcard JSON files |
| TypeScript | Typed backend |
cardStateenum — models card state as a sum type (faceDown,FaceUpUnmatched,FaceUpMatched) instead of multiple booleans — "Make Invalid State Unrepresentable"- Fisher-Yates shuffle — for fair, unbiased card randomization
useCallback— memoizesonCardClickto prevent unnecessary re-rendersmemo()— wraps theCardcomponent so only changed cards re-render- Functional updater pattern —
setCards(prev => ...)used insideuseCallbackto avoid stale closure bugs flatMap— generates question + answer card pairs from each flashcard item- Dynamic API routing — backend serves different JSON files based on level parameter (
/api/JsonFile/:level)
├── src/
│ ├── components/
│ │ ├── card.tsx # Memoized card component
│ │ ├── card.css
│ │ ├── skeletonCard.tsx # Skeleton loader grid
│ │ └── skeletonCard.css
│ ├── App.tsx # Main game logic
│ └── main.tsx
├── type.ts # Shared CardType, FlashcardItem, cardState
└── vite.config.ts
- Node.js
- Backend server running on
http://localhost:3000
# Install dependencies
npm install
# Start the frontend
npm run devRaghad — junior frontend developer, currently in a structured mentorship program through Wasla Connect, building real projects with React and TypeScript.