Imported from hari-kancharla/Adaptide-Reddit (
AGENTS.md). Install upstream withnpx skills add hari-kancharla/Adaptide-Reddit. Copyright stays with the author.
You are writing a Devvit web application (ADAPTIDE) that will be executed on Reddit.com.
Tech Stack
- Frontend: Phaser 4 (expanded game view), Vite. No React.
- Backend: Node.js v22 serverless environment (Devvit), Hono. No tRPC.
- Shared: plain TypeScript types in
/src/shared(the combat telemetry model).
Layout & Architecture
/src/server: Backend Code. Runs in a secure, serverless environment.index.ts: Main server entry point (Hono app) wiring/internal/menuand/internal/triggers.core/post.ts: creates the ADAPTIDE custom post.- Access
redditandcontexthere via@devvit/web/server. Phase 1 does not useredis.
/src/client: Frontend Code. Executed inside an iFrame on reddit.com.- To add an entrypoint, create an HTML file and map it in
devvit.json. - Entrypoints:
splash.html(default, inline): the lightweight cover shown in the feed. Keep it fast - it must NOT import Phaser.game.html(game, expanded): the Phaser game. Heavy dependencies live here.
- Structure:
core/(theme, balance, geometry, textures, fatal),entities/,systems/,scenes/(Boot → MutationReveal → Combat → Result).
- To add an entrypoint, create an HTML file and map it in
/src/shared: Shared Code between client and server (telemetry.ts).
Frontend
Rules
- Instead of
window.locationorwindow.assign, usenavigateTofrom@devvit/web/client.
Limitations
window.alert: UseshowToastorshowFormfrom@devvit/web/client.- File downloads: Use clipboard API with
showToastto confirm. - Geolocation, camera, microphone, and notifications web APIs: No alternatives.
- Inline script tags inside
htmlfiles: Use a separate js/ts file instead.
Commands
npm run type-check: Check TypeScript types (tsc --build).npm run lint: Run ESLint.npm run build: Build client and server with Vite.
(There is no test runner configured in Phase 1.)
Code Style
- Prefer type aliases over interfaces when writing TypeScript.
- Prefer named exports over default exports.
- Never cast TypeScript types.
Global Rules
- You may find code that references blocks or
@devvit/public-apiwhile building a feature. Do NOT use this code; this project is configured to use Devvit web only. - Whenever you add an endpoint for a new menu item action, ensure that you've added the corresponding mapping to
devvit.jsonso that it is properly registered.