Skip to content

reddit/devvit-defcon-red-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEFCON RED

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.

What This Repo Includes

  • 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

Tech Stack

  • Devvit Web
  • TypeScript
  • React + Vite
  • Express (server routes)
  • Redis (via Devvit server capabilities)
  • Google Gemini API (optional but recommended for AI dialogue generation)

Requirements

  • Node.js 22+
  • A Reddit account with Devvit access
  • Devvit CLI (via npx devvit)

Quick Start

  1. Install dependencies:
    • npm install
  2. Log in to Devvit:
    • npx devvit login
  3. Build once:
    • npm run build
  4. Start a playtest install:
    • npx devvit playtest

If you do not configure Gemini, the game still runs using fallback text responses.

Gemini API Key Setup (For Forks)

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

Security Notes

  • Do not hardcode API keys in source files.
  • Do not commit .env files or secret exports.
  • Rotate your Gemini key immediately if you suspect exposure.
  • Keep production keys in Devvit secrets/settings only.

Development Commands

  • npm run dev - run client/server/devvit together for local iteration
  • npm run build - build client and server bundles
  • npm run test:harness - run gameplay regression harness tests
  • npm run check - type-check, lint, and format checks
  • npm run deploy - upload app version
  • npm run launch - publish app

Project Structure

  • src/client - webview UI
  • src/server - backend routes, game loop, AI integrations
  • src/shared - shared game types and scenario definitions
  • tests/harness - deterministic simulation and parser/order/runtime tests

License

BSD-3-Clause (see LICENSE).

About

A devvit game where you find it if you're a good president.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages