This repo includes:
- A backend (
server.js) that proxies prompts to OpenAI (defaults togpt-5) and returns a Remotion project (TypeScript/React). - A single‑page app in
web/with a live Remotion Player that previews the generated code and shows a progress bar.
If you opened a URL and saw nothing, make sure you are using the Vite dev server URL during development: http://localhost:5173.
- Prerequisites: Node.js 18+
- Set key (real API):
export OPENAI_API_KEY=sk-... - Start backend on port 3003:
PORT=3003 node server.js
- Start the web app (Vite dev server on 5173):
cd web && npm install && npm run dev
- Open the app:
http://localhost:5173 - In the app, uncheck “Use mock backend”, write a prompt, click “Generate Remotion Project”. The right panel previews it live.
Troubleshooting blank page
- Open the correct URL:
http://localhost:5173(dev server). The Node server athttp://localhost:3003only serves the built app (web/dist) after you runnpm run build. - Check backend health:
curl http://localhost:3003/api/health— ensurehasKey: truewhen using the real API. - Network restrictions: If outbound calls are blocked, use mock mode in the UI, or run
DEV_FALLBACK=1 PORT=3003 node server.jsso the backend returns a local example. - Logs:
tail -f server.logandtail -f web/vite.logif you started them in the background.
- Build the web app:
cd web && npm install && npm run build - Start the backend:
PORT=3003 node server.js - Open:
http://localhost:3003(server servesweb/distif present)
-
POST /api/generate- Body:
{ "prompt": "..." } - Returns a Remotion project JSON with fields:
kind: "remotion-project"files: Map like{ "src/index.ts": string, "src/Root.tsx": string, "src/MyComp.tsx": string, ... }compositionId,fps,durationInFrames,width,height
- Body:
-
GET /api/health- Returns
{ ok: true, model, hasKey }
- Returns
OPENAI_API_KEY: Required for real OpenAI calls.OPENAI_MODEL: Defaults togpt-5. You may override per request by sending{ model }in the body.PORT: Defaults to3000(we use3003in examples).HOST: Defaults to0.0.0.0.DEV_FALLBACK: If1/true/on,/api/generatereturns a local example when upstream fails.
- The backend is dependency‑free (Node 18+ only) and serves
/api/*plus static files (prefersweb/distif present). - The web app uses Remotion Player to preview the generated
src/MyComp.tsxlive, and can download a ZIP of thesrc/files.