An AI-powered application that transforms your learning topics into structured, optimized curricula with interactive lessons and quizzes.
study-buddy-v2/
├── frontend/ # React + TypeScript + Tailwind
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── pages/ # Route pages
│ │ ├── api.ts # API client
│ │ └── types.ts # TypeScript types
│ ├── Dockerfile
│ └── package.json
├── backend/ # Python FastAPI
│ ├── app/
│ │ ├── main.py # API routes
│ │ ├── models.py # Pydantic models
│ │ ├── learning.py # AI lesson/quiz generation
│ │ ├── storage.py # Data persistence
│ │ └── content_cache.py # Caching layer
│ ├── Dockerfile
│ └── requirements.txt
├── docker-compose.yml
└── README.md
- Curriculum Generation: Paste topics → AI organizes them into a structured learning path
- Interactive Lessons: AI-generated lessons with problem/solution framing
- Mastery Quizzes: Test your understanding with AI-powered assessment
- Progress Tracking: Track your learning progress across topics
- Quiz History: Review past quizzes and assessments
- Docker & Docker Compose installed
- Anthropic API Key
# Clone the repository
git clone <your-repo-url>
cd study-buddy-v2
# Build both images
docker-compose buildOr build individually:
# Build backend image
docker build -t study-buddy-backend ./backend
# Build frontend image
docker build -t study-buddy-frontend ./frontend# Create .env file with your API key
echo "ANTHROPIC_API_KEY=your_api_key_here" > .env
# Start all services
docker-compose up -dThe app will be available at:
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:8000
# Create a network for the containers
docker network create study-buddy-network
# Create a data directory for persistence
mkdir -p ./data
# Run backend
docker run -d \
--name study-buddy-backend \
--network study-buddy-network \
-p 8000:8000 \
-e ANTHROPIC_API_KEY=your_api_key_here \
-v $(pwd)/data:/app/data \
study-buddy-backend
# Run frontend
docker run -d \
--name study-buddy-frontend \
--network study-buddy-network \
-p 5173:5173 \
study-buddy-frontend- Save the Docker images:
# Export images to tar files
docker save study-buddy-backend > study-buddy-backend.tar
docker save study-buddy-frontend > study-buddy-frontend.tar-
Transfer files to the target computer:
- Copy
study-buddy-backend.tar,study-buddy-frontend.tar, anddocker-compose.yml
- Copy
-
On the target computer:
# Load the images
docker load < study-buddy-backend.tar
docker load < study-buddy-frontend.tar
# Create .env with your API key
echo "ANTHROPIC_API_KEY=your_api_key_here" > .env
# Start the services
docker-compose up -dTo push to a container registry (Docker Hub, etc.):
# Tag images
docker tag study-buddy-backend your-registry/study-buddy-backend:latest
docker tag study-buddy-frontend your-registry/study-buddy-frontend:latest
# Push to registry
docker push your-registry/study-buddy-backend:latest
docker push your-registry/study-buddy-frontend:latest- Node.js 18+
- Python 3.10+
- Anthropic API Key
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set your Anthropic API key
export ANTHROPIC_API_KEY=your_api_key_here
# Run the server
uvicorn app.main:app --reloadThe API will be available at http://localhost:8000
To access the backend from other devices on your network (e.g., iOS app testing):
# Run the server on all network interfaces
ALLOWED_ORIGINS=* uvicorn app.main:app --reload --host 0.0.0.0This binds the server to 0.0.0.0:8000, allowing connections from:
- Localhost (
http://localhost:8000) - Your machine's LAN IP (e.g.,
http://192.168.x.x:8000) - iOS devices on the same network
Note: ALLOWED_ORIGINS=* enables CORS for all origins. For production, specify exact origins:
ALLOWED_ORIGINS=http://localhost:5173,http://192.168.50.81:5173 uvicorn app.main:app --host 0.0.0.0cd frontend
# Install dependencies
npm install
# Run development server
npm run devThe app will be available at http://localhost:5173
POST /api/parse-stream- Parse topics into curriculum (SSE)GET /api/curriculums- List all saved curriculumsGET /api/curriculums/{id}- Get specific curriculumDELETE /api/curriculums/{id}- Delete a curriculum
POST /api/lesson- Generate lesson for a topicPOST /api/quiz- Get or generate quizPOST /api/quiz/new- Force generate new quizPOST /api/quiz/submit- Submit quiz for AI assessmentGET /api/history/quiz/{id}/{cluster}/{topic}- Get quiz history
GET /api/curriculums/{id}/progress- Get learning progress
| Variable | Description | Required |
|---|---|---|
ANTHROPIC_API_KEY |
Your Anthropic API key | Yes |
All data is stored in the data/ directory:
data/curriculums/- Saved curriculum JSON filesdata/content/- Cached lessons and quizzes
When using Docker, mount a volume to /app/data to persist data.
- Frontend: React 18, TypeScript, Tailwind CSS, Vite, React Router
- Backend: FastAPI, Pydantic, Anthropic Claude API
- Styling: Custom glassmorphism design with Syne & JetBrains Mono fonts
- AI: Claude claude-sonnet-4-20250514 for curriculum parsing, lesson generation, and assessment
This project supports backend, frontend, and end-to-end (E2E) testing.
For E2E and CI-related changes, it is strongly recommended to use act to run the actual GitHub Actions workflow locally before pushing commits.
cd backend
pytest tests/ -v
pytest tests/ --cov=app --cov-report=html # With coveragecd frontend
npm run test # Watch mode
npm run test:run # Single run
npm run test:coverage # With coverageFrom the frontend/ directory:
npm run test:e2e
npm run test:e2e:ui # Playwright UI mode
npm run test:e2e:headed # Run in headed browserIf the frontend is running on a port other than 5173, set:
FRONTEND_PORT=XXXXTo avoid pushing commits just to test CI or workflow changes, use act to run the real GitHub Actions jobs locally.
act runs workflows inside Docker containers, so it is safe:
- your real local data is not modified
- backend seeding only affects the container filesystem
- artifacts are not uploaded anywhere
- Docker (Docker Desktop or Docker Engine)
actinstalled
macOS:
brew install actFrom the repo root:
ACT=true && act -j e2e-tests \
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-22.04- Flag to indicate this is running in a container not on GitHub
- Ensures playwright reports are properly accessible
During E2E runs in CI (and act), backend data is seeded automatically:
- name: Seed backend data for E2E
run: cp -R backend/sample-data backend/dataThis runs inside the container only.
backend/data is gitignored and never touches real local data.
When running E2E tests locally or via act, Playwright outputs:
- HTML report:
frontend/playwright-report/ - Traces, screenshots, videos:
frontend/test-results/
View the report locally with:
npx playwright show-report frontend/playwright-reportArtifact upload steps only run on GitHub Actions and are skipped locally.
- Use unit tests for fast feedback
- Use Playwright directly for UI debugging
- Use
actto validate CI workflows before pushing - E2E seeding is container-only and safe by design
- No local data is deleted or overwritten