A learning platform where users create gamified courses on any topic. Courses are generated by an LLM agent (pydantic-ai) and stored so anyone can take them without re-generating.
- User accounts: Register, log in, dashboard
- Create course: Enter a topic; an AI generates an overview, cheatsheet, and 5–8 exercises (multiple choice and matching pairs)
- Take courses: Browse courses, start exercises, get feedback, track progress (X/Y completed)
- Reuse: Once created, a course can be used by any user
-
Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | shOr see uv installation docs.
-
Install dependencies
uv sync
This creates a virtualenv and installs all dependencies. Development tools (pytest, ruff, mypy, black) are in a separate dev group but are installed by default with
uv sync. -
Environment
Copy
.env.exampleto.envand set at least:OPENAI_API_KEY– required for course generation (e.g. from OpenAI)
For PostgreSQL (optional), set
PGHOST,PGUSER,PGPASSWORD,PGDATABASE. If not set, the app uses SQLite. -
Database
uv run python manage.py migrate
-
Run
uv run python manage.py runserver
- Log in, then go to Create course.
- Enter a topic (e.g. "Python list comprehensions").
- Wait for the agent to generate the course (may take 10–30 seconds).
- You are redirected to the course page; you can start exercises or share the link.
| Course generation form | Browse courses |
|---|---|
![]() |
![]() |
| Course overview | Exercise |
![]() |
![]() |
- Backend: Django 5.x
- Database: SQLite (default) or PostgreSQL
- LLM agent: pydantic-ai with structured output (Pydantic models)
- Frontend: Django templates, PicoCSS 2 (
@picocss/pico@2)
Course creation is asynchronous so the UI stays responsive while the LLM runs (10–30 seconds):
- Submit - User submits the topic; the server creates a
CourseGenerationJob(statuspending) and starts a background thread that calls the pydantic-ai agent. - Polling - The user is redirected to the course list. Pending jobs are shown as “Generating…” cards; the page polls
GET /courses/api/job-status/<job_id>/every few seconds. - Completion - When the thread finishes, the job status becomes
completeorfailed, theCourseis attached to the job, and a Notification is created (“Your course X is ready!” or an error message). The polling client sees the update and refreshes the list (or removes the card on failure).
courseforge/– Django project settings and URLsusers/– Auth (register, login, dashboard)courses/– Course and Exercise models, create/detail/list/start/exercise viewsprogress/– UserProgress (per-attempt records)agent/– pydantic-ai course generator (CourseContent model, agent,run_course_gen.py)
For local or deployment-style runs with PostgreSQL:
docker compose up -d
docker compose exec web python manage.py migrate
docker compose exec web python manage.py createsuperuser # optionalThen open http://localhost:8000. The web service uses .env for secrets (e.g. OPENAI_API_KEY, COURSEFORGE_LLM_MODEL); the compose file sets PGHOST, PGDATABASE, etc. for the Postgres service. Note: The default POSTGRES_PASSWORD in docker-compose.yml is for local use only-use a strong password and proper secrets in production.
uv run pytestRuns tests with pytest (see pyproject.toml for pytest-django config). The agent build test is skipped unless OPENAI_API_KEY is set.
- Lint:
uv run ruff check . - Format:
uv run black . - Type check:
uv run mypy .
CI runs on push/PR to main (lint, format check, mypy, pytest). See .github/workflows/ci.yml.



