mohsen1/mafiaarena

★ 0Forks 0TypeScriptGitHub ↗Compare

README

Mafia Arena

A sophisticated AI-driven Mafia game simulation where LLM agents play against each other.

Architecture

  • Monorepo: Managed with pnpm workspaces.
  • Frontend: React (Vite) in frontend/.
  • Backend: Cloudflare Workers + Hono + Durable Objects in backend/.
  • Database: Cloudflare D1 (SQLite).
  • AI: Google Gemini (via Google Gen AI SDK).

Prerequisites

  • Node.js v20+
  • pnpm (npm install -g pnpm)
  • Cloudflare Wrangler CLI (npm install -g wrangler)
  • GitHub CLI (brew install gh) - Optional, for repo setup.

Quick Start

1. One Command to Rule Them All

Just run:

pnpm dev

This magic command will:

  1. Check for secrets: It will try to fetch secrets or create a dummy .env if missing.
  2. Sync Environment: It ensures the backend has the correct .dev.vars.
  3. Start Everything: It launches both the Frontend (localhost:3000) and Backend (localhost:8787) in parallel.

2. Setup GitHub (Optional)

To easily create a private GitHub repository and sync your local secrets:

./scripts/setup-github.sh

Testing

Run End-to-End Tests:

pnpm test:e2e

Pre-commit Hooks: Husky is configured to run linting on staged files before commit.

Deployment

Deployment is automated via GitHub Actions on push to main.

To deploy manually:

pnpm deploy

Contributors

mohsen1

Issues