Spades Online is a production-ready, self-hosted multiplayer card game server built on Node.js and Express. It ships with a real-time WebSocket engine, a Redis-backed lobby and presence system, a PostgreSQL persistence layer, and a fully functional Vanilla JS single-page web client — everything you need to run a complete 4-player Spades game platform. It is aimed at developers who want to self-host the game, integrate the API into their own frontend, or extend the platform with new features.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Antonelli-Tech-Solutions/spades/llms.txt
Use this file to discover all available pages before exploring further.
Key Features
Real-Time WebSocket Gameplay
Every game action — bids, card plays, trick completions, and score updates — is pushed to all connected clients instantly over WebSocket. The server shares the HTTP port by default and can be split to a dedicated port via
WS_PORT.Table Lobby System
Players create and browse tables with configurable visibility (
public, friends-only, private) and join policies (open, friends-only, invite-only). The lobby updates in real time via Redis pub/sub so clients always see live seat counts and table status.Friends & Social System
Full friend request, accept, decline, and removal flow backed by PostgreSQL. Friends see each other’s presence status (
online, in-game, offline) and can navigate directly to a friend’s table. Player blocking is also supported.Bot Players
The table host can fill any empty seat with a bot at any time. Bots bid by counting spades in hand and play a random legal card. Bot turns are processed server-side automatically so human players never wait on a bot action.
Anti-Cheat Validation
Every bid and card play is validated server-side before being accepted. The server enforces turn order, suit-following rules, spades-breaking rules, and Blind Nil eligibility — clients cannot submit illegal moves.
Redis Pub/Sub Scalability
Lobby events, personal notifications (friend requests, invites, kicks), and presence updates all route through Redis pub/sub channels. This means multiple server instances can share a single Redis and WebSocket events reach the correct players regardless of which instance handles the request.
Tech Stack
| Layer | Technology |
|---|---|
| Server | Node.js 18+ · Express · ES Modules (no build step) |
| Real-time | WebSocket (ws library) — shares HTTP server by default; configurable via WS_PORT |
| Session / Presence / Pub-Sub | Redis |
| Persistent storage | PostgreSQL |
| Web client | Vanilla JS SPA (hash router, no build step) |
Project Structure
The repository is organized into four top-level directories:server/ for all backend logic, client/ for the browser SPA, db/ for SQL migrations, and test/ for unit and integration test suites. The server itself is further split into focused modules for authentication, social features, game state, the lobby, WebSocket handling, and anti-cheat validation.
Full directory layout
Full directory layout
Next Steps
Quickstart
Clone the repo, run migrations, and have a local game server running in five steps.
Configuration
Full reference for every environment variable the server reads at startup.
Architecture
Deep dive into how the WebSocket engine, Redis pub/sub, and game state machine fit together.
API Reference
Complete HTTP and WebSocket API documentation for all endpoints.