AI-powered educational captive portal with conversational learning
Wi-Fi Kids transforms your home router into an educational gateway: kids engage with an AI tutor through conversational quizzes before gaining internet access. The system uses GPT-5 to generate contextual questions, provide detailed feedback, and maintain conversation history for a personalized learning experience.
Now Available: PWA deployment ready for Cloudflare Pages with seamless backend integration
- ChatGPT-style interactions with detailed, encouraging feedback
- Thread memory - AI remembers previous questions and builds context
- Adaptive difficulty based on student performance
- Multi-subject support: Math, Science, History, Geography, Literature, Art
- Persona-based tutoring: Tutor, Maternal, or General teaching styles
- Full localization: Portuguese (PT-BR) and English (EN-US)
- Language-locked sessions - users choose language upfront, then it's locked for the session
- AI responses respect locale - questions and feedback in chosen language
- Smart answer validation - accepts variations, synonyms, and different formats
- Progressive Web App - works offline, installable on mobile devices
- Real-time conversation with typing indicators
- Accessible design with proper contrast and keyboard navigation
- Responsive layout for all screen sizes
- Dark/light mode support
- FastAPI backend with automatic OpenAPI documentation
- LangChain integration for advanced AI workflows
- SQLAlchemy ORM with automatic migrations
- Comprehensive testing (80%+ coverage requirement)
- Type hints throughout for better development experience
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββ
β PWA Frontend β β FastAPI Backend β β OpenAI β
β (React + TS) βββββΊβ (Python + LangC) βββββΊβ GPT-5 β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββ
β β
β βββββββββββΌββββββββββ
β β SQLite DB β
β β (Sessions, Logs) β
β βββββββββββββββββββββ
β
ββββββββββΌβββββββββ
β Cloudflare Pagesβ
β (Deployment) β
βββββββββββββββββββ
- Frontend: React + TypeScript PWA deployable to Cloudflare Pages
- Backend: FastAPI + LangChain + SQLAlchemy for AI-powered education
- Database: SQLite for development, PostgreSQL-ready for production
- AI Service: OpenAI GPT-5 with conversation memory and context
- Deployment: GitHub Actions + Cloudflare Pages for seamless CI/CD
WiFi-Kids/
βββ π± Frontend (PWA)
β βββ ui/webapp/apps/pwa/
β βββ src/
β β βββ components/ # React components
β β βββ services/ # API integration, state management
β β βββ utils/ # Error handling, validation
β β βββ i18n.ts # Internationalization
β β βββ types.ts # TypeScript definitions
β βββ public/ # Static assets, PWA manifest
β βββ package.json # Dependencies
β βββ wrangler.toml # Cloudflare Pages config
β βββ _headers, _redirects # Cloudflare deployment files
β
βββ π§ Backend (API)
β βββ backend/
β βββ api/
β β βββ core/ # Database, settings, middleware
β β βββ routes/ # API endpoints
β β βββ schemas/ # Pydantic models
β β βββ repositories/ # Data access layer
β β βββ integrations/ # AI agents, validation
β βββ tests/ # Comprehensive test suite
β βββ pyproject.toml # Dependencies & configuration
β βββ env.example # Environment template
β βββ run_tests.py # Test runner script
β
βββ π Deployment & DevOps
β βββ .github/workflows/ # GitHub Actions CI/CD
β βββ scripts/ # Deployment scripts
β β βββ deploy-local.sh # Local development setup (Unix)
β β βββ deploy-local.bat # Local development setup (Windows)
β βββ docker/ # Docker configurations
β
βββ π Documentation
β βββ README.md # This file
β βββ CLAUDE.md # Claude Code instructions
β βββ CONTRIBUTING.md # Contribution guidelines
β βββ SECURITY.md # Security considerations
β
βββ π Configuration
βββ .env.example # Environment variables template
βββ requirements/ # Optional: pip requirements files
Choose your operating system:
πͺ Windows
- Python 3.11+: Download from python.org
- Node.js 20+: Download from nodejs.org
- Git: Download from git-scm.com
- OpenAI API Key: Get from platform.openai.com
# Verify installations
python --version # Should be 3.11+
node --version # Should be 20+
git --version # Should be 2.x+π§ Linux (Ubuntu/Debian)
# Update system
sudo apt update && sudo apt upgrade -y
# Install Python 3.11+
sudo apt install python3.11 python3.11-venv python3-pip -y
# Install Node.js 20+
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install Git
sudo apt install git -y
# Verify installations
python3.11 --version
node --version
git --versionπ macOS
# Install Homebrew if not installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install required tools
brew install python@3.11 node git
# Verify installations
python3.11 --version
node --version
git --versiongit clone https://github.com/viniciusvollrath/WiFi-Kids.git
cd WiFi-Kidsπͺ Windows
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv .venv
# Activate virtual environment
.venv\Scripts\activate
# Upgrade pip and install dependencies
python -m pip install --upgrade pip
pip install -e .
# Copy environment template
copy env.example .env
# Edit .env file with your OpenAI API key
# OPENAI_API_KEY=your_actual_api_key_hereπ§ Linux / π macOS
# Navigate to backend directory
cd backend
# Create virtual environment
python3.11 -m venv .venv
# Activate virtual environment
source .venv/bin/activate
# Upgrade pip and install dependencies
pip install --upgrade pip
pip install -e .
# Copy environment template
cp env.example .env
# Edit .env file with your OpenAI API key
# nano .env # or use your preferred editor
# Set: OPENAI_API_KEY=your_actual_api_key_hereEdit the .env file in the backend/ directory:
# OpenAI Configuration (REQUIRED)
OPENAI_API_KEY=sk-your-actual-openai-api-key-here
OPENAI_MODEL=GPT-5
OPENAI_TEMPERATURE=0.3
OPENAI_MAX_TOKENS=1000
# Database (SQLite for development)
DATABASE_URL=sqlite:///./dev.db
# Session Configuration
SESSION_TTL_SEC=1800 # 30 minutes internet access
CHALLENGE_REQUIRED=true
CHALLENGE_ATTEMPTS=3
# Agent Configuration
AGENT_TYPE=langchain
AGENT_DEFAULT_PERSONA=tutor # tutor | maternal | general
ROUTER_ENABLED=true
# CORS (add your domain for production)
CORS_ORIGINS=http://localhost:5174,https://your-domain.com
# Timezone and Access Windows
DEFAULT_TIMEZONE=America/Sao_Paulo
ACCESS_WINDOWS=07:00-21:00# Make sure you're in backend/ directory with activated virtual environment
cd backend
source .venv/bin/activate # Linux/macOS
# OR
.venv\Scripts\activate # Windows
# Run database migrations
alembic upgrade head
# Verify database was created
ls -la *.db # Should show dev.db# Navigate to frontend directory
cd ui/webapp/apps/pwa
# Install dependencies
npm install
# Verify installation
npm run test:runπ§ͺ Run Backend Tests
cd backend
# Activate virtual environment if not already active
source .venv/bin/activate # Linux/macOS
# OR
.venv\Scripts\activate # Windows
# Run comprehensive tests
python run_tests.py --coverage --lint --type-check
# Expected output:
# β
All tests should pass
# β
Coverage should be 80%+
# β
Linting should pass
# β
Type checking should passπ§ͺ Run Frontend Tests
cd ui/webapp/apps/pwa
# Run tests
npm run test:run
# Expected output:
# β
All component tests should pass
# β
Integration tests should passTerminal 1 (Backend):
cd backend
source .venv/bin/activate # Linux/macOS or .venv\Scripts\activate (Windows)
uvicorn api.main:app --host 0.0.0.0 --port 8002 --reloadTerminal 2 (Frontend):
cd ui/webapp/apps/pwa
npm run dev- Frontend: http://localhost:5174
- Backend API: http://localhost:8002
- API Documentation: http://localhost:8002/docs
- OpenAPI Spec: http://localhost:8002/openapi.json
The project has comprehensive testing with strict requirements:
# Backend testing
cd backend
python run_tests.py --coverage --lint --type-check
# Frontend testing
cd ui/webapp/apps/pwa
npm run test:run
# Run specific test categories
python run_tests.py --category unit # Unit tests only
python run_tests.py --category integration # API tests
python run_tests.py --category e2e # End-to-end tests
python run_tests.py --category analytics # Analytics tests# Build frontend
cd ui/webapp/apps/pwa
npm run build
# The built files will be in dist/
# Ready for deployment to Cloudflare Pages- Backend Logs: Check console output with detailed AI interaction logs
- Frontend Errors: Browser DevTools console shows detailed error information
- Database: SQLite browser or CLI to inspect data
- AI Responses: Debug logs show conversation history and AI reasoning
The project is pre-configured for seamless Cloudflare Pages deployment:
-
Fork/Clone the repository to your GitHub account
-
Set up Cloudflare Pages:
- Connect your GitHub repository
- Build command:
npm run build - Build output directory:
dist - Root directory:
ui/webapp/apps/pwa
-
Environment Variables (in Cloudflare Pages dashboard):
VITE_API_URL=https://your-backend-api.com VITE_MOCK=false VITE_DEBUG=false -
Deploy Backend to your preferred platform:
- Railway, Render, DigitalOcean, AWS, etc.
- Use the
backend/directory - Set environment variables from
env.example
The repository includes automated deployment via GitHub Actions:
- Frontend: Automatically deploys to Cloudflare Pages on push to
main - Backend: Tests run on every PR and push
- Quality Gates: Tests, linting, and type checking must pass
- Choose Language: Select Portuguese or English at the start
- Access Internet: Click "Access Internet" to begin the challenge
- Answer Questions: Engage with the AI tutor in a conversational manner
- Get Feedback: Receive detailed, encouraging feedback on answers
- Learn Continuously: Use "Keep Learning" for additional educational content
- Configure Sessions: Adjust session duration in backend environment
- Set Personas: Choose between Tutor, Maternal, or General teaching styles
- Monitor Usage: Check logs and analytics through the API endpoints
- Customize Subjects: Configure available subjects in environment variables
- API Keys: Never commit OpenAI API keys to version control
- Environment Files: Keep
.envfiles private and secure - CORS Configuration: Properly configure allowed origins for production
- Input Validation: All user inputs are validated and sanitized
- Rate Limiting: API endpoints have built-in rate limiting protection
The system includes comprehensive analytics:
- Session Tracking: Monitor student progress and time spent
- Performance Metrics: Track AI response times and success rates
- Learning Analytics: Analyze subject preferences and difficulty progression
- Usage Patterns: Understand peak usage times and session durations
Access analytics through the API at /analytics/* endpoints.
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch
- Make your changes
- Add/update tests
- Ensure all tests pass
- Submit a pull request
- 80%+ test coverage required
- Type hints for all Python functions
- ESLint/Prettier for TypeScript/React code
- Conventional commits for clear change history
The backend provides automatic API documentation:
- Interactive Docs: http://localhost:8002/docs (Swagger UI)
- ReDoc: http://localhost:8002/redoc (Alternative documentation)
- OpenAPI Spec: http://localhost:8002/openapi.json (Machine-readable)
POST /challenge/generate- Generate new educational challengesPOST /challenge/answer- Submit answers for validationGET /analytics/*- Access usage analytics and metricsPOST /session/*- Session management endpoints
Common Issues & Solutions
β "OPENAI_API_KEY is required"
- Solution: Add your OpenAI API key to the
.envfile in backend/
β "Connection refused" on frontend
- Solution: Make sure backend is running on port 8002
- Check if
.envfile exists and is properly configured
β "Database locked" error
- Solution: Stop all running instances and delete
dev.db, then runalembic upgrade head
β Frontend build fails
- Solution: Run
npm cito clean install dependencies - Check Node.js version (should be 20+)
β Tests failing
- Solution: Ensure virtual environment is activated
- Run
pip install -e .to reinstall dependencies - Check Python version (should be 3.11+)
β "Module not found" errors
- Solution: Make sure you're in the correct directory and virtual environment is activated
- For backend:
cd backend && source .venv/bin/activate - For frontend:
cd ui/webapp/apps/pwa
MIT License - see LICENSE for details.
- Repository: WiFi-Kids
- OpenAI API: platform.openai.com
- LangChain Documentation: langchain.com
- FastAPI Documentation: fastapi.tiangolo.com
- React Documentation: reactjs.org
- Cloudflare Pages: pages.cloudflare.com
- Paulo Cesar β AI Engineering, Lanchain Integration, Database Design, API
- Lucas Nogueira β Backend, API
- Vinicius Vollrath β Frontend Development, Infrastructure, DevOps
π Wi-Fi Kids: Learn before you surf. π
Transform screen time into learning time with AI-powered educational conversations.