A simple FastAPI + React app for running You Know ____ Is a Lot Like ____ with fresh LLM-generated prompt pairs.
- Generates unique prompt pairs using the OpenAI API
- Shows a game-show style prompt stage in React
- Includes think and explain timers
- Tracks player order, round scores, leaderboard, and recent history
backend/- FastAPI API for health checks and prompt generationfrontend/- Vite React client for the game interfaceyou-know-game.md- original game concept notes
- Create a virtual environment at the workspace root named
.venv. - Install dependencies from
backend/requirements.txt. - Copy
backend/.env.exampletobackend/.env. - Add your Azure OpenAI key to
AZURE_OPENAI_API_KEY. - Make sure your local identity can access Azure AI Speech, for example with
az login. - Start the API from the
backend/folder:
uvicorn app.main:app --reload --port 8000- Install dependencies from the
frontend/folder:
npm install- Start the Vite dev server:
npm run devThe Vite server proxies /api and /health to http://localhost:8000 during local development.
This workspace now includes VS Code tasks and launch configurations.
- Make sure the workspace root has
.venv/Scripts/python.exe. - Open the workspace in VS Code.
- Run the task
Setup: Install All. - Create
backend/.envfrombackend/.env.exampleand addAZURE_OPENAI_API_KEY.
- Run the task
Run: Full Stackto start both servers. - Or press
F5and chooseApp: Full Stackto debug the backend and start the frontend dev server. - Use
Frontend: Open In Browserif you want VS Code to open the app directly in Edge after the servers are up.
.vscode/settings.jsonselects the workspace.venvinterpreter and makes the backend import path visible to Python tooling..vscode/tasks.jsonprovides setup and run tasks for backend and frontend..vscode/launch.jsonprovides debug/run entries for FastAPI and the frontend dev server..vscode/extensions.jsonrecommends the Python extensions required for backend debugging.
Backend variables in backend/.env:
AZURE_OPENAI_API_KEY- required to generate prompts with the Azure OpenAI-compatible Kimi deploymentOPENAI_BASE_URL- required for Azure OpenAI-compatible routing, defaults in the example tohttps://maplehack-2-resource.openai.azure.com/openai/v1OPENAI_MODEL- optional, defaults toKimi-K2.6-1FRONTEND_ORIGIN- optional, defaults tohttp://localhost:5173AZURE_SPEECH_ENDPOINT- used by the in-app announcer endpoint andbackend/synthesize_speech.pyAZURE_RESOURCE_ID- used by the in-app announcer endpoint andbackend/synthesize_speech.pywithDefaultAzureCredentialAZURE_SPEECH_VOICE- optional, defaults toen-US-Grant:MAI-Voice-1AZURE_SPEECH_TEXT- optional default text for speech synthesisAZURE_SPEECH_OUTPUT_FILE- optional output file path; if unset, audio plays through the default speaker
Optional frontend variable in frontend/.env.local:
VITE_API_BASE_URL- set this if you do not want to use the dev proxy
Returns API health and whether the Kimi model and Azure Speech announcer are configured.
Request body:
{
"recent_prompts": [
"You know designing a landing zone is a lot like planning a wedding."
]
}Request body:
{
"text": "You know landing a zero trust review is a lot like organizing a family road trip."
}Response body:
Returns audio/wav bytes for the excitable announcer voice.
Response body:
{
"technicalThing": "running an architecture review",
"everydayThing": "judging a cooking show",
"fullPrompt": "You know running an architecture review is a lot like judging a cooking show.",
"rationaleHint": "Both depend on balancing taste, constraints, and strong opinions without losing the overall standard."
}- Prompt uniqueness is handled with both frontend round history and a small backend in-memory cache.
- If
AZURE_OPENAI_API_KEYis missing, the frontend still loads but prompt generation returns a configuration error. - The main frontend action now spins a prompt and tries to auto-play the Azure Speech announcer immediately.
Install backend dependencies, run az login or otherwise configure DefaultAzureCredential, and then run:
.venv\Scripts\python.exe backend\synthesize_speech.py --output-file backend\outputs\speech.wavIf you omit --output-file, the script sends audio to the default speaker instead.