Skip to content

jx-grxf/Netjack

Netjack

Real-time multiplayer Blackjack for local networks

TypeScript React Vite Node.js Express Socket.IO Tailwind CSS License

Netjack is a local-network Blackjack game with a server-authoritative rules engine, a realtime client, and a shared lobby flow for hosts and players.

It is built for LAN sessions, classroom play, and small trusted networks. It is not a public gambling service.


Showcase

Lobby

Netjack showcase

Game

Game


Contents


Highlights

Feature Description
Lobby flow Host-and-join flow with short lobby codes
Rules Server-authoritative turn validation and Blackjack logic
Actions Split and double-down support
Realtime Live lobby chat and round event log
Stats Round summary and admin stats endpoint
Workspace npm workspaces split into client and server

Why This Exists

Netjack exists because the game should feel quick, local, and social without requiring a hosted backend.

The project focuses on:

  • one host machine
  • one shared local network
  • a short code instead of account sign-in
  • simple rules that stay consistent on the server

The result is a lightweight Blackjack table that works in the room, not in a cloud account.


Current Workflow

  1. Start the root dev command.
  2. The server listens on port 3001 and the client on port 5173.
  3. One player hosts a lobby and gets a 6-character code.
  4. Other players join from the same LAN.
  5. The server validates every move and broadcasts state updates to the client.

Tech Stack

Layer Technologies
Frontend React 18, Vite 5, TypeScript, Tailwind CSS
Backend Node.js 20, Express 4, Socket.IO 4, TypeScript, Vitest
Tooling npm workspaces, concurrently

Requirements

  • Node.js 20.x
  • npm 9+
  • a shared local network for host and players

Quick Start

npm ci
npm run dev

Then open:


Configuration

Safe environment templates are included in the repo:

Template Purpose
.env.server.example Server environment variables
.env.client.example Client environment variables

Recommended setup:

  1. Copy server values into a local server env file or shell session.
  2. Copy client values into client/.env.local.
  3. Keep secrets out of git.

Security defaults:

  • the admin endpoint is off unless ADMIN_ENABLED=true
  • CORS is restricted to CLIENT_URLS
  • no default admin credentials are baked into runtime

Usage

  1. Start the app with npm run dev.
  2. On the host machine, create a lobby.
  3. Share the 6-character code with other players.
  4. Join from another device on the same network.
  5. Play rounds and use chat or round history as needed.

For local network testing, the host IP can be found with:

# macOS
ipconfig getifaddr en0

# Linux
hostname -I

# Windows (PowerShell)
ipconfig

Development

Useful commands:

npm run check
npm run test
npm run build
npm run ci

Workspace-specific commands:

npm run dev -w server
npm run dev -w client
npm run test -w server
npm run check -w client

Roadmap

  • tighten mobile layout behavior for cramped LAN sessions
  • improve admin visibility for round diagnostics
  • add more round-history and analytics views
  • keep the rules engine and UI aligned as the game evolves

License

MIT

About

Real-time LAN Blackjack game built with TypeScript, React, and Socket.IO.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages