DEFCON RED is a presidential crisis simulator built on Reddit Devvit Web. You receive fragmented intelligence about an inbound strategic threat, interrogate advisors, open hotlines, and issue military/civil-defense commands under severe time pressure.
- React webview client (
src/client) - Express-style serverless backend (
src/server) - Shared game/types layer (
src/shared) - Scenario system with:
- built-in scenarios
- generated scenario support
- declarative scenario DSL runtime
- Devvit Web
- TypeScript
- React + Vite
- Express (server routes)
- Redis (via Devvit server capabilities)
- Google Gemini API (optional but recommended for AI dialogue generation)
- Node.js 22+
- A Reddit account with Devvit access
- Devvit CLI (via
npx devvit)
- Install dependencies:
npm install
- Log in to Devvit:
npx devvit login
- Build once:
npm run build
- Start a playtest install:
npx devvit playtest
If you do not configure Gemini, the game still runs using fallback text responses.
This project expects the key in a Devvit global secret setting named geminiApiKey (defined in devvit.json).
After at least one app installation exists (e.g. after npx devvit playtest), set your key:
npx devvit settings set geminiApiKey
The CLI will prompt you for the value securely.
You can verify settings definitions with:
npx devvit settings list
If you plan to use the admin AI scenario publishing command, set allowed usernames:
npx devvit settings set scenarioDslAdmins
Use a comma-separated list, for example:
alice,bob,carol
- Do not hardcode API keys in source files.
- Do not commit
.envfiles or secret exports. - Rotate your Gemini key immediately if you suspect exposure.
- Keep production keys in Devvit secrets/settings only.
npm run dev- run client/server/devvit together for local iterationnpm run build- build client and server bundlesnpm run test:harness- run gameplay regression harness testsnpm run check- type-check, lint, and format checksnpm run deploy- upload app versionnpm run launch- publish app
src/client- webview UIsrc/server- backend routes, game loop, AI integrationssrc/shared- shared game types and scenario definitionstests/harness- deterministic simulation and parser/order/runtime tests
BSD-3-Clause (see LICENSE).