๐ฏ Classic Gameplay - Traditional minesweeper rules with modern UX
๐ Dark/Light Mode - Beautiful themes that adapt to your preference
๐ฑ Mobile Optimized - Responsive design that works perfectly on all devices
๐พ Save/Resume - Automatic game state persistence using localStorage
๐จ Smooth Animations - Framer Motion powered transitions and effects
๐ฅ Modern Tech Stack - Built with Next.js 15, TypeScript, and Tailwind CSS
๐ Google Analytics - Comprehensive event tracking for insights
๐ PWA Ready - Installable as a Progressive Web App
โฟ Accessible - WCAG compliant with keyboard navigation support
- Left Click - Reveal a cell
- Right Click - Flag/unflag a suspected mine
- Middle Click - Chord click (reveal all adjacent cells when flags match mine count)
- Goal - Reveal all non-mine cells without hitting a mine
- Numbers indicate how many mines are adjacent to that cell
- Use logic and deduction to identify mine locations
- Flag suspected mines to help track your progress
- Game is won when all non-mine cells are revealed
- Node.js 18.0 or later
- npm, yarn, pnpm, or bun
# Clone the repository
git clone https://github.com/yourusername/minesweeper.git
cd minesweeper
# Install dependencies
npm install
# Start the development server
npm run devOpen http://localhost:3000 to play the game locally.
| Script | Description |
|---|---|
npm run dev |
Start development server with hot reload |
npm run build |
Build the app for production |
npm run start |
Start the production server |
npm run lint |
Run ESLint for code quality checks |
- Next.js 15 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- Framer Motion - Animation library
- Lucide React - Beautiful SVG icons
- @next/third-parties - Google Analytics integration
- Comprehensive metadata - Open Graph, Twitter Cards, structured data
- SEO optimized - Sitemap, robots.txt, canonical URLs
- ESLint - Code linting and quality
- PostCSS - CSS processing
- Git - Version control
minesweeper/
โโโ src/
โ โโโ app/ # Next.js app directory
โ โ โโโ layout.tsx # Root layout with metadata
โ โ โโโ page.tsx # Home page
โ โ โโโ globals.css # Global styles
โ โ โโโ sitemap.ts # Dynamic sitemap generation
โ โโโ components/ # React components
โ โ โโโ GameBoard.tsx # Main game board grid
โ โ โโโ GameCell.tsx # Individual cell component
โ โ โโโ GameControls.tsx # Game controls and stats
โ โ โโโ GameHeader.tsx # Header component
โ โ โโโ GameModal.tsx # Win/lose modal
โ โ โโโ GameTitle.tsx # Title and description
โ โ โโโ MinesweeperGame.tsx # Main game logic wrapper
โ โ โโโ ThemeProvider.tsx # Dark/light mode provider
โ โโโ lib/ # Utility functions
โ โโโ game-logic.ts # Core game mechanics
โ โโโ utils.ts # Helper utilities
โโโ public/ # Static assets
โ โโโ icon.svg # App icon
โ โโโ apple-icon.svg # Apple touch icon
โ โโโ favicon.svg # Favicon
โ โโโ og-image.svg # Open Graph image
โ โโโ manifest.json # PWA manifest
โ โโโ robots.txt # SEO robots file
โโโ package.json # Dependencies and scripts
- Random mine generation using seeded algorithms for reproducible games
- Flood fill algorithm for revealing connected empty cells
- Chord clicking for advanced gameplay
- Win condition detection based on revealed non-mine cells
- Save/resume functionality with localStorage persistence
initializeBoard()- Creates game board with minesrevealCell()- Handles cell revelation with flood fillflagCell()- Toggles flag state on cellscheckWinCondition()- Determines if player has won
The game tracks user engagement through Google Analytics:
- Game Start - When first cell is clicked
- Game Won/Lost - With completion time and stats
- Game Reset - From different UI elements
- Modal Interactions - Close and new game actions
The game supports both light and dark themes with:
- System preference detection - Automatically matches OS theme
- Manual toggle - Theme switcher in game controls
- Persistent preference - Remembers user choice
- Smooth transitions - Animated theme changes
# Build the project
npm run build
# Deploy to Vercel
npx vercel --prodThe app is configured for minesweeper.sugarandcoffee.co.uk:
- Update
metadataBaseinsrc/app/layout.tsxfor your domain - Modify
robots.txtandsitemap.tswith your URLs - Configure DNS and SSL certificates
Contributions are welcome! Please feel free to submit a Pull Request.
- Code Style - Follow the existing TypeScript/React patterns
- Components - Keep components focused and reusable
- Testing - Ensure game logic works correctly
- Performance - Maintain smooth 60fps animations
- Accessibility - Support keyboard navigation and screen readers
This project is open source and available under the MIT License.
- Classic Minesweeper - For the timeless game design
- Next.js Team - For the amazing React framework
- Tailwind CSS - For the utility-first CSS approach
- Framer Motion - For smooth animations
- Lucide - For beautiful icons
๐ฎ Play Now | ๐ Report Bug | ๐ก Request Feature
Made with โค๏ธ and โ