Sample Lesson | Bellevue Coders AI Academy

Bellevue Coders AI Academy

Build an AI adventure game with FastAPI + React

Student lab · Follow the guide to run a branching AI story game on your computer. Original tutorial by Tech With Tim.

Command steps

  1. Install and check the tools

    After installing Git, uv, and Node.js 22 LTS, open a new terminal and run these checks.

    git --version
    uv --version
    node --version
    npm --version
    uv python install 3.13
  2. Download the pinned project

    Use the revision in the PDF so the source files match the guide.

    git clone https://github.com/techwithtim/Choose-Your-Own-Adventure-AI.git
    cd Choose-Your-Own-Adventure-AI
    git checkout --detach 4fc7273
  3. Configure the backend

    Paste into backend/.env in your editor. Use the placeholder for the startup check. For story generation, add your own key locally. The repository tracks this file, so keep your edited copy out of commits.

    DEBUG=true
    DATABASE_URL=sqlite:///./class-lab.db
    OPENAI_API_KEY=replace-with-your-key
  4. Start FastAPI in Terminal A

    Run from the project root. Keep this terminal open and check http://localhost:8000/docs for the API routes.

    cd backend
    uv sync --locked --python 3.13
    uv run --locked uvicorn main:app --reload --port 8000
  5. Configure the frontend proxy

    Create frontend/.env.local with this line.

    VITE_DEBUG=true
  6. Set the frontend API URL

    Replace the existing API_BASE_URL line in frontend/src/util.js.

    export const API_BASE_URL = "/api"
  7. Start React in Terminal B

    Open a second terminal at the project root. Use http://localhost:5173 or the URL Vite prints.

    cd frontend
    npm ci
    npm run dev
  8. Generate and play a story

    Enter a theme in Interactive Story Generator and follow a branch to an ending. Live story generation requires an OpenAI API key with API access and billing. See page 2 of the PDF for troubleshooting.

Scroll to Top