onlinemafia

Texting Mafia

Realtime browser game inspired by Mafia, played through public and private text chat.

This repo is set up for:

Gameplay Implemented

Deploy Backend (Cloudflare Workers)

  1. Install Wrangler:
npm install --save-dev wrangler
  1. Authenticate with Cloudflare:
npx wrangler login
  1. Deploy:
npx wrangler deploy --config worker/wrangler.jsonc
  1. Copy the deployed Worker URL (for example https://texting-mafia-backend.<subdomain>.workers.dev).

Deploy Frontend (GitHub Pages)

This repo includes a GitHub Actions workflow at:

Steps:

  1. Push this repository to GitHub.
  2. In GitHub repo settings, open Pages.
  3. Set source to GitHub Actions.
  4. Push to main (or master) to trigger deployment.
  5. Open your Pages site URL.

Connect Frontend To Backend

On the menu screen:

  1. Paste your Worker URL into Backend URL.
  2. Click Save.
  3. Create or join a lobby.

The frontend saves this backend URL in local browser storage.

Project Layout