Spades Online is a single Node.js process that serves the web client, HTTP API, and WebSocket connections all on one port — no separate build step required. It can be deployed as a unified service on any Node.js host, or split across two platforms: Vercel handles the static web client and HTTP API routes while Railway runs the WebSocket server separately. Both models are fully supported and share the same codebase.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.
Prerequisites
Before deploying, make sure you have the following ready:- Node.js 18+ — the server is ES Module-only (
"type": "module") and targets Node.js 18 or later - PostgreSQL — any cloud-managed instance (Railway, Supabase, Neon, RDS) or self-hosted; used for persistent player and game data
- Redis — any cloud-managed instance (Railway, Upstash, Redis Cloud) or self-hosted; used for session state, lobby presence, pub/sub, and rate limiting
- Self-Hosted
- Railway
- Vercel + Railway (Split Host)
Deploy Spades Online on your own Linux server (or any machine with Node.js installed) behind a reverse proxy for TLS termination.This runs
Set environment variables
Export the required variables before starting the server. At minimum, See the full environment variable reference below for the complete list of optional variables.
DATABASE_URL and REDIS_URL are required:Start the server
node server/app.js. The server listens on PORT (default 3000) and serves the web client, all API routes, and the WebSocket endpoint on the same port.Configure a reverse proxy for TLS
For production, run Spades Online behind nginx or Caddy to handle TLS termination and forward traffic to the Node.js process.Example Caddy configuration:
WebSocket upgrade requests are proxied automatically by both nginx and Caddy when using a standard
reverse_proxy or proxy_pass directive — no special WebSocket-specific configuration is needed as long as the WebSocket server shares the HTTP port (the default).Environment Variables
The full set of environment variables supported by Spades Online:| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | Yes | — | PostgreSQL connection string |
REDIS_URL | Yes | — | Redis connection string |
PORT | No | 3000 | HTTP server port |
WS_PORT | No | Same as PORT | WebSocket server port. Defaults to sharing the HTTP server. Set to a different port to run WebSocket on a dedicated server (requires a reverse proxy to route WebSocket upgrades). |
WS_URL | No | Derived from request origin | Full WebSocket base URL (e.g. wss://my-app.up.railway.app). Required in split-host deployments. Injected as window.__WS_URL__ in the served HTML. |
NODE_ENV | No | — | Environment name (development, production) |
APP_URL | No | http://localhost:3000 | Public base URL used in verification emails and join links |
EMAIL_HOST | No | — | SMTP host. If unset, verification emails are logged to stdout |
EMAIL_PORT | No | 587 | SMTP port |
EMAIL_SECURE | No | false | Set true for TLS on port 465 |
EMAIL_USER | No | — | SMTP username |
EMAIL_PASS | No | — | SMTP password |
EMAIL_FROM | No | noreply@spades.online | From address for outbound email |
GIT_COMMIT_SHA | No | — | Current commit SHA (set by CI). Falls back to VERCEL_GIT_COMMIT_SHA, then COMMIT_REF, then git rev-parse HEAD |
AUTH_RATE_LIMIT_MAX | No | 10 | Max auth requests per window |
AUTH_RATE_LIMIT_WINDOW | No | 900 | Rate limit window in seconds (default: 15 minutes) |
DEV_AUTO_VERIFY | No | — | Skip email verification on registration. Local dev only. |
Rate Limiting
Spades Online uses a Redis-backed fixed-window rate limiter on authentication endpoints. The limiter tracks requests per IP address using a Redis key with an automatic TTL. The defaults are configurable via environment variables:| Variable | Default | Description |
|---|---|---|
AUTH_RATE_LIMIT_MAX | 10 | Maximum number of requests allowed per window |
AUTH_RATE_LIMIT_WINDOW | 900 | Window duration in seconds (900 s = 15 minutes) |
429 with the response body:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed in the window |
X-RateLimit-Remaining | Requests remaining in the current window |
X-RateLimit-Reset | Unix timestamp when the window resets |
If Redis is not configured (
REDIS_URL is not set), the rate limiter middleware is bypassed and all requests are passed through without limiting. Ensure Redis is available in all production environments.Health Check
The server exposes a lightweight build-info endpoint that can be used as a health check or version probe:GIT_COMMIT_SHA is not set and the SHA cannot be resolved from the environment or git rev-parse HEAD, the response is { "commitShort": null }.
Use this endpoint in your load balancer, uptime monitor, or deployment pipeline to confirm the correct version is running after a deploy.