- Project Overview
- Core Features
- Architecture
- Technology Stack
- Project Structure
- Smart Contracts
- Backend Services
- Frontend Application
- Database Schema
- API Documentation
- Setup & Installation
- Deployment
- Security Features
- Contributing
OpenLearnX is a cutting-edge, decentralized learning and assessment platform that revolutionizes how learners acquire, demonstrate, and verify their skills. Built on Web3 technologies, it combines adaptive learning algorithms, real-time feedback systems, and blockchain-based certification to create a transparent, verifiable, and personalized educational experience.
To democratize education by providing learners with:
- Personalized, adaptive learning experiences that scale with their skill level
- Instant, actionable feedback on their performance
- Immutable, blockchain-verified certificates that employers can trust
- Full ownership of their learning data through decentralized storage
- Traditional Credentials Are Unverifiable: Paper certificates and digital badges can be forged
- One-Size-Fits-All Learning: Static courses don't adapt to individual learner needs
- Delayed Feedback: Students wait days or weeks for assessment results
- Data Ownership: Learners don't control their educational records
- Skill Verification: Employers struggle to verify claimed skills
- Dynamic Difficulty Adjustment: Questions adapt in real-time based on learner performance
- Personalized Learning Paths: AI-driven recommendation engine suggests optimal learning sequences
- Skill Gap Analysis: Identifies weaknesses and focuses learning where it's needed most
- Progressive Difficulty Curve: Gradually increases challenge as competency improves
- Real-Time Code Execution: Run and test code in multiple programming languages
- Immediate Results: Get instant feedback on quiz answers and code submissions
- Detailed Explanations: Understand why answers are correct or incorrect
- Performance Analytics: Track progress over time with comprehensive metrics
- ERC-721 NFT Certificates: Each certificate is a unique, non-transferable NFT
- On-Chain Verification: Anyone can verify certificate authenticity on the blockchain
- IPFS Metadata Storage: Certificate details stored on decentralized storage
- Permanent Record: Certificates cannot be revoked or altered once minted
- Wallet Integration: MetaMask wallet connects learners to their certificates
- Student Dashboard:
- Progress tracking across multiple subjects
- Competency radar charts showing skill distribution
- Certificate gallery with blockchain verification
- Learning history and timeline
- Instructor Dashboard:
- Class performance analytics
- Student progress monitoring
- Assessment creation and management
- Bias detection in grading
- Supported Languages: Python, JavaScript, Java, C++, C, Go, Rust, and more
- Secure Execution: Sandboxed environment with resource limits
- Real-Time Output: See compilation errors and execution results instantly
- Test Cases: Automated testing against predefined test cases
- LLM Integration: Uses machine learning to generate contextual questions
- Adaptive Question Selection: Picks questions based on difficulty and topic
- Auto-Grading: Automated evaluation of multiple-choice and coding questions
- Question Banking: Extensive library of pre-validated questions
- Collaborative Learning: Students review each other's work
- Bias Detection: AI monitors for grading bias and inconsistencies
- Portfolio Building: Showcase best work for potential employers
- Anonymous Reviews: Optional anonymity to reduce bias
- Peer-to-Peer Communication: Built on blockchain smart contracts
- Study Groups: Create topic-based discussion channels
- Encrypted Messages: Private, secure communication
- Persistent History: Chat logs stored on-chain
OpenLearnX follows a modern microservices architecture with clear separation of concerns:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Frontend Layer โ
โ (Next.js 14 + React + TypeScript + TailwindCSS) โ
โ - User Interface โ
โ - Wallet Integration (MetaMask) โ
โ - Real-time Updates โ
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTPS/WebSocket
โโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend Layer (Flask) โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Auth Service โ โ Quiz Service โ โ Cert Service โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Compiler Svc โ โ Dashboard Svcโ โ Adaptive AI โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโดโโโโโโ โโโโโโโโดโโโโโโโ โโโโโโโดโโโโโโโโโโโ
โ MongoDB โ โ PostgreSQL โ โ Redis Cache โ
โ (Primary DB)โ โ (Future) โ โ (Sessions) โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ
โ
โโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Blockchain Layer (Ethereum/Anvil) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ CertificateNFT Smart Contract (Solidity)โ โ
โ โ - Mint NFT certificates โ โ
โ โ - Verify authenticity โ โ
โ โ - Track ownership โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโดโโโโโโ
โ IPFS โ (Decentralized Storage)
โ Metadata โ - Certificate details
โ Storage โ - Learning records
โโโโโโโโโโโโโโโโ
- Microservices: Each major feature is a separate service for scalability
- Blockchain Integration: Ethereum smart contracts for immutable certificates
- Hybrid Storage: MongoDB for application data, IPFS for decentralized storage
- JWT Authentication: Stateless authentication with wallet-based identity
- Real-Time Processing: WebSocket connections for live updates
- Containerization: Docker for consistent deployment across environments
- Framework: Next.js 14 (React 18)
- Language: TypeScript
- Styling: TailwindCSS
- UI Components: Radix UI, shadcn/ui
- State Management: React Context + Hooks
- Web3 Integration:
- ethers.js / web3.js
- MetaMask SDK
- wagmi (React Hooks for Ethereum)
- Charts & Visualization: Chart.js, Recharts
- Forms: React Hook Form + Zod validation
- HTTP Client: Axios
- Animations: Framer Motion
- Framework: Flask 2.3.3 (Python)
- Async Support: asyncio, motor (async MongoDB driver)
- API Type: REST + WebSocket
- Authentication:
- Flask-JWT-Extended
- Wallet signature verification (Web3)
- CORS: Flask-CORS
- Environment: python-dotenv
- Primary: MongoDB 6.0+
- Document-based storage for flexible schemas
- Collections: users, courses, quizzes, certificates, submissions
- Cache: Redis 7
- Session management
- Rate limiting
- Temporary data storage
- Future: PostgreSQL (planned for relational data)
- Smart Contract Language: Solidity 0.8.19
- Development Framework: Foundry
- forge (testing and building)
- anvil (local Ethereum node)
- cast (CLI for contract interaction)
- Smart Contract Standards:
- ERC-721 (NFT certificates)
- OpenZeppelin contracts (security-audited base contracts)
- Network:
- Local: Anvil (development)
- Production: Ethereum mainnet / L2 solutions (Polygon, Arbitrum)
- Framework: TensorFlow 2.17, Keras 3.2
- Data Processing: NumPy, Pandas, scikit-learn
- NLP: (for question generation and analysis)
- Adaptive Algorithm: Custom implementation with reinforcement learning principles
- Containerization: Docker, Docker Compose
- CI/CD: GitHub Actions (implied)
- Deployment:
- Single-server: deploy-single.sh script
- Container orchestration ready
- Monitoring: Application logs, TensorFlow metrics
- Encryption: PyCryptodome (AES encryption)
- Password Hashing: passlib with bcrypt
- JWT: PyJWT with cryptographic signatures
- Web3 Security: eth-account for signature verification
- Secure Code Execution: Sandboxed Docker containers for code compilation
OpenLearnX/
โโโ backend/ # Flask backend application
โ โโโ main.py # Application entry point
โ โโโ requirements.txt # Python dependencies
โ โ
โ โโโ contracts/ # Solidity smart contracts
โ โ โโโ CertificateNFT.sol # ERC-721 NFT certificate contract
โ โ
โ โโโ routes/ # API route handlers
โ โ โโโ auth.py # Authentication endpoints
โ โ โโโ quizzes.py # Quiz management
โ โ โโโ adaptive_quiz.py # Adaptive testing
โ โ โโโ certificate.py # NFT certificate minting
โ โ โโโ dashboard.py # Analytics and dashboards
โ โ โโโ compiler.py # Code compilation service
โ โ โโโ coding.py # Coding challenges
โ โ โโโ exam.py # Examination system
โ โ โโโ courses.py # Course management
โ โ โโโ admin.py # Admin panel
โ โ โโโ test_flow.py # Testing workflows
โ โ
โ โโโ services/ # Business logic layer
โ โ โโโ ai_quiz_service.py # AI-powered quiz generation
โ โ โโโ adaptive_quiz_service.py # Adaptive algorithm
โ โ โโโ compiler_service.py # Code compilation logic
โ โ โโโ real_compiler_service.py # Real code execution
โ โ โโโ dashboard_service.py # Dashboard data aggregation
โ โ โโโ wallet_service.py # Web3 wallet interactions
โ โ
โ โโโ models/ # Data models
โ โ โโโ user.py # User data model
โ โ โโโ certificate.py # Certificate model
โ โ โโโ dashboard_models.py # Dashboard data structures
โ โ
โ โโโ utils/ # Utility functions
โ โ โโโ adaptive_engine.py # Adaptive learning engine
โ โ
โ โโโ scripts/ # Deployment and utility scripts
โ โ โโโ deploy.py # Smart contract deployment
โ โ
โ โโโ llmtrain/ # ML model training
โ โโโ cache/ # Temporary cache
โ โโโ mongo_service.py # MongoDB connection service
โ โโโ web3_service.py # Web3 blockchain service
โ โโโ quiz_master.py # Quiz orchestration
โ โโโ seed_courses.py # Database seeding
โ โ
โ โโโ foundry.toml # Foundry configuration
โ โโโ deployment.json # Contract deployment info
โ โโโ Dockerfile # Backend container config
โ
โโโ frontend/ # Next.js frontend application
โ โโโ app/ # Next.js 14 app directory
โ โ โโโ page.tsx # Home page
โ โ โโโ layout.tsx # Root layout
โ โ โโโ globals.css # Global styles
โ โ โ
โ โ โโโ auth/ # Authentication pages
โ โ โโโ dashboard/ # Dashboard pages
โ โ โโโ certificate/ # Certificate gallery
โ โ โโโ courses/ # Course browsing
โ โ โโโ coding/ # Code challenges
โ โ โโโ compiler/ # Online compiler
โ โ โโโ adaptive-quiz/ # Adaptive tests
โ โ โโโ join-test/ # Test joining flow
โ โ โโโ admin/ # Admin panel
โ โ
โ โโโ components/ # Reusable React components
โ โ โโโ ui/ # shadcn/ui components
โ โ
โ โโโ context/ # React Context providers
โ โโโ hooks/ # Custom React hooks
โ โโโ lib/ # Utility libraries
โ โโโ styles/ # Additional styles
โ โ
โ โโโ package.json # Node.js dependencies
โ โโโ tsconfig.json # TypeScript configuration
โ โโโ tailwind.config.ts # TailwindCSS configuration
โ โโโ next.config.mjs # Next.js configuration
โ โโโ components.json # shadcn/ui config
โ
โโโ chatApp/ # Decentralized chat feature
โ โโโ chatApp.sol # Chat smart contract
โ โโโ index.html # Chat interface
โ โโโ account.html # Account management
โ โโโ styles.css # Chat styling
โ
โโโ .wake/ # Wake AI agent configuration
โ
โโโ docker-compose.yml # Multi-container orchestration
โโโ Dockerfile # Main application container
โโโ deploy-single.sh # Single-server deployment script
โโโ requirements.txt # Python dependencies (root)
โโโ README.md # Project overview
โโโ steps.md # Setup instructions
โโโ .gitignore # Git ignore rules
โโโ .dockerignore # Docker ignore rules
โโโ .gitmodules # Git submodules (OpenZeppelin)
Purpose: Issue tamper-proof, blockchain-verified certificates as NFTs.
Key Features:
- ERC-721 compliant (standard NFT)
- Stores certificate metadata on-chain
- Tracks certificate ownership
- Verifiable by anyone on the blockchain
Contract Structure:
contract CertificateNFT is ERC721, ERC721URIStorage, Ownable {
struct Certificate {
string subject; // Course/subject name
string studentName; // Learner name
uint256 score; // Achievement score
uint256 timestamp; // Issue date
bool verified; // Verification status
}
// Main functions:
- mintCertificate(address to, string tokenURI)
- mintCertificateWithDetails(...)
- getCertificate(uint256 tokenId)
- getUserCertificates(address user)
- verifyCertificate(uint256 tokenId)
}Key Functions:
-
mintCertificate: Creates a basic certificate NFT
- Only owner (platform) can mint
- Assigns to learner's wallet
- Returns token ID
-
mintCertificateWithDetails: Creates detailed certificate
- Includes subject, name, score
- Timestamp automatically set
- Emits CertificateMinted event
-
verifyCertificate: Public verification
- Anyone can check authenticity
- Returns verification status
-
getUserCertificates: Get all certificates for a wallet
- Returns array of token IDs
- Used for portfolio display
Deployment:
- Deployed using Foundry (forge)
- Uses OpenZeppelin audited base contracts
- Deployed on local Anvil node for development
- Ready for mainnet/L2 deployment
Endpoints:
POST /api/auth/nonce- Generate nonce for wallet signaturePOST /api/auth/verify- Verify wallet signature and issue JWTPOST /api/auth/register- Register new user with walletGET /api/auth/profile- Get user profile (requires JWT)
Authentication Flow:
1. User connects MetaMask wallet
2. Frontend requests nonce from backend
3. User signs nonce with private key
4. Backend verifies signature matches wallet address
5. Backend issues JWT token
6. JWT used for subsequent requests
Security:
- Wallet-based authentication (no passwords)
- Time-limited nonces (prevent replay attacks)
- JWT with expiration
- Signature verification using eth-account
Features:
- Create, read, update, delete quizzes
- Multiple question types (MCQ, coding, essay)
- Auto-grading for objective questions
- Manual grading interface for subjective questions
- Quiz attempt tracking
- Time limits and deadlines
Endpoints:
POST /api/quizzes- Create quizGET /api/quizzes- List all quizzesGET /api/quizzes/:id- Get quiz detailsPOST /api/quizzes/:id/attempt- Submit quiz attemptGET /api/quizzes/:id/results- Get results
Adaptive Algorithm:
- Uses Item Response Theory (IRT)
- Adjusts question difficulty based on performance
- Estimates learner ability in real-time
- Provides personalized question selection
How It Works:
1. Start with medium difficulty question
2. If correct โ increase difficulty
3. If incorrect โ decrease difficulty
4. Track ability estimate (theta)
5. Select next question optimally for ability level
6. Repeat until convergence or question limitEndpoints:
POST /api/adaptive-quiz/start- Start adaptive testPOST /api/adaptive-quiz/answer- Submit answer, get next questionGET /api/adaptive-quiz/results- Final results and ability estimate
Certificate Issuance Flow:
1. User completes quiz/course
2. Backend verifies completion and score
3. Generate certificate metadata (JSON)
4. Upload metadata to IPFS
5. Call smart contract to mint NFT
6. Store transaction hash in database
7. Return certificate to user
Endpoints:
POST /api/certificates/mint- Mint new certificateGET /api/certificates/:id- Get certificate detailsGET /api/certificates/user/:wallet- Get user's certificatesGET /api/certificates/verify/:tokenId- Verify certificate on blockchain
IPFS Integration:
- Metadata stored on IPFS for permanence
- Contains: name, subject, score, issue date, image
- IPFS hash stored in smart contract
- Ensures data can't be lost or altered
Supported Languages:
- Python (3.x)
- JavaScript (Node.js)
- Java
- C++, C
- Go
- Rust
- Ruby
- PHP
Execution Flow:
1. Receive code and language from frontend
2. Create isolated Docker container
3. Write code to file inside container
4. Compile (if needed)
5. Execute with resource limits (CPU, memory, time)
6. Capture stdout, stderr
7. Return output to user
8. Clean up container
Security Features:
- Sandboxed execution (Docker)
- Resource limits (prevent infinite loops)
- Network isolation
- No file system access outside container
- Timeout enforcement
Endpoints:
POST /api/compiler/run- Execute codePOST /api/compiler/test- Run against test cases
Analytics Provided:
- Overall progress percentage
- Competency radar chart (skill distribution)
- Time series of performance
- Subject-wise breakdown
- Recent activity timeline
- Strengths and weaknesses
Student Dashboard:
- My courses and progress
- Recent quiz scores
- Certificates earned
- Upcoming deadlines
- Recommended next steps
Instructor Dashboard:
- Class average performance
- Student progress tracking
- Question statistics (difficulty, discrimination)
- Grading queue
- Bias detection alerts
Endpoints:
GET /api/dashboard/student- Student analyticsGET /api/dashboard/instructor- Instructor analyticsGET /api/dashboard/competency- Competency mapping
Question Generation:
- Uses TensorFlow models
- Generates contextual questions based on topic
- Validates question quality
- Creates distractors (wrong answers) for MCQs
Features:
- Topic-based generation
- Difficulty control
- Question type variety
- Quality scoring
- Platform introduction
- Feature highlights
- Call to action (Connect Wallet)
- Statistics (users, certificates issued, courses)
- MetaMask connection
- Wallet signature verification
- User registration flow
- Profile management
- Progress overview
- Recent activity
- Quick actions
- Performance charts
- Course catalog
- Course details
- Enrollment
- Course progress
- Quiz interface
- Real-time difficulty adjustment
- Instant feedback
- Progress indicator
- Problem description
- Code editor (Monaco Editor)
- Test cases
- Submission and results
- Multi-language support
- Live code execution
- Output display
- Error handling
- User's certificates
- Blockchain verification
- Download/share options
- QR code for verification
- User management
- Course creation
- Quiz authoring
- Analytics and reports
UI Components (shadcn/ui):
- Buttons, Cards, Dialogs
- Forms, Inputs, Selects
- Tables, Tabs, Toast notifications
- Accordions, Alerts, Avatars
Custom Components:
- WalletConnect: MetaMask integration
- QuestionCard: Quiz question display
- CodeEditor: Syntax-highlighted editor
- ProgressChart: Performance visualization
- CertificateCard: NFT certificate display
{
"_id": ObjectId,
"wallet_address": "0x...",
"username": "string",
"email": "string",
"role": "student|instructor|admin",
"created_at": ISODate,
"profile": {
"name": "string",
"bio": "string",
"avatar": "string"
},
"stats": {
"quizzes_completed": 0,
"certificates_earned": 0,
"total_score": 0
}
}{
"_id": ObjectId,
"title": "string",
"description": "string",
"instructor_id": ObjectId,
"topics": ["array of strings"],
"difficulty": "beginner|intermediate|advanced",
"created_at": ISODate,
"quizzes": ["array of quiz IDs"],
"enrollments": 0
}{
"_id": ObjectId,
"course_id": ObjectId,
"title": "string",
"description": "string",
"questions": [
{
"id": "string",
"type": "mcq|coding|essay",
"question": "string",
"options": ["array"],
"correct_answer": "string|array",
"points": 0,
"difficulty": 0.0-1.0
}
],
"time_limit": 3600,
"passing_score": 70,
"adaptive": true|false
}{
"_id": ObjectId,
"quiz_id": ObjectId,
"user_id": ObjectId,
"started_at": ISODate,
"completed_at": ISODate,
"answers": [
{
"question_id": "string",
"user_answer": "string",
"is_correct": true|false,
"points_earned": 0
}
],
"score": 0,
"percentage": 0.0,
"ability_estimate": 0.0,
"passed": true|false
}{
"_id": ObjectId,
"user_id": ObjectId,
"wallet_address": "0x...",
"course_id": ObjectId,
"quiz_id": ObjectId,
"token_id": 0,
"transaction_hash": "0x...",
"ipfs_hash": "string",
"subject": "string",
"score": 0,
"issued_at": ISODate,
"metadata": {
"name": "string",
"description": "string",
"image": "string"
}
}Development: http://localhost:5000/api
Production: https://your-domain.com/api
All protected endpoints require JWT token in header:
Authorization: Bearer <jwt_token>
{
"success": true|false,
"data": {},
"message": "string",
"error": "string" // only on failure
}| Method | Endpoint | Description | Auth |
|---|---|---|---|
| Authentication | |||
| POST | /auth/nonce | Get nonce for wallet signature | No |
| POST | /auth/verify | Verify signature and get JWT | No |
| POST | /auth/register | Register new user | No |
| GET | /auth/profile | Get user profile | Yes |
| Quizzes | |||
| GET | /quizzes | List all quizzes | No |
| GET | /quizzes/:id | Get quiz details | Yes |
| POST | /quizzes/:id/attempt | Submit quiz attempt | Yes |
| GET | /quizzes/:id/results | Get quiz results | Yes |
| Adaptive Quiz | |||
| POST | /adaptive-quiz/start | Start adaptive test | Yes |
| POST | /adaptive-quiz/answer | Submit answer | Yes |
| GET | /adaptive-quiz/results | Get final results | Yes |
| Certificates | |||
| POST | /certificates/mint | Mint certificate | Yes |
| GET | /certificates/user/:wallet | Get user certificates | No |
| GET | /certificates/verify/:tokenId | Verify certificate | No |
| Compiler | |||
| POST | /compiler/run | Execute code | Yes |
| POST | /compiler/test | Run test cases | Yes |
| Dashboard | |||
| GET | /dashboard/student | Student analytics | Yes |
| GET | /dashboard/instructor | Instructor analytics | Yes |
| Courses | |||
| GET | /courses | List courses | No |
| GET | /courses/:id | Get course details | No |
| POST | /courses/:id/enroll | Enroll in course | Yes |
- Operating System: Linux, macOS, or WSL (Windows Subsystem for Linux)
- Node.js: v18+ (for frontend)
- Python: 3.10+ (for backend)
- MongoDB: 6.0+ (database)
- Docker: 20.10+ (optional, for containerized deployment)
- Git: For cloning repository
- MetaMask: Browser extension for Web3
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
# Reload shell configuration
source ~/.bashrc # or source ~/.zshrc
# Install Foundry toolchain
foundryup
# Verify installation
forge --version
anvil --version
cast --versiongit clone https://github.com/th30d4y/OpenLearnX.git
cd OpenLearnXcd backend
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy environment template
cp .env.example .env # Create this if it doesn't exist
# Edit .env with your settings
nano .envRequired Environment Variables (.env):
# Flask
FLASK_APP=main.py
FLASK_ENV=development
SECRET_KEY=your-secret-key-here
# MongoDB
MONGODB_URI=mongodb://localhost:27017/openlearnx
# Redis (optional)
REDIS_URL=redis://localhost:6379
# Web3
WEB3_PROVIDER_URL=http://127.0.0.1:8545
CONTRACT_ADDRESS=0x... # Set after deploying contract
# IPFS (optional)
IPFS_GATEWAY=https://ipfs.io/ipfs/
# JWT
JWT_SECRET_KEY=your-jwt-secret
JWT_ACCESS_TOKEN_EXPIRES=3600Terminal 1 - Run Anvil:
anvil --fork-url https://eth.merkle.ioThis starts a local Ethereum node. Keep this running.
Output:
Available Accounts
==================
(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000 ETH)
...
Private Keys
==================
(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
...
Chain ID
==================
31337
Terminal 2:
cd backend
source venv/bin/activate
# Deploy contract
python3 scripts/deploy.pyOutput:
Deploying CertificateNFT contract...
Contract deployed at: 0x5FbDB2315678afecb367f032d93F642f64180aa3
Transaction hash: 0x...
Important: Copy the contract address to your .env file:
CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3Terminal 3:
cd backend
source venv/bin/activate
# Seed database (optional)
python3 seed_courses.py
# Start Flask app
python3 main.pyOutput:
* Running on http://127.0.0.1:5000
* Running on http://192.168.x.x:5000
Test Backend:
# Health check
curl http://127.0.0.1:5000/
# Test nonce generation
curl -X POST http://127.0.0.1:5000/api/auth/nonce \
-H "Content-Type: application/json" \
-d '{"wallet_address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"}'Linux (Arch):
yay -S mongodb-bin
sudo systemctl start mongodb
sudo systemctl enable mongodb
mongosh # Test connectionmacOS:
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
mongosh # Test connectionDocker:
docker run -d -p 27017:27017 --name mongodb mongo:6Terminal 4:
cd frontend
# Install dependencies
pnpm install
# or: npm install
# Copy environment template
cp .env.example .env.local
# Edit .env.local
nano .env.localFrontend Environment Variables (.env.local):
NEXT_PUBLIC_API_URL=http://localhost:5000/api
NEXT_PUBLIC_CHAIN_ID=31337
NEXT_PUBLIC_CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
NEXT_PUBLIC_RPC_URL=http://127.0.0.1:8545Start Frontend:
pnpm run dev
# or: npm run devOutput:
โฒ Next.js 14.0.0
- Local: http://localhost:3000
- Network: http://192.168.x.x:3000
- Open browser: http://localhost:3000
- Install MetaMask extension if not already installed
- Add local network to MetaMask:
- Network Name: Anvil Local
- RPC URL: http://127.0.0.1:8545
- Chain ID: 31337
- Currency Symbol: ETH
- Import account using private key from Anvil
- Connect wallet on homepage
- Start learning!
Includes: Application, MongoDB, Redis, all in one command
# Build and start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downAccess:
- Application: http://localhost:80
- MongoDB: localhost:5432
- Redis: localhost:6379
# Build image
docker build -t openlearnx .
# Run container
docker run -d -p 80:80 \
-e DATABASE_URL=mongodb://host.docker.internal:27017/openlearnx \
-e CONTRACT_ADDRESS=0x... \
--name openlearnx \
openlearnx- VPS or cloud server (AWS, DigitalOcean, etc.)
- Domain name
- SSL certificate (Let's Encrypt)
The project includes deploy-single.sh for single-server deployment:
# Make script executable
chmod +x deploy-single.sh
# Run deployment
./deploy-single.shScript performs:
- Updates system packages
- Installs dependencies
- Clones repository
- Sets up Python environment
- Installs Node.js packages
- Configures MongoDB
- Deploys smart contract
- Starts services
- Sets up Nginx reverse proxy
- Configures SSL
1. Server Setup:
# Update system
sudo apt update && sudo apt upgrade -y
# Install dependencies
sudo apt install -y python3 python3-pip nodejs npm mongodb nginx
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup2. Clone and Configure:
cd /opt
sudo git clone https://github.com/th30d4y/OpenLearnX.git
cd OpenLearnX
# Backend
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Frontend
cd ../frontend
npm install
npm run build3. Deploy Contract (if using public network):
# Set up Ethereum node or use Alchemy/Infura
# Update deploy script with production network
cd backend
python3 scripts/deploy.py --network mainnet4. Configure Nginx:
# /etc/nginx/sites-available/openlearnx
server {
listen 80;
server_name your-domain.com;
# Frontend
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Backend API
location /api {
proxy_pass http://localhost:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}# Enable site
sudo ln -s /etc/nginx/sites-available/openlearnx /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
# Setup SSL
sudo certbot --nginx -d your-domain.com5. Process Management (systemd):
Backend service (/etc/systemd/system/openlearnx-backend.service):
[Unit]
Description=OpenLearnX Backend
After=network.target mongodb.service
[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/OpenLearnX/backend
Environment="PATH=/opt/OpenLearnX/backend/venv/bin"
ExecStart=/opt/OpenLearnX/backend/venv/bin/python main.py
Restart=always
[Install]
WantedBy=multi-user.targetFrontend service (/etc/systemd/system/openlearnx-frontend.service):
[Unit]
Description=OpenLearnX Frontend
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/OpenLearnX/frontend
Environment="NODE_ENV=production"
ExecStart=/usr/bin/npm start
Restart=always
[Install]
WantedBy=multi-user.target# Start services
sudo systemctl daemon-reload
sudo systemctl enable openlearnx-backend openlearnx-frontend
sudo systemctl start openlearnx-backend openlearnx-frontend- No passwords to leak or hack
- Cryptographic signature verification
- User owns their identity (wallet)
- Prevents phishing attacks
- Uses OpenZeppelin audited contracts
- Access control (only owner can mint)
- Non-transferable certificates (soulbound tokens)
- Immutable once minted
- Docker containerization
- Resource limits (CPU, memory, time)
- No network access
- Read-only file system
- Process isolation
- AES encryption for sensitive data
- HTTPS/TLS in production
- JWT with signature verification
- Encrypted database connections
- All inputs sanitized
- SQL injection prevention (using ORM)
- XSS protection
- CSRF tokens
- API rate limits (Redis)
- Prevents DDoS attacks
- Per-user request limits
- Gradual backoff
- File type validation
- Size limits
- Virus scanning (production)
- Isolated storage
- All critical actions logged
- User activity tracking
- Security event monitoring
- Compliance ready
We welcome contributions! Here's how to get started:
-
Fork the Repository
# Click "Fork" on GitHub git clone https://github.com/YOUR_USERNAME/OpenLearnX.git -
Create Feature Branch
git checkout -b feature/your-feature-name
-
Make Changes
- Write clean, documented code
- Follow existing code style
- Add tests for new features
- Update documentation
-
Test Locally
# Backend tests cd backend pytest # Frontend tests cd frontend npm test
-
Commit Changes
git add . git commit -m "feat: add new adaptive algorithm"
Commit Message Format:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changesrefactor:- Code refactoringtest:- Test changeschore:- Build/tool changes
-
Push and Create PR
git push origin feature/your-feature-name # Open Pull Request on GitHub
Python:
- Follow PEP 8
- Use type hints
- Write docstrings for functions
- Maximum line length: 88 characters (Black formatter)
TypeScript/React:
- Use TypeScript strict mode
- Functional components with hooks
- ESLint and Prettier compliant
- Meaningful component names
Smart Contracts:
- Follow Solidity style guide
- Extensive comments
- Gas optimization
- Security first
- ๐ Bug fixes
- โจ New features
- ๐ Documentation improvements
- ๐ Translations/i18n
- ๐จ UI/UX enhancements
- โก Performance optimizations
- ๐งช Test coverage
- ๐ Security audits
โ Alpha Release - Core features functional, under active development
- Wallet authentication
- Basic quiz system
- Adaptive testing algorithm
- NFT certificate minting
- Multi-language compiler
- Student dashboard
- Course management
- Admin panel
- AI question generation refinement
- Peer review system
- Enhanced analytics
- Mobile app (React Native)
- Live proctoring for exams
- Video lessons integration
- Gamification (badges, leaderboards)
- Social features (study groups, forums)
- Marketplace for courses
- Integration with job platforms
- Multi-language support (i18n)
- Offline mode (PWA)
- AI tutor chatbot
- Advanced bias detection
- ๐ Documentation: This file and inline code comments
- ๐ฌ Discussions: GitHub Discussions tab
- ๐ Issues: GitHub Issues for bug reports
- ๐ง Email: [Project maintainer email]
- Be respectful and inclusive
- Help others learn and grow
- Share knowledge freely
- Report security issues privately
[Include license information here - e.g., MIT, Apache 2.0]
- OpenZeppelin: Secure smart contract libraries
- Foundry: Blazing fast Ethereum development toolkit
- Next.js: React framework for production
- TensorFlow: Machine learning framework
- MongoDB: Flexible database solution
- shadcn/ui: Beautiful component library
- All Contributors: Thank you for making OpenLearnX better!
- Lines of Code: ~8,000+ (backend Python)
- Smart Contracts: 1 deployed (CertificateNFT)
- API Endpoints: 30+
- Supported Languages: 8+ (compiler)
- Dependencies:
- Python: 50+ packages
- Node.js: 60+ packages
- Database Collections: 6 primary collections
OpenLearnX aims to become the de facto standard for verifiable online learning. We envision a world where:
- Every learner owns their educational data and credentials
- Employers can instantly verify candidate skills
- Education is accessible, personalized, and continuous
- Certificates are globally recognized and tamper-proof
- Learning adapts to individual needs in real-time
Join us in revolutionizing education! ๐
Last Updated: 2026-01-31 Version: 1.0.0 Maintainer: OpenLearnX Team