blackjack-test
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://stevekrouse--18b7c2a655f211f0b92ff69ea79377d9.web.val.run
A multiplayer blackjack game where players can join rooms and play together against the dealer.
- Multiplayer gameplay - Multiple players in the same room
- Room-based system - Join or create game rooms
- Real-time updates via polling (no websockets needed)
- Turn-based play - Players take turns in order
- Automatic dealer play when all players are done
- SQLite backend for game state persistence
- Clean, responsive interface
- Enter a room name to join or create a game
- Wait for other players to join
- When it's your turn, choose Hit or Stand
- Try to get as close to 21 as possible without going over
- After all players finish, dealer plays automatically
- Winners are determined and a new round can begin
- Backend: Hono API with SQLite database
- Frontend: Vanilla JavaScript with polling for updates
- State Management: All game state stored in SQLite
- Real-time: 2-second polling for game updates
├── backend/
│ ├── database/
│ │ ├── migrations.ts # Database schema
│ │ └── queries.ts # Database operations
│ ├── routes/
│ │ ├── game.ts # Game API endpoints
│ │ └── static.ts # Static file serving
│ └── index.ts # Main Hono app
├── frontend/
│ ├── components/
│ │ └── Game.js # Game component logic
│ ├── index.html # Main interface
│ ├── script.js # Frontend entry point
│ └── style.css # Styling
├── shared/
│ └── types.ts # Shared type definitions
└── README.md