Skip to content
jsfmuPublic

About

roasting

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

The Scallion

A campfire roast in both senses: turn a friend's photo into a marshmallow, then roast it over a pixel-art fire while personalized jokes roast their habits and quirks. Add a name, a few details, and a photo, light the fire, and try to get both sides perfectly golden without burning them.

OpenAI turns the uploaded photo into a ridiculous cartoon marshmallow and writes the jokes. Optional ElevenLabs voice reactions bring the marshmallow to life. Drag, rotate, and cool it as it browns and melts. You can also try the campfire demo with prewritten jokes without API keys. Built with React, TanStack Router, TypeScript, and a NestJS backend.

Built for Showerhacks 🚿

This project was built for Showerhacks, the September 26, 2026 hackathon at Entrepreneurs First, 501 Folsom St, San Francisco. The brief: build something absurdly creative, interesting, or funny—no economic viability required.

Our answer is a literal personal roast: a familiar face transformed into a cartoon marshmallow, questionable habits turned into punchlines, and a campfire you control. It's a playful experiment in AI-generated comedy and interactive pixel art, made for a day of building weird things and meeting interesting people. At Showerhacks, the winning team gets $1,000 and a refreshing shower.

Get started

Use Node.js 24 LTS (see .nvmrc) and npm 10 or newer.

nvm use
npm install
npm run dev

The home page lets you add a name, description, and photo, then opens the campfire with personalized jokes. You can also play the campfire demo without any API keys. Both apps restart on source changes. The API development command compiles TypeScript with decorator metadata before launching Node's watcher.

How to play

Play directly at http://localhost:3000/. The Scallion combines a browser-based campfire simulation with personalized comedy. Its pixel artwork lives under apps/web/public/games, and its React/TypeScript gameplay lives under apps/web/src/features with scoped CSS.

Drag with a mouse or touch, or focus the canvas and use arrow keys to move, R to rotate, and C to cool. Aim for 55–70% on both sides. Buttons also pause/resume and reset. Roasting damage is permanent until reset; cooling only stops further heating. The animation stops when leaving the route, and roasting does not advance while the tab is hidden. Reduced-motion preferences suppress decorative motion.

The original game simulation runs entirely in the browser and works without a backend or API key. Personalized roasts require the API and an OpenAI key. Optional voice reactions use the NestJS backend and ElevenLabs. The optional standalone WebMCP registration was omitted from the integrated version; all player controls remain available. npm test includes game simulation, voice lifecycle, and API regression checks.

Roast jokes with Grok

Set XAI_API_KEY in the repository-root .env and restart the API. Grok (XAI_MODEL, default grok-3) then writes the roast through xAI's chat completions API with a savage, R-rated brief that escalates as the marshmallow burns. Hard limits stay in the prompt: no slurs, no protected-trait or weight jokes, nothing sexual, no threats, no invented allegations, and no addresses, contact details, family, health, or finances. If FIRECRAWL_API_KEY is also set, a best-effort Firecrawl search for the quoted name (three results as markdown, about 3 credits) is passed to Grok as research. Grok 3 is not listed for strict JSON mode, so the server asks for JSON in the prompt and parses it leniently. Key, model, and rate-limit errors return specific messages.

Roast jokes with Firecrawl only

Without an xAI key:

Set FIRECRAWL_API_KEY in the repository-root .env and restart the API. POST /api/roast then uses Firecrawl instead of OpenAI: a /v2/search for the quoted name (one result) with a JSON-extraction format writes the thirty jokes from your description plus facts on that page that clearly match. If nothing turns up, a /v2/scrape of a neutral page runs the same extraction from the description alone. Each roast costs about 5–6 Firecrawl credits and takes a few seconds. Firecrawl does not enforce array lengths, so the server keeps up to three valid lines per moment and repeats lines when fewer come back. OpenAI output is still validated strictly.

Firecrawl cannot generate images, so Mallowfy them still needs OpenAI. Use photo as-is draws the photo onto a marshmallow in the browser instead, with no API call.

Personalized roasts with OpenAI

Add this to the repository-root .env and restart the API:

OPENAI_API_KEY=your_key_here
# Optional text and image models.
OPENAI_MODEL=gpt-4o-mini
OPENAI_IMAGE_MODEL=gpt-image-2.5-flare

On the home page, add a name, a description of their habits or quirks, and a JPG, PNG, or WebP photo (up to 5 MB). Click Mallowfy them to generate a recognizable, exaggerated marshmallow caricature. Once it is ready, position the mouth dots on the cartoon, preview the talking, and click Light the fire. The server makes one OpenAI Responses API call to generate thirty short jokes, three for each of the game's ten moments. A live feed in the right panel shows profile-based jokes as you roast: hotter positions increase the pace from about one message every ten seconds to one every two seconds. Cooling out of the heat, pausing, and hiding the tab stop automatic messages. The feed retains the five latest messages and resets with the round. The feed works with voice muted. The first line for each game moment also appears as a stage caption and is used by optional ElevenLabs speech. Missing keys and failed generation show an error with a retry, while the original game remains available.

Position the two dots at the corners of the generated character’s lip opening and use Preview talking to check the motion before starting. The preview and game use the same centered square crop. Talking follows the voice audio with a soft, localized jaw movement; reduced-motion preferences keep the portrait still.

The photo is sent through the API to OpenAI only when Mallowfy them or Make another version is clicked. The generated transparent PNG becomes the whole marshmallow character and uses the existing talking, movement, rotation, browning, and melting. The name and description are sent separately to write jokes, with response storage disabled for that text request. The app keeps the original and generated images in browser memory and does not save them to disk or a database. Edit person returns to the populated form; refreshing starts over. Try again restarts the same roast without another OpenAI call. Editing the name or description reuses the generated character; selecting a new photo clears it. A failed image generation offers a manual retry, and failed joke generation preserves the character. Keys stay on the server and must never use a VITE_ prefix.

POST /api/mallow accepts one multipart photo (JPG, PNG, or WebP, up to 5 MB) and returns an image/png with Cache-Control: no-store. It calls OpenAI’s image-editing endpoint once using OPENAI_IMAGE_MODEL (default gpt-image-2.5-flare), medium quality, 1024×1024 output, and a transparent background. Generation has a 150-second server timeout and a two-request concurrency limit. The client waits up to 160 seconds, checks that the image decodes, and never automatically retries a paid generation. Generation may take a minute or two; the configured account needs access to the image model. OpenAI image generation documentation.

POST /api/roast takes { name, description } and returns { lines, messages }, both keyed by the ten game cues. lines holds a single caption/voice line per cue; messages holds three variants per cue for the live feed. The server validates inputs and generated output, uses a 30-second timeout, and returns sanitized provider errors. The hackathon flow uses no accounts or persistence. Tests mock OpenAI; live generation requires a configured, funded API key. API reference: OpenAI Structured Outputs.

Optional ElevenLabs voice

Add your key to .env at the repository root (use .env.example as a template):

ELEVENLABS_API_KEY=your_key_here

Run npm run dev, open the game, and click Enable voice. Restart the API after changing environment files. The default stock voice is George, using eleven_flash_v2_5; optionally set ELEVENLABS_VOICE_ID and ELEVENLABS_MODEL_ID to choose another voice or compatible model. The API reads the root .env first, then apps/api/.env for app-specific overrides; existing process environment variables take precedence. Never prefix the key with VITE_.

The marshmallow reacts to the fire, roasting milestones, rotation, cooling, and resets with ten short jokes: prewritten in the demo and OpenAI-generated in personalized games. Speech appears in the bubble as captions. Voice starts muted on each visit and plays only after a click. Clips never overlap, automatic milestones play once per round (warming/golden once per side), and requests are spaced at least seven seconds apart during play. Pause, mute, reset, hiding the tab, and leaving the route cancel pending playback. If the key is missing or the provider fails, roasting continues normally and the voice button offers a manual retry.

POST /api/voice/:cue accepts the fixed cue names defined in apps/api/src/voice/voice.lines.ts and an optional { text } body for personalized lines (1–240 characters). Provider settings stay server-side. The key stays on the server. Successful audio is cached in memory per API process by cue and text (up to 100 clips), and simultaneous requests for the same cue and text share one generation. Repeated rounds reuse clips; restarting the API clears its cache. There are at most two concurrent generations, twelve generation attempts per minute per process, a twelve-second provider timeout, and a thirty-second cooldown after provider errors. Audio is also cached in the browser for the current visit. There is no persistent audio storage or background pre-generation.

Tests mock ElevenLabs and browser audio; they do not use your key or spend credits. Actual voice quality and account/voice availability need a live check after you add your key. Provider references: ElevenLabs text-to-speech API and voice selection quickstart.

Structure

apps/
  web/                  React, TanStack Router, Vite
    src/routes/         Game entry point and legacy route redirect
    src/features/       Game simulation, canvas rendering, controls, and voice
  api/                  NestJS API
    src/health/         Example controller, service, and feature module
    src/voice/          ElevenLabs proxy, reactions, and audio cache
    src/roast/          OpenAI personalized roast generation
    test/               HTTP integration tests using the Node test runner
packages/
  contracts/            Shared TypeScript API contracts (type-only)

Import contracts using import type from @thescallion/contracts. This package has no runtime exports and needs no build step. Contracts provide compile-time checking; add runtime validation when introducing external input.

Commands

Run from the repository root:

Command Purpose
npm run dev Start both apps with watch mode
npm run build Build the API and frontend
npm run check Lint, format check, typecheck, and all tests
npm run typecheck Check every workspace and generate the route tree
npm run lint Run ESLint
npm run format Format source and configuration
npm test Run API integration and game simulation tests
npm run start -w @thescallion/api Run the compiled API
npm run preview -w @thescallion/web Preview the frontend build locally

CI installs the lockfile with npm ci, runs all checks, and builds both apps on pushes to main and pull requests.

Configuration

The original game works without environment files. Use the root .env.example for OpenAI and ElevenLabs settings. For app-specific overrides, copy each app's .env.example to .env in the same directory:

  • apps/api/.env: PORT defaults to 3001.
  • apps/web/.env: API_PROXY_TARGET defaults to http://localhost:3001. Update this too if you change the API port, then restart Vite.

The browser uses relative /api URLs. Vite proxies them in development and local preview, so no cross-origin configuration is required. Keep secrets out of variables prefixed with VITE_, which are exposed to the browser.

Add a feature

  1. Define response types in packages/contracts/src/index.ts.
  2. Add a NestJS module with its controller and service in apps/api/src, then register it in AppModule. All API routes use the /api prefix.
  3. Extend the game under apps/web/src/features, or add a file in apps/web/src/routes when another route is needed. Vite and npm run typecheck regenerate routeTree.gen.ts; do not edit it manually.

Production

Run npm ci and npm run build. Start the API with npm run start -w @thescallion/api and serve apps/web/dist with a static web host. Configure that host to forward /api/* to NestJS and fall back to index.html for client-side routes. Vite's proxy is for local development and preview only. No database or authentication provider is configured yet.

Framework references: TanStack Router and NestJS.

About

roasting

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages