# 💻 Developer Guide
Want to contribute, fork, or understand how LearnAI TV works under the hood? You're in the right place!
🚀 Quick Start
Prerequisites
Git installed
Modern browser
Code editor (VS Code recommended)
(Optional) n8n instance for backend testing
Clone & Run
# Clone repository
git clone https://github.com/iavendas62-collab/learnai-tv.git
cd learnai-tv
# No build step needed! Just open in browser:
open index.html
# Or use a local server:
python -m http.server 8000
# Visit: http://localhost:8000That's it! No npm install, no dependencies, no build tools.
📁 Project Structure
Why so simple?
✅ No build complexity
✅ Easy to understand for students
✅ Deploy anywhere (GitHub Pages, Netlify, Vercel)
✅ Fast load times (no frameworks)
🏗️ Architecture Overview
Frontend (Static HTML/CSS/JS)
Technology Choices:
Vanilla JS
No React overhead, easier debugging
CSS Grid/Flexbox
Modern layout without frameworks
KaTeX CDN
Math rendering without local build
No bundler
Direct deployment, transparent code
Backend (n8n Workflow)
Hosted on: Easypanel (Docker containers)
Endpoint: https://iavendas-n8n.tkxtrv.easypanel.host/webhook/[id]
Workflow Components:
Webhook node (receives POST)
AI Agent node (orchestrates LLM + tools)
OpenAI Chat Model (GPT-4.1-mini)
Memory Buffer (session storage)
7x Tool nodes (MCP servers + Wolfram)
Response node (returns JSON)
🔧 Configuration
Environment Variables
Frontend (app.js):
To use your own n8n instance:
Deploy n8n (Easypanel, Railway, or self-host)
Import workflow JSON (
Hackathon CS girlies (final).json)Update
WEBHOOK_URLinapp.jsConfigure API credentials (OpenAI, Wolfram)
API Credentials Needed
OpenAI
Primary LLM
https://platform.openai.com
Wolfram Alpha
Math computation
https://products.wolframalpha.com/api
Google Docs API
Curriculum content
https://console.cloud.google.com
🛠️ Development Workflow
1. Frontend Changes
Edit HTML:
Edit CSS:
Edit JavaScript:
2. Testing Locally
Open Browser DevTools (F12):
3. Deploy to Production
📊 Code Architecture
State Management
Global Variables (app.js lines 10-22):
Why Globals?
Single-page application (no routing)
State resets on page reload
Easier debugging (inspect in console)
No state management library needed
Function Organization
app.js structure (~1,200 lines):
Key Functions
Topic Extraction:
Quiz Parsing:
API Call:
🎨 Design System
Color Palette
Typography
Spacing System
Component Patterns
Button Variants:
Card Components:
🧪 Testing
Manual Testing Checklist
Functional Tests:
Cross-Browser Tests:
Responsive Tests:
Automated Testing (Future)
🔌 API Reference
Webhook Endpoint
URL: POST https://iavendas-n8n.tkxtrv.easypanel.host/webhook/313ee9cc-b465-4154-8cc9-4e8145dbd38b
Headers:
Request Body:
Response:
Study Modes
list_topics
Get 8 topic names
Numbered list of topics
explicacao
Explain a topic
Detailed explanation with examples
chat
Conversational Q&A
Natural language answer
quiz
Generate 5 questions
Formatted quiz with separators
challenge
Generate 1 hard question
Single quiz question
🐛 Common Issues & Fixes
Issue: Topics show "Tópico 1, Tópico 2"
Cause: AI didn't respond with proper format, or parsing failed.
Fix:
Issue: Quiz parsing fails
Cause: AI used unexpected format.
Debug:
Solution: Expand parseQuiz() to handle more formats.
Issue: Chat doesn't show math formulas
Cause: KaTeX not loading or wrong syntax.
Fix:
🚀 Deployment Guide
GitHub Pages (Current)
Alternative: Vercel
Alternative: Netlify
n8n Deployment
Option 1: Easypanel (Current)
Docker-based
One-click deploy
Includes SSL
Option 2: Railway
Option 3: Self-Host
🤝 Contributing
How to Contribute
Fork the repository
Create a feature branch
Make your changes
Test thoroughly
Commit with clear message
Push and create PR
Code Style Guidelines
JavaScript:
Use
const/let, notvarDescriptive function names:
extractTopics()notgetT()Comments for complex logic
Error handling with try/catch
Console logs for debugging (remove in production)
CSS:
BEM-like naming:
.quiz-option,.btn-primaryGroup related styles
Use CSS variables for colors
Mobile-first media queries
HTML:
Semantic tags:
<nav>,<main>,<section>Accessible:
aria-label,tabindex,alttextNo inline styles (use classes)
Feature Ideas
Good First Issues:
Advanced Features:
📚 Additional Resources
Learning Resources
Vanilla JS: https://javascript.info
CSS Grid: https://cssgrid.io
n8n Documentation: https://docs.n8n.io
Wolfram API: https://products.wolframalpha.com/api/documentation
MCP Protocol: https://modelcontextprotocol.io
Inspirations
Duolingo - Gamification mechanics
Khan Academy - Educational content structure
Netflix - TV-style interface
Quizlet - Quiz generation patterns
💬 Support
Questions?
📧 Email: [your-email]
💬 Discord: [hackathon-channel]
🐙 GitHub Issues: https://github.com/iavendas62-collab/learnai-tv/issues
Found a bug? Open an issue with:
Steps to reproduce
Expected vs actual behavior
Browser/device info
Screenshots if applicable
📜 License
This project was created for the CS Girlies Hackathon 2025.
Open Source License: MIT
You're free to:
✅ Use for personal/commercial projects
✅ Modify and distribute
✅ Fork and create derivatives
Attribution appreciated but not required! 🙏
Last updated