Skip to content

3031 source-verified AI-built games from 2724 repos, attributed to GPT-6 Astra, GPT-6.1 Sol, Gemini 4 Argon, Claude Opus, Claude Sonnet and Claude Fable

19.8 KB
Raw Blame
{
  "repo": "aniketchauhan-star/game-dev",
  "created_at": "2026-10-04T09:09:43Z",
  "pushed_at": "2026-10-04T09:09:54Z",
  "description": null,
  "homepage": null,
  "default_branch": "main",
  "language": "TypeScript",
  "readme": "# NEXUS Play Studio\n\n**From slides to playable learning.** A local, single-creator studio that turns a PowerPoint lesson into a\nplayable learning game:\n\n**Import deck → Review learning content → Describe game → Approve blueprint → Build → Playtest → Refine → Export**\n\nClaude (through the official Anthropic TypeScript SDK, on the server only) proposes the learning map, the\nblueprint and refinements. You review and approve everything; games are built by trusted templates from\nvalidated data, never from generated code.\n\nThree mechanics are fully playable: **coordinate navigation**, **drag-and-match** and **sequence sorting**.\nAny other idea gets an editable, approvable blueprint and a **developer handoff** instead of a fake game.\n\nOne project can also combine a **Figma design** (read-only; or exported screens), your **artwork** (including\nChatGPT-made art, sprite frames and clips) and a **grade** (with separate grade versions), map them screen by\nscreen, and **animate** the game with validated motion presets — see\n[docs/DESIGN_GRADE_MOTION.md](docs/DESIGN_GRADE_MOTION.md).\n\n---\n\n## Contents\n\n- [What works](#what-works)\n- [Requirements](#requirements)\n- [Quick start](#quick-start)\n- [Configuration](#configuration)\n- [Connecting Claude](#connecting-claude)\n- [Optional slide rendering](#optional-slide-rendering)\n- [Scripts](#scripts)\n- [Exports](#exports)\n- [Architecture](#architecture)\n- [Security model](#security-model)\n- [Hosting boundaries](#hosting-boundaries)\n- [Testing](#testing)\n- [Screenshots](#screenshots)\n- [Known limitations](#known-limitations)\n- [Project layout](#project-layout)\n\n## What works\n\n| Area | Status |\n| --- | --- |\n| Dashboard: search, rename, duplicate (deep copy), confirmed delete, bundled sample | Working |\n| Create flow (Source → Game brief → Visual direction → Review), autosaved | Working |\n| PPTX ingestion (order, hidden slides, notes, tables, images, groups, equations, warnings, limits, malicious-package rejection) | Working |\n| Optional PDF export as visual reference | Working |\n| Source review: search, filters, edits with history and revert, locks, required examples, review labels, coverage, stale invalidation | Working |\n| Hand-authored blueprint (no AI): edit overview and scenes, approve (immutable), build | Working |\n| Claude analysis, blueprint generation, scene regeneration, refinement, Q&A | Implemented against the real SDK; **tested only against a local mock of the API** — needs your key to verify live |\n| Builder: GameConfig → trusted runtime, seeded randomness, keyboard/touch/mouse/non-drag input, hints, mute, reduced motion | Working |\n| Sandboxed preview + playtest with diagnostics | Working |\n| Proposals: before/after, Apply / Reject / Undo, scopes, locks, stale detection | Working (demo templates without a key; Claude with a key) |\n| Asset library: categories, metadata, alpha checkerboard, SVG screening + rasterizing, sprite settings, replace keeps placement, copyable prompts | Working (no image generation service is called) |\n| Exports: playable ZIP, source package, Claude Code handoff, developer handoff, preflight | Working |\n| Slide rendering via LibreOffice / Docker | Implemented; **untested here** (LibreOffice was not installed) |\n| Prepare my game: four setup cards (Figma design, PPT lesson, game assets, grade), staged proposals, readiness checks, Approve & build | Working |\n| Figma import (read-only, PAT on the server): link validation, frame picker, snapshots with fidelity badges, renders and image fills with provenance, refresh with diff and approval | Implemented; **tested only against a local mock of the Figma API** — needs your token to verify live. OAuth: not configured |\n| Exported screens (PNG/JPEG/SVG) as references or flattened backgrounds | Working |\n| Source-to-Screen map: explicit slide/frame/state links, source roles, conflict checks, corrections, revisions, side-by-side and overlay compare | Working |\n| Grade profile, labelled presets, Grade Adaptation Plan (presentation only / learning challenge), grade versions | Working (preset rules or demo answers without a key; Claude with a key) |\n| Animate: preset registry, readable rules, triggers, sequences, reduced motion, locks, simulation, Ask Claude motion plans, Suggest motion (no AI) | Working (Claude requests tested against the mock only) |\n| Sprites: combine frames into a sheet, named clips, clip preview | Working |\n| Custom code builder | **Disabled** extension point only — see [docs/CUSTOM_CODE_BUILDER.md](docs/CUSTOM_CODE_BUILDER.md) |\n\n## Requirements\n\n- **Node.js 24 or later** (developed and tested on Node 26.7). The server uses the built-in `node:sqlite`.\n- npm.\n- Optional: LibreOffice (slide images) — see [below](#optional-slide-rendering).\n- For browser tests: Playwright's Chromium (`npx playwright install chromium`).\n\n## Quick start\n\n```sh\nnpm install\nnpm run dev\n```\n\nOpen **http://127.0.0.1:5173**. `npm run dev` starts four processes: the runtime bundler (watch), the API\n(`127.0.0.1:5174`), the background worker, and the Vite studio server.\n\nStatic file servers such as VS Code's **Live Server** cannot run the studio (they show “Cannot GET /”). The\n`index.html` at the repository root is only a pointer for them: it opens the running studio, or shows how to\nstart it.\n\nNo key is needed to start: choose **Try sample project** to open the bundled\n“Air Traffic Control — Coordinate Mission” sample (clearly labelled demo content), **Grade 8 design sample** for the\ntrapezium lesson with exported screens, artwork and motion, or **Create game** to import your own `.pptx` and\nbuild a game by hand.\n\nA production-style run serves the built studio from the API port:\n\n```sh\nnpm run build      # runtime + studio\nnpm start          # API + worker on http://127.0.0.1:5174\n```\n\n## Configuration\n\nCopy `.env.example` to `.env` (git-ignored). Everything is optional. The most important settings:\n\n| Variable | Purpose |\n| --- | --- |\n| `ANTHROPIC_API_KEY` | Enables Claude. Read only by the server processes. |\n| `CLAUDE_MODEL` | Model id (suggested `claude-opus-5-5`). Verified with the Models API before any AI job runs. If empty, choose a model in **Settings**. |\n| `CLAUDE_PRICING_FILE` | Optional dated pricing for cost *estimates* (see `config/pricing.example.json`). Without it only token counts are shown. |\n| `NEXUS_DATA_DIR` | Where projects, uploads, exports and `nexus.sqlite` live (default `data/`, git-ignored). |\n| `MAX_UPLOAD_MB`, `MAX_SLIDES`, … | Import limits (defaults: 40 MB, 80 slides, 300 MB expanded, 4000 entries, 8 MB per XML part, 50 MP images). |\n| `RENDERER`, `SOFFICE_PATH`, `RENDERER_DOCKER_IMAGE` | Optional slide rendering. |\n| `FIGMA_ACCESS_TOKEN` | Optional Figma personal access token (`file_content:read`) for read-only link import. Without it, upload exported screens. |\n| `FIGMA_MAX_AUTO_WAIT_SECONDS`, `FIGMA_TIMEOUT_MS`, `FIGMA_MAX_DOWNLOAD_MB`, `FIGMA_ASSET_HOSTS` | Figma rate-limit waiting, timeouts, download size and extra image hosts. |\n\n## Connecting Claude\n\n1. Put `ANTHROPIC_API_KEY=…` in `.env` (and optionally `CLAUDE_MODEL=claude-opus-5-5`).\n2. Restart `npm run dev`.\n3. Open **Settings → Claude connection** and choose **Test connection** (Models API, no generation) or\n   **Send a tiny test request**.\n\nThe connection shows *Not configured*, *Configured — not verified yet*, *Configured* or *Connection failed*.\nAI jobs only run once the model has been verified.\n\nWhat Claude receives is shown on the **Review** step before analysis: the included slides' text (titles, body,\ntables, equation text, image descriptions), optionally speaker notes, optionally slide images you explicitly\nauthorise per slide, and your brief. Hidden/excluded slides, files, keys and other projects are never sent.\nDeck content is treated as untrusted source material, never as instructions.\n\nCalls use streaming, structured outputs (JSON Schema) validated again with Zod, bounded retries and repair\nattempts, refusal/truncation handling, cancellation, and token usage tracking. A failed AI request is shown as\nfailed — it is never replaced by fake output.\n\n**Demo mode.** Without a key, the bundled sample replays prepared fixtures and a few keyword-matched change\ntemplates. Everything it produces is labelled *Demo mode — sample content*.\n\n## Optional slide rendering\n\nWithout a renderer, slides are shown as an **Extracted content view** (positions and text from the deck,\nclearly not a screenshot), and you can upload a PDF export of the deck for visual reference.\n\n- **LibreOffice:** install it (macOS: `brew install --cask libreoffice`). It is auto-detected, or set\n  `SOFFICE_PATH=/Applications/LibreOffice.app/Contents/MacOS/soffice`.\n- **Docker:** `RENDERER=docker` and `RENDERER_DOCKER_IMAGE=<an image with soffice>`. Runs with\n  `--network none --read-only`, memory/CPU/process limits.\n\n**Settings → Slide rendering** shows the true status; use **Check again** after installing.\n\n## Scripts\n\n| Command | What it does |\n| --- | --- |\n| `npm run dev` | Runtime watcher, API, worker and studio (Vite) together |\n| `npm run build` | Build the game runtime (`dist/runtime`) and the studio (`dist/studio`) |\n| `npm start` | API + worker in production mode (serves `dist/studio`) |\n| `npm run typecheck` | TypeScript over the whole repo |\n| `npm test` | Unit + integration tests (Vitest) |\n| `npm run test:unit` / `npm run test:integration` | One suite |\n| `npm run test:e2e` | Browser tests (Playwright; starts its own servers on separate ports) |\n| `npm run fixtures:sample` | Regenerate `fixtures/sample/air-traffic-control.pptx` |\n| `npm run fixtures:trapezium` | Regenerate the Grade 8 trapezium sample (lesson, exported screens, artwork, mock Figma data) |\n| `npm run check:contrast` | Check studio colour tokens against WCAG contrast targets |\n\n## Exports\n\nExports are files you download; nothing is published or pushed anywhere. Each export runs a **preflight**\n(schema, completable scenes, assets, unresolved source warnings, content origin, path safety, secret scan)\nthat is included as `PREFLIGHT.md`.\n\n| Export | Contents |\n| --- | --- |\n| **Playable game (.zip)** | `index.html`, `game.config.js`, runtime and assets. Works from any static host or sub-folder, and from `file://`. No server, login or key. |\n| **Source package (.zip)** | `game.config.json`, asset map + originals, runtime and its TypeScript source, a dependency-free `build.mjs` / `serve.mjs`. |\n| **Claude Code handoff (.zip)** | The source package plus `README.md`, `CLAUDE.md`, `GAME_DESIGN.md`, `TASKS.md`, `ASSET_GUIDE.md`, `GRADE_PROFILE.md`, `ANIMATION_GUIDE.md`, `animation-manifest.json`, `design-map.json`, `blueprint.json`, `source-map.json`. |\n| **Developer handoff (.zip)** | For blueprint-only ideas: the approved design, tasks, asset guide, source map and the runtime source as the reference for adding a new scene type — no fake build. |\n\nExports contain only the assets the game uses (animations included). API keys, Figma tokens, environment files,\nstudio conversations and Claude requests, Figma files and annotations, reference-only design images, source decks\nand speaker notes are never included — decks and notes only if you explicitly select **Include source material**\n(source/handoff exports only). The preflight also validates every animation and checks that the game runs offline.\n\n## Architecture\n\n```\nstudio/     React 19 + TypeScript studio (Vite). Talks only to /api and embeds /preview in a sandboxed iframe.\nserver/     Fastify API (index.ts) and a separate worker process (worker.ts) sharing one SQLite database.\n  ingest/   ZIP/XML/PPTX/PDF/media readers with limits and rejection of unsafe content.\n  claude/   The only code that talks to Claude (gateway, prompts, schemas).\n  figma/    Read-only Figma REST adapter (allowlisted hosts, bounded downloads, rate limits) and frame snapshots.\n  jobs/     Persisted jobs with leases, heartbeats, events, idempotency and per-stage resumability.\n  build/    Deterministic blueprint → GameConfig compiler (no AI).\n  export/   Export packages, docs and preflight.\nshared/     Zod schemas and pure logic shared by all parts: rules, attainability, coordinates, seeded RNG,\n            screen-map suggestions and conflict checks, motion presets and validation, grade presets.\nruntime/    Framework-free game runtime (bundled as a classic script for static hosting), including the\n            per-screen motion director, sprite clips and the cancelable motion clock.\nfixtures/   The sample deck generator, raw ZIP writer for malicious-package tests, sample fixtures.\n```\n\n- **Data:** `data/nexus.sqlite` (WAL) plus a project-scoped file store `data/projects/<id>/…` outside any public\n  directory. Steps that write both files and rows (uploads, duplication, exports) write files first and commit\n  the database rows last, so an interrupted step does not leave a half-created record.\n- **Jobs:** queued → running → succeeded / failed / cancelled / interrupted. The worker claims jobs with a lease\n  and heartbeats; after a crash, running jobs become *interrupted* (never silently re-run) and can be retried.\n  Progress shown in the studio is the real event log — no percentages or invented timings.\n- **Versions:** approved blueprints and game versions are immutable (enforced by database triggers). Builds use\n  the exact approved revision; refinements and undo create new versions.\n- **Games:** a validated `GameConfig` rendered by the trusted runtime. Answer rules are allowlisted data\n  evaluated by `shared/src/rules.ts` — no `eval`, no model-provided formulas.\n\n## Security model\n\n- The API key is read only in `server/src/secrets.ts`, redacted from errors, and never returned by the API,\n  stored, logged, sent to the preview, or exported. `dangerouslyAllowBrowser` is never used.\n- The Figma token follows the same rules and is sent only as the `X-Figma-Token` header to the Figma API —\n  never to image download hosts, Claude, the browser, logs or exports. Figma is only read, never written.\n- The API binds to `127.0.0.1`. Requests must carry an allowed `Host` (else 421), and state-changing requests\n  need the `X-Nexus-CSRF` header plus a same-origin `Origin` / `Sec-Fetch-Site`.\n- Uploads are validated by content, not extension. ZIP entries are checked for traversal, absolute paths,\n  symlinks, encryption, duplicates, size/ratio bombs and entry counts; XML is parsed without DTDs or entity\n  expansion; macros and OLE files are rejected; external relationships are never followed.\n- SVG uploads with scripts, event handlers, `foreignObject` or external references are rejected; others are\n  rasterized. Uploaded SVG markup is never inserted into the studio DOM.\n- The game preview runs in `<iframe sandbox=\"allow-scripts\">` (no `allow-same-origin`), served with its own\n  CSP that blocks network access, and talks to the studio only over a `MessageChannel` with a per-session nonce\n  and schema-checked messages.\n\n## Hosting boundaries\n\nNEXUS Play Studio is a **local, single-user tool with no authentication**. Keep it on loopback.\n`ALLOWED_HOSTS` can add host names (for example a local reverse proxy), and binding to a non-loopback `HOST`\nis refused unless `NEXUS_ALLOW_REMOTE=yes-i-understand` is set — do not do that on a shared network: anyone who\ncan reach the port can read and change every project and spend your Claude credits. Exported **playable games**\nare static files and are safe to host anywhere.\n\n## Testing\n\n```sh\nnpm run typecheck\nnpm test                         # unit + integration\nnpx playwright install chromium  # once\nnpm run test:e2e                 # browser tests\n```\n\n- **Unit:** ingestion (including malicious packages), rules, coordinates, attainability, RNG, change proposals,\n  blueprint checks, coverage, palettes, compiler, export paths.\n- **Integration:** the API and worker against temporary data directories (security headers, uploads, jobs,\n  versions, exports and secret scanning) and the Claude gateway against a **local mock** of the Anthropic API\n  (streaming, structured output, refusals, truncation, malformed output, rate limits, timeouts, cancellation).\n- **Browser:** the sample flow, all three mechanics in the sandboxed preview, preview isolation, an exported\n  game served from a sub-folder, and the Grade 8 trapezium scenario end to end (uploads, mock Figma design,\n  sprite clips, screen map and conflict, grade suggestions, four animations, playtest with reduced motion,\n  offline export, a second grade version).\n- **Design, grade and motion:** unit tests for map suggestions, conflicts, layout, grade plans, motion\n  validation and suggestions, and the motion clock; integration tests for the Figma adapter against a **local\n  mock** of the Figma API and for both Grade 8 sample flows. Details in\n  [docs/DESIGN_GRADE_MOTION.md](docs/DESIGN_GRADE_MOTION.md#tests).\n\nThe live Anthropic and Figma APIs are not exercised by the test suite. Verify them with **Settings → Test\nconnection** once you add a key or token.\n\nOn macOS, idle sleep pauses running processes and makes timing-sensitive tests (timeouts, stalled streams)\nfail or take minutes; run long suites as `caffeinate -i npm test` when the machine may go idle.\n\n## Screenshots\n\nKey screens at 1440×900, captured from a fresh data directory without a Claude key, are in\n[docs/screenshots](docs/screenshots): dashboard, the four create steps, source review and learning map, blueprint\noverview, storyboard and scene editor, build preview and all three mechanics, a demo proposal, the asset library,\nexport preflight and settings. Screens 21–32 show the Grade 8 trapezium sample with its design read from the\n**local Figma mock**: Prepare (setup cards, staged proposals, grade plan), the Source-to-Screen map (side by side,\noverlay, the definition conflict), Animate (rules and timeline, Ask Claude with unsupported requests, effects),\nsprite clips, the export preflight with motion checks, Settings → Figma, and the built game.\n\n## Known limitations\n\n- Live Claude calls have only been tested against a local mock; run Settings → Test connection with a real key.\n- Live Figma has only been tested against a local mock; hosted Figma OAuth is not implemented. Figma import keeps\n  an editable subset (text, solid rectangles, image placements); other layers stay flattened or reference-only.\n- Motion is limited to the preset registry (no keyframe editor or timeline scrubbing, no lip sync or generated\n  animation); no frame-rate or accessibility-compliance claims are made.\n- Slide rendering (LibreOffice/Docker) was not available in the development environment and is untested.\n- Charts, SmartArt layout, animations and some layout semantics are reported as warnings rather than fully\n  interpreted. Legacy `.ppt` must be saved as `.pptx`.\n- The studio is desktop-first; phones get review, playtest and light edits.\n- No accounts, sharing, billing or publishing — by design for this version.\n\n## Project layout\n\n```\n.env.example            server configuration template (blank credentials)\nconfig/                 pricing example (placeholders only)\ndocs/                   DESIGN_GRADE_MOTION.md, CUSTOM_CODE_BUILDER.md, screenshots/\nexamples/exports/       example exports: Air Traffic (playable, source, Claude Code handoff), Quadrant Memory\n                        (developer handoff for a custom mechanic), Trapezium Quest (playable + handoff with grade\n                        profile, design map and animation manifest)\nfixtures/               sample deck, Grade 8 trapezium sample (lesson, screens, art, Figma mock data) + generators\nruntime/ server/ shared/ studio/\ntests/unit tests/integration tests/e2e\n```",
  "commits": []
}