A Sudoku game with Lightning payments via Money Dev Kit. Players can purchase additional lives when they run out.
- 9×9 Sudoku puzzles with three difficulty levels
- Lives system - start with 2 free lives
- Lightning payments to purchase additional lives (1,500 sats per life)
- Score tracking with animations
- AI-powered Sudoku tutor (Howie) - get guided help without revealing answers
- LocalStorage persistence
- Clean, minimal UI
- Node.js 18+
- Money Dev Kit account (get credentials from moneydevkit.com or run
npx @moneydevkit/create)
- Install dependencies:
npm install- Create
.env.localfile with your Money Dev Kit credentials and OpenAI API key:
MDK_ACCESS_TOKEN=your_api_key_here
MDK_MNEMONIC=your_mnemonic_here
REDIS_URL=your_redis_url_here
OPENAI_API_KEY=your_openai_api_key_hereNote: For local development, you can use a local Redis instance or a service like Upstash for a free Redis database. The REDIS_URL is required for payment verification webhooks to work.
- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
- Push your code to GitHub
- Import the project in Vercel
- Add environment variables in Vercel dashboard:
MDK_ACCESS_TOKENMDK_MNEMONICREDIS_URL(required for payment verification - use Vercel Redis or Upstash)OPENAI_API_KEY(required for the Sudoku tutor chatbot feature)
- Configure webhook in MoneyDevKit dashboard:
- Go to your MoneyDevKit dashboard
- Set webhook URL to:
https://your-domain.com(root URL) - This allows the server to verify payments and grant lives securely
- Deploy!
satdoku/
├── app/ # Next.js App Router
│ ├── page.js # Main game page
│ ├── layout.js # Root layout
│ ├── checkout/[id]/ # MDK checkout page
│ ├── purchase-success/ # Payment success handler
│ └── api/mdk/ # MDK API endpoint
├── components/ # React components
│ ├── GameBoard.jsx
│ ├── StatsBar.jsx
│ ├── GameControls.jsx
│ ├── PurchaseLifeModal.jsx
│ └── Modals/
├── lib/ # Utility modules
│ ├── redis.js # Redis client for payment verification
│ └── webhookHandler.js # Webhook handling utilities
└── src/js/ # Game logic (unchanged)
├── core/ # Core game logic
├── system/ # Utilities
└── ui/ # UI helpers
- Player starts with 2 free lives
- When a mistake is made, player loses a life
- When lives reach 0, a purchase modal appears
- Player can purchase a life via Lightning payment (1,500 sats)
- After successful payment, life is added and gameplay resumes
- AI chatbot tutor (Howie) provides helpful guidance during gameplay without revealing answers
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production server