A desktop blackjack game built with Next.js and Tauri, featuring a modern UI and full game logic.
Game logic based on the Node.JS version made before.
- Complete Blackjack Game: Full implementation of blackjack rules including hitting, standing, and dealer AI
- Modern UI: Clean, responsive interface with Tailwind CSS
- Keyboard Shortcuts: Quick actions with D (Deal), H (Hit), S (Stand)
- Visual Feedback: Card animations and winner indicators
- Desktop Native: Runs as a native desktop application using Tauri
- Frontend: Next.js 15 with React 19 and TypeScript
- Styling: Tailwind CSS
- Desktop Framework: Tauri 1.x (Rust backend)
- Game Logic: Custom TypeScript implementation
Before running this project, make sure you have the following installed:
- Node.js (v18 or higher)
- npm or yarn
- Rust (latest stable version)
- Cargo (comes with Rust)
On Arch Linux, you'll need:
sudo pacman -S webkit2gtkOn other Linux distributions, install the equivalent webkit2gtk package.
git clone <your-repo-url>
cd taurijacknpm installnpm run devThis starts the Next.js development server at http://localhost:3000
npm run tauri:devThis builds and runs the desktop application with hot reload.
npm run build
npm startnpm run tauri:buildThis creates platform-specific installers in src-tauri/target/release/bundle/
- Start a Game: Click "Deal" or press
Dto begin - Hit: Click "Hit" or press
Hto draw another card - Stand: Click "Stand" or press
Sto end your turn - Win Conditions:
- Get 21 (Blackjack!)
- Have a higher total than the dealer without going over 21
- Dealer busts (goes over 21)
- Dealer must hit on 16 and stand on 17
- Aces are worth 1 or 11 (automatically optimized)
- Face cards (J, Q, K) are worth 10
- Number cards are worth their face value
taurijack/
โโโ src/
โ โโโ app/ # Next.js app directory
โ โ โโโ page.tsx # Main game page
โ โ โโโ globals.css # Global styles
โ โโโ components/ # React components
โ โ โโโ BlackjackGame.tsx
โ โ โโโ Card.tsx
โ โ โโโ Hand.tsx
โ โโโ hooks/ # Custom React hooks
โ โ โโโ useBlackjack.ts
โ โโโ lib/ # Game logic
โ โโโ blackjack.ts
โโโ src-tauri/ # Tauri backend
โ โโโ src/
โ โ โโโ main.rs
โ โ โโโ lib.rs
โ โโโ Cargo.toml
โ โโโ tauri.conf.json
โโโ public/ # Static assets
โโโ package.json
npm run dev- Start Next.js development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run tauri:dev- Start Tauri developmentnpm run tauri:build- Build Tauri app for distribution
BlackjackGame: Main game component with UI and controlsuseBlackjack: Custom hook managing game state and actionsblackjack.ts: Core game logic (deck, hands, scoring)Card&Hand: Reusable UI components for displaying cards
The app uses Tailwind CSS. Modify src/app/globals.css for global styles or update component classes for specific styling.
Game rules and logic are in src/lib/blackjack.ts. You can modify:
- Deck creation and shuffling
- Scoring rules
- Dealer behavior
- Win conditions
Desktop app settings are in src-tauri/tauri.conf.json:
- Window size and properties
- App permissions
- Build settings
- Bundle configuration
"webkit2gtk-4.1 not found"
- This project uses Tauri 1.x which works with webkit2gtk-4.0
- Make sure you have
webkit2gtkinstalled on your system
Build Errors
- Ensure Rust and Cargo are up to date:
rustup update - Clean and rebuild:
cargo clean && npm run tauri:dev
Port Already in Use
- If port 3000 is busy, change it in
next.config.tsor kill the existing process
This project is open source and available under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Enjoy playing Blackjack! ๐
