Adam1230/educational-environment
0
๐ Educational Training Environment โ ุจูุฆุฉ ุชุฏุฑูุจูุฉ
A modern, gamified educational training platform built for PhD research. Rebuilt with FastAPI + Tailwind CSS + Alpine.js + SQLite โ deployed on Hugging Face Spaces (Docker).
   
๐ Project Structure
edu-app/
โโโ Dockerfile # Docker config for HF Spaces
โโโ requirements.txt # Python dependencies
โโโ README.md
โโโ LICENSE
โโโ app/
โโโ __init__.py
โโโ main.py # FastAPI routes & app entry point
โโโ database.py # SQLAlchemy + SQLite setup
โโโ auth.py # JWT auth + bcrypt password hashing
โโโ static/
โ โโโ Photo/ # All original image assets (86 files)
โโโ templates/
โโโ login.html # Login + Register page (Alpine.js)
โโโ dashboard.html # Main dashboard with all tabs
โโโ module1.html # Module 1 โ Technology Integration Concepts
โโโ module2.html # Module 2 โ Educational Video Production
โโโ module3.html # Module 3 โ Google Forms Assessment
โโโ module4.html # Module 4 โ Digital Communication & Collaboration
โโโ questions.html # Pre-assessment test (15 questions)
โโโ questions2.html # Post-assessment test (15 questions)๐ Step-by-Step Deployment on Hugging Face Spaces
Step 1 โ Create a Hugging Face Account
- Go to https://huggingface.co and sign up (free).
- Verify your email address.
Step 2 โ Create a New Space
- Click your profile icon (top-right) โ "New Space".
- Fill in the form:
- Space name:
educational-environment(or any name you like) - License:
MIT - SDK: Select "Docker" โ CRITICAL
- Visibility:
Public(free) orPrivate(Pro plan) - Click "Create Space".
Step 3 โ Enable Persistent Storage (Important!)
- In your Space, go to Settings tab.
- Scroll to "Persistent Storage".
- Click "Add Persistent Storage" โ choose Small (20GB) (free tier).
- The persistent volume will be mounted at
/dataโ our app uses/code/datafor SQLite.
โ ๏ธ Without persistent storage, user accounts reset every time the Space restarts!
Step 4 โ Upload Your Files
Option A โ Via Hugging Face Web UI (Easiest):
- In your Space, click the "Files" tab.
- Click "Add file" โ "Upload files".
- Upload the entire
edu-app/folder contents: - Drag & drop
Dockerfile,requirements.txt,README.md,LICENSE - Then upload the
app/folder (with all subfolders) - Commit the files.
Option B โ Via Git (Recommended for updates):
# Clone your space
git clone https://huggingface.co/spaces/YOUR_USERNAME/educational-environment
cd educational-environment
# Copy your project files
cp -r /path/to/edu-app/* .
# Configure Git LFS for large files (images)
git lfs install
git lfs track "*.jpg" "*.jpeg" "*.png" "*.jfif" "*.gif"
git add .gitattributes
# Push everything
git add .
git commit -m "Initial deployment of Educational Training Environment"
git pushStep 5 โ Set Environment Variables (Optional but Recommended)
- In your Space โ Settings โ "Repository secrets".
- Add: | Key | Value | |-----|-------| |
SECRET_KEY|your-super-secret-jwt-key-change-this-in-production| |DB_DIR|/data|
IfDB_DIRis not set, the app defaults to/code/data.
Step 6 โ Wait for Build
- After pushing, HF Spaces will automatically build the Docker image.
- Build takes ~2-5 minutes.
- Monitor progress in the "Logs" tab.
- When you see
Application startup complete, your app is live! ๐
Step 7 โ Access Your App
- Your app URL:
https://YOUR_USERNAME-educational-environment.hf.space - The login page will appear โ register a new account and start!
๐ง Local Development
# 1. Clone or download this repo
git clone https://huggingface.co/spaces/YOUR_USERNAME/educational-environment
cd educational-environment
# 2. Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Create data directory
mkdir -p /code/data
# Or set custom path:
export DB_DIR="./data"
# 5. Run the app
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
# 6. Open browser
# โ http://localhost:8000๐ก๏ธ Authentication System
- Registration:
POST /api/registerโ username, email, password (bcrypt hashed) - Login:
POST /api/loginโ returns JWT stored in HttpOnly cookie - Logout:
POST /api/logoutโ clears the cookie - Session: JWT token valid for 7 days
- Protected routes: All pages except
/require valid JWT cookie
Database Schema (SQLite)
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
hashed_password VARCHAR(200) NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);๐จ Tech Stack
๐ API Endpoints
๐ Content Flow (Pedagogical Structure)
Login/Register
โ
โผ
Dashboard
โโโ ๐ Home โ Researcher & Supervisors intro
โโโ ๐ฏ Objectives โ Training environment goals
โโโ ๐ Guide โ 3-section learner guide with 16-step walkthrough
โโโ ๐
Pre-Assessment โ /questions (15 Qs: MCQ + T/F)
โ
โโโ ๐ Content
โ โโโ ๐ Module 1 โ Technology Integration Concepts (3 lessons)
โ โโโ ๐ Module 2 โ Educational Video Production (3 lessons)
โ โโโ ๐ Module 3 โ Google Form Assessment (3 lessons)
โ โโโ ๐ Module 4 โ Digital Communication (3 lessons)
โ
โโโ ๐
Post-Assessment โ /questions2 (15 Qs: MCQ + T/F)
โโโ ๐ฌ Contact โ Researcher infoEach lesson contains:
- Introduction โ Context and overview
- Objectives โ Learning targets (infographic)
- Content โ Core material
- Steps/Tools โ Practical application
- Activity โ Hands-on task (submit to unlock next section)
- Self-Evaluation โ 5-question quiz (โฅ50% to pass)
- Achievement Badge โ Gamification reward
๐ Troubleshooting
๐ License
MIT License โ Copyright (c) 2025 Khloud Gamal Abu-Bakr
Free to use, modify, and distribute with attribution.
๐ฉโ๐ About
Built for the PhD research of Khloud Gamal Abu-Bakr, Teaching Assistant at the Department of Educational Technology, Faculty of Specific Education, Zagazig University, Egypt.
Research Title: The Effect of Different Challenge Patterns in a Gamification-Based Training Environment on Developing Technology Integration Skills among Faculty Members.
Supervisors:
- Prof. Amal El-Sayed Ahmed El-Taher
- Prof. Naglaa Saeed Mohammed
- Dr. Lamia Mohammed El-Hadi
