Dungeons & Ground
An English-first, invite-only web alpha for asynchronous text TTRPG campaigns. Players create private worlds with an AI coauthor, submit actions into shared rounds, and play alongside persistent AI companions. The rules engine—not the language model—owns dice and mechanical state.
Local start
cp .env.example .env
pnpm install
pnpm dev:all
Open http://localhost:3000. pnpm dev:all starts the Nuxt site and the AI worker in one terminal. To run them separately, use pnpm dev in the first terminal and pnpm dev:worker in the second.
The web and worker commands both load this root .env file explicitly. Environment variables supplied by Railway or CI take precedence over values in the file.
The static demo UI can be built and tested without credentials. A production Nitro server and every worker process require SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, NUXT_PUBLIC_SUPABASE_URL, and NUXT_PUBLIC_SUPABASE_ANON_KEY; startup fails with a clear error when required server credentials are missing. Redis is optional: when REDIS_URL is absent, the worker safely claims jobs from the Supabase ai_jobs outbox using short database leases and retries failed jobs up to three times.
Select OpenRouter or the official DeepSeek API with AI_PROVIDER=openrouter|deepseek and provide the matching API key. OpenRouter retains JSON Schema structured output; DeepSeek uses its official JSON mode, followed by the same Zod validation.
Use Node.js 18.20.5 or newer. The lockfile pins the web toolchain to the Node 18-compatible Nuxt 3.15, Nitro 2.10, and Vite 6 line; CI verifies the project on Node 18.20.8.
Workspace
apps/web— Nuxt SSR UI and Nitro APIapps/worker— BullMQ worker for AI world and round jobspackages/shared— shared Zod contracts and domain typespackages/game-engine— deterministic d20 rules and state transition guardssupabase/migrations— PostgreSQL schema, indexes, triggers, and RLS policies
Alpha safety
- Worlds are private by default.
- Content is limited to 13+; explicit sexual content and sexual content involving minors are rejected.
- AI responses are parsed against strict schemas.
- AI can propose checks and events, but cannot directly set dice outcomes or mechanical values.
- SRD-derived work must retain the attribution in
LEGAL.md.
Production services
- Create a Supabase project and apply
supabase/migrations/0001_alpha_schema.sql, thensupabase/migrations/0002_supabase_ai_queue.sql, and finally the seed file. If0001was already applied earlier, apply only0002; it adds the Supabase-backed worker queue and reloads the REST API schema cache. - Add invited tester emails to
public.allowlist. - Run
pnpm dev:workeralongside the web process. Provision Redis only when BullMQ delivery is desired; otherwise the worker polls the Supabase outbox. - Configure either
OPENROUTER_API_KEY(default modeldeepseek/deepseek-v4-flash) or setAI_PROVIDER=deepseekwithDEEPSEEK_API_KEY(default modeldeepseek-v4-flash, endpointhttps://api.deepseek.com/chat/completions).
If the worker reports POST /rest/v1/rpc/claim_ai_job 404, the database is missing migration 0002_supabase_ai_queue.sql. Run that file in the Supabase SQL Editor and restart pnpm dev:all.
The current UI intentionally includes a complete local vertical slice. Production auth/session binding and queue-enqueue endpoints should be connected to the supplied schema before inviting external users.