Transform YouTube tutorials into interactive, hands-on learning labs. Automatically extract transcripts, generate AI-powered summaries, create personalized Docker environments, and learn by doing.
Watch a demonstration of Learn Hands On in action:
Learn Hands On is an AI-powered educational platform that bridges the gap between passive video watching and active learning. Simply click on any YouTube video, and the system instantly creates a customized Docker environment with all the tools you need to follow along with the tutorial hands-on.
- Automatic Lab Generation: Extract transcripts from YouTube videos automatically
- AI-Powered Summaries: Get concise summaries of video content using GPT
- Personalized Environment: AI generates Dockerfiles tailored to the tutorial content
- Interactive Learning: Execute commands in real-time within a containerized environment
- AI Learning Companion: Ask questions and get contextual guidance as you learn
- Step-by-Step Guidance: AI-generated learning steps that adapt based on your actions
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CHROME EXTENSION β
β (Runs in Browser) β
β β’ Detects YouTube videos β
β β’ Orchestrates 3-step lab creation flow β
β β’ Displays loading states and feedback β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β HTTP Requests (CORS)
β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FLASK BACKEND SERVER (Python) β
β β’ REST API endpoints for lab management β
β ββββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββ β
β β Step 1: Extract β Step 2: Generate β Step 3: Build & Run β β
β β & Summarize β Dockerfile β Docker Container β β
β ββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββ€ β
β β β’ YouTube API β β’ OpenAI GPT-4o β β’ Docker Build/Run β β
β β β’ Transcripts β β’ Package Validation β β’ Subprocess Exec β β
β β β’ GPT Summary β β’ Retry Logic (3x) β β β
β ββββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Lab Session Manager (In-Memory State) β β
β β β’ Tracks running containers β β
β β β’ Stores learning progress β β
β β β’ Maintains conversation history β β
β β β’ Records executed commands β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββββββββββββββ¬βββββββββββββ¬βββββββββββββββ¬ββββββββββββββββββ β
β β API: /health β /api/* β /lab β /api/lab/<id>/* β β
β ββββββββββββββββ΄βββββββββββββ΄βββββββββββββββ΄ββββββββββββββββββ β
ββββββββββββββββ¬ββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββ
β β β
ββββββββ΄ββ ββββββββ΄ββ ββββββββ΄βββ
β β β β β β
ββββββββββ ββββββββ ββββββββββββ ββββββββββββ
β Docker β β OpenAI β β YouTube β β External β
β Engine β β API β β API β β Package β
β β β (GPT) β β(Transcr.)β βRepos β
ββββββββββ ββββββββ ββββββββββββ ββββββββββββ
1. USER INITIATES LAB
ββ Clicks extension icon on YouTube video
2. STEP 1: EXTRACT & SUMMARIZE (generate-lab)
ββ Extract video ID from YouTube URL
ββ Fetch transcript using YouTube Transcript API
ββ Summarize using OpenAI GPT-4o-mini (300 tokens)
ββ Generate secure lab_id
3. STEP 2: GENERATE DOCKERFILE (start-lab)
ββ Generate Dockerfile using GPT-4o-mini
ββ Validate packages against:
β ββ Ubuntu 22.04 official repositories
β ββ PyPI (Python Package Index)
ββ Retry up to 3 times if validation fails
ββ Return validated Dockerfile
4. STEP 3: BUILD & RUN (build-lab)
ββ Create temporary directory
ββ Write Dockerfile to temp directory
ββ Build Docker image with unique tag
ββ Start container (detached, interactive mode)
ββ Store lab session in memory
ββ Return lab URL
5. INTERACTIVE SESSION (lab.html)
ββ Display embedded YouTube video
ββ Show initial learning step from AI
ββ Provide terminal for command execution
ββ Display real-time command output
ββ Generate next steps dynamically (next-step endpoint)
ββ Support AI Q&A for clarification
6. COMMAND EXECUTION (/api/lab/<lab_id>/execute)
ββ Execute command in running container
ββ Capture stdout/stderr
ββ Store command in history
ββ Generate contextual next step
ββ Return output and next step
7. Q&A SUPPORT (/api/lab/<lab_id>/ask)
ββ Accept user question
ββ Generate answer using GPT with context
ββ Store Q&A in conversation history
ββ Return answer
-
Docker: Running locally (required to build and execute lab environments)
- Installation: https://docs.docker.com/get-docker/
- Verify:
docker --version
-
Python 3.8+: For running the Flask backend
- Installation: https://www.python.org/downloads/
- Verify:
python3 --version
-
Chrome Browser: For the extension
- Version 88+ recommended for Manifest V3 support
-
OpenAI API Key: For AI features (transcript summary, Dockerfile generation, learning steps)
- Sign up: https://platform.openai.com/signup
- Create API key: https://platform.openai.com/account/api-keys
- Estimated usage: ~$0.10-0.50 per lab (depends on transcript length)
- Backend Server: Requires internet access to:
- OpenAI API endpoints
- YouTube.com (for transcript extraction)
- Ubuntu package repositories
- PyPI (Python packages registry)
# Navigate to backend directory
cd backend
# Create Python virtual environment
python3 -m venv .venv
# Activate virtual environment
source .venv/bin/activate # On macOS/Linux
# or
.venv\Scripts\activate # On Windows
# Install dependencies
pip install -r requirements.txt
# Create environment file
cp .env.example .env.local
# Edit .env.local and add your OpenAI API key
# OPENAI_API_KEY=sk-your-key-here
nano .env.local # or use your editorStart the server:
python3 app.pyServer runs on http://localhost:3000 with auto-reload enabled.
Expected output:
[Init] Starting server...
[Init] OpenAI API Key: Set
[Init] Debug mode enabled - server will auto-reload on file changes
* Running on http://localhost:3000
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top right corner)
- Click "Load unpacked"
- Select the
extension/folder from this project - The extension should appear in your Chrome toolbar (puzzle piece icon)
Extension Configuration:
- Update
extension/popup.jsline 1 if backend is not on localhost:3000 - Current server URL:
http://localhost:3000
- Open any YouTube tutorial video
- Click the extension icon in your Chrome toolbar
- (Optional) Enter project context (e.g., "Learning Docker for DevOps")
- Click "Go Hands On"
- Wait for environment to build (~30-60 seconds depending on Dockerfile complexity)
- Follow the interactive learning steps and execute commands in the terminal
.
βββ extension/ # Chrome Extension (Manifest V3)
β βββ manifest.json # Extension configuration
β βββ popup.html # Extension popup UI
β βββ popup.js # Extension logic & API calls
β βββ background.js # Service worker (minimal)
β
βββ backend/ # Python Flask Server
β βββ app.py # Main application (857 lines)
β β βββ /health # Health check endpoint
β β βββ /api/generate-lab # Step 1: Extract & summarize
β β βββ /api/start-lab # Step 2: Generate Dockerfile
β β βββ /api/build-lab # Step 3: Build & run
β β βββ /lab # Interactive lab UI
β β βββ /api/lab/<id> # Get lab data & initial step
β β βββ /api/lab/<id>/execute # Execute commands in container
β β βββ /api/lab/<id>/ask # AI Q&A support
β β
β βββ lab_manager.py # Lab session management
β β βββ In-memory storage of active labs and learning state
β β
β βββ templates/
β β βββ lab.html # Interactive terminal UI (678 lines)
β β βββ Video embedding
β β βββ Learning steps panel
β β βββ Terminal with command execution
β β βββ Q&A panel
β β
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment variables template
β βββ .env.local # Local environment (not committed)
β βββ .venv/ # Python virtual environment
β βββ README.md # Backend documentation
β
βββ .gitignore # Git ignore rules
βββ README.md # This file
-
Input Validation
- All API endpoints validate request body and input sizes
- YouTube URL format validation
- Lab ID format validation
- Maximum sizes enforced: transcripts (100KB), dockerfile (50KB), commands (4KB), questions (2KB)
-
CORS Configuration
- Restricted to Chrome extension origins only
- Prevents unauthorized access from other websites
-
Secure Lab ID Generation
- Uses
secrets.token_hex()for cryptographically secure random IDs - 16-character hex strings provide sufficient entropy
- Uses
-
OpenAI API Key Management
- Loaded from
.env.localfile (not committed to git) - Server validates key existence at startup
- Key never exposed in error messages or responses
- Loaded from
-
XSS Protection
- All user input properly escaped in HTML templates
- Uses
escapeHtml()function for output encoding
-
Error Handling
- Generic error messages to prevent information leakage
- Detailed logs only in server console
- No stack traces in API responses
-
Docker Permissions
- Application requires Docker daemon access
- User must have Docker permissions (add to docker group or use sudo)
- Containers run with default security
-
Lab Isolation
- Labs are identified by secure random IDs
- No user authentication (suitable for local/private use)
- Anyone with lab_id can access that lab
- Data stored in-memory (lost on server restart)
-
Network Security
- Backend runs on localhost:3000 by default
- Not suitable for multi-user/remote access in current configuration
- For production: implement authentication, HTTPS, and persistent storage
-
Resource Management
- Docker containers accumulate; manual cleanup recommended
- In-memory storage limits concurrent labs based on available RAM
- Command execution timeout: 30 seconds
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxObtaining an API Key:
- Go to https://platform.openai.com/account/api-keys
- Click "Create new secret key"
- Copy the key and paste into
.env.local - Restart the Flask server
Flask Debug Mode (in app.py line ~856):
app.run(host='localhost', port=3000, debug=True)- Change
hostto0.0.0.0for remote access (use with caution) - Change
portif 3000 is already in use - Set
debug=Falsein production
Command Timeout (in app.py line ~749):
timeout=30 # Command execution timeout in secondsDocker Build Timeout (in app.py line ~117):
timeout=300 # Docker build timeout in seconds (5 minutes)# Ensure Docker is installed and running
docker --version
# Check if daemon is running
docker ps
# On macOS, start Docker Desktop if not running
open /Applications/Docker.app# Verify .env.local file exists and has the key
cat backend/.env.local
# Ensure key starts with 'sk-'
# Restart Flask server after updating- Docker build can take 30-60 seconds depending on packages
- Watch Flask console for progress
- Check Docker logs:
docker logs lab-{lab_id}
- Command took longer than 30 seconds
- Long-running operations (downloads, compilations) may need more time
- Modify timeout in
app.pyif needed
- Dockerfile generation may have suggested non-existent package
- Check Flask console for validation errors
- System retries up to 3 times automatically
- If still fails, verify package name exists on:
- Ubuntu packages: https://packages.ubuntu.com/
- Python packages: https://pypi.org/
POST /api/generate-lab
- Extracts transcript and generates summary
- Request:
{youtube_url, project_context?} - Response:
{success, labId, summary, transcript, ...}
POST /api/start-lab
- Generates and validates Dockerfile
- Request:
{labId, transcript, project_context?} - Response:
{success, labId, dockerfile, issues?, warnings?}
POST /api/build-lab
- Builds Docker image and starts container
- Request:
{labId, dockerfile, transcript?, project_context?, youtube_url?} - Response:
{success, labId, containerId, labUrl, ...}
GET /api/lab/{lab_id}
- Get lab data and generate initial learning step
- Response:
{lab_id, learning_plan, environment_description, video_id, ...}
POST /api/lab/{lab_id}/execute
- Execute command in container
- Request:
{command} - Response:
{success, output, exit_code, next_step?}
POST /api/lab/{lab_id}/ask
- Ask AI question about the tutorial
- Request:
{question} - Response:
{success, answer}
GET /health
- Server health check
- Response:
{status: "ok"}
Currently no automated tests. To add:
- Create
tests/directory - Add pytest test files
- Run:
pytest tests/
- Update API endpoints in
app.py - Add database models if persistence needed
- Update
lab_manager.pyfor state management - Update
lab.htmlfor UI changes - Update extension files for new workflows
-
app.py: Core Flask application and API logic
- Main endpoints and workflows
- Docker integration
- OpenAI integration
- Input validation
-
lab_manager.py: Session state management
- In-memory lab storage
- Conversation history
- Learning progress tracking
-
lab.html: Interactive terminal UI
- Video embedding
- Command execution interface
- Real-time output display
- Q&A interface
- XSS protection with escapeHtml()
-
extension/popup.js: Extension orchestration
- 3-step lab creation flow
- Loading state management
- API communication
For issues, feature requests, or questions:
- Check GitHub issues
- Review logs in Flask console
- Verify Docker is running
- Ensure OpenAI API key is valid
Made for learners who learn by doing.