A decentralized learning platform that combines AI-powered tutoring with blockchain-based achievement NFTs on Solana. Learn Web Development, Blockchain, AI/ML, Python, and Cybersecurity while earning verifiable on-chain credentials.
- Gemini AI Integration - Intelligent tutoring with Google's latest Gemini 2.5 Flash model
- AI Code Autograder - Real-time code evaluation and feedback via an integrated Monaco Editor
- Context-Aware Responses - AI adapts to your learning progress and current lesson
- Interactive Chat - Real-time Q&A with detailed explanations and examples
- Personalized Guidance - Tailored learning experience based on your subject
- Solana Smart Contracts - Secure on-chain profile and progress tracking
- NFT Achievement System - Mint unique NFTs and compressed NFTs (cNFTs) for completed lessons
- Token Rewards - Earn
$LEARNSPL tokens automatically as you progress and master skills - Wallet Integration - Seamless connection with Phantom, Solflare, and other Solana wallets
- Decentralized Credentials - Permanent, verifiable proof of learning achievements
- Visual Skill Tree - Branching, interactive progression paths that map out your optimal learning journey
- Leaderboards - Track your progress and compete against other learners globally
- Course Catalog - 7 distinct courses with 21 interactive lessons spanning from Web Dev to Cybersecurity
- Dark/Light Mode - Polished global toggling between themes with smart color variables
- Responsive Design - Works seamlessly on desktop, tablet, and mobile browsers
- Smooth Animations - Framer Motion utilized for fluid interactions and course card popups
- Progress Tracking - Visual indicators and stats for course completion and balance
Before you begin, ensure you have:
- Node.js (v18 or higher) - Download
- Solana CLI - Installation Guide
- Anchor CLI - Installation Guide
- Gemini API Key - Get Free Key
- Solana Wallet - Phantom or Solflare
- Clone the repository
git clone <your-repo-url>
cd tutor_project- Install dependencies
# Install root dependencies
npm install
# Install frontend dependencies
cd app
npm install
cd ..- Configure Environment Variables
Create app/.env.local:
NEXT_PUBLIC_SOLANA_RPC_ENDPOINT=https://api.devnet.solana.com
GEMINI_API_KEY=your-gemini-api-key-hereGet your free Gemini API key from: https://aistudio.google.com/app/apikey
- Build the Smart Contract
# On Windows with WSL
wsl bash -lc "cd /mnt/d/code2/sah/tutor_project && anchor build"
# On Linux/Mac
anchor build- Start Solana Test Validator
# On Windows with WSL
wsl bash -ilc "cd /mnt/d/code2/sah/tutor_project && solana-test-validator --reset"
# On Linux/Mac
solana-test-validator --resetKeep this terminal running in the background.
- Deploy Smart Contract
# On Windows with WSL
wsl bash -lc "cd /mnt/d/code2/sah/tutor_project && anchor deploy"
# On Linux/Mac
anchor deploy- Start the Frontend
cd app
npm run dev- Open the App
Navigate to: http://localhost:3000
For convenience on Windows, use the provided batch script:
start-dev.batThis automatically starts both the validator and frontend.
- Click the "Connect Wallet" button in the top right
- Select your Solana wallet (Phantom, Solflare, etc.)
- Approve the connection
- Once connected, create your tutor profile
- Your progress will be saved on-chain
- Filter by category: Web Development, Blockchain, AI & ML, etc.
- View course cards with progress indicators
- Click "Continue" to start or resume a course
- Read lesson content (documents, videos, or interactive)
- Ask questions in the AI chat interface
- Get personalized explanations and examples
- After understanding a lesson, click "Complete Lesson & Mint Achievement NFT"
- A unique NFT is minted and sent to your wallet
- Your level increases and next lesson unlocks
- View completed lessons in the sidebar
- Check achievement NFTs earned
- See your current level
tutor_project/
├── programs/
│ └── tutor_project/
│ └── src/
│ └── lib.rs # Solana smart contract (Anchor)
├── tests/
│ └── tutor_project.ts # Smart contract tests
├── app/ # Next.js frontend
│ ├── app/
│ │ ├── page.tsx # Main entry point
│ │ ├── layout.tsx # Root layout with providers
│ │ ├── globals.css # Global styles
│ │ └── api/
│ │ └── chat/
│ │ └── route.ts # Gemini AI API route
│ ├── components/
│ │ ├── WalletProvider.tsx # Solana wallet integration
│ │ ├── TutorPage.tsx # Main app component
│ │ ├── LessonViewer.tsx # Lesson display component
│ │ ├── AIChat.tsx # AI chat interface
│ │ ├── FloatingChatBot.tsx # Floating chat widget
│ │ ├── ThemeToggle.tsx # Dark/light mode toggle
│ │ └── Toaster.tsx # Toast notifications
│ ├── lib/
│ │ ├── types.ts # TypeScript type definitions
│ │ ├── constants.ts # App constants & course data
│ │ ├── anchor-client.ts # Solana program client
│ │ └── nft-minter.ts # NFT minting utilities
│ └── public/ # Static assets
├── Anchor.toml # Anchor configuration
├── Cargo.toml # Rust dependencies
├── package.json # Root package.json
├── start-dev.bat # Windows startup script
├── PROJECT_COMPLETE.md # Project documentation
├── QUICKSTART.md # Quick start guide
└── README.md # This file
# On Windows with WSL
wsl bash -lc "cd /mnt/d/code2/sah/tutor_project && anchor test"
# On Linux/Mac
anchor testAll 4 tests should pass:
- ✅ Initialize tutor profile
- ✅ Update progress
- ✅ Prevent duplicate profiles
- ✅ Fetch tutor profile
- Next.js 15 - React framework with App Router
- React 19 - Latest React features
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- Framer Motion - Smooth animations
- Sonner - Toast notifications
- Solana - High-performance blockchain
- Anchor - Solana development framework
- Metaplex - NFT minting standard
- @solana/web3.js - Solana JavaScript SDK
- @solana/wallet-adapter - Wallet integration
- Google Gemini 2.5 Flash - Latest AI model
- @google/generative-ai - Gemini SDK
- Rust - Smart contract language
- Cargo - Rust package manager
- WSL - Windows Subsystem for Linux (Windows only)
DC5BMrRcTAQEk2N8B6eYzxDyuCWXjLVqP3MJEg8F2fgu
Creates a new tutor profile (one per wallet)
- Accounts: user, tutor_profile, system_program
- Args: subject (String)
- Creates: PDA-based profile with initial level 1
Updates user's learning progress
- Accounts: user, tutor_profile
- Args: new_level (u8), milestone_hash ([u8; 32])
- Updates: Level and milestone tracking
pub struct TutorProfile {
pub owner: Pubkey, // Wallet address
pub subject: String, // Learning subject
pub level: u8, // Current level
pub created_at: i64, // Timestamp
pub last_milestone: [u8; 32] // Latest achievement hash
}AI chat endpoint for tutoring interactions
Request Body:
{
"messages": [
{ "role": "user", "content": "Explain smart contracts" }
],
"subject": "Blockchain Fundamentals",
"currentLesson": {
"id": 4,
"title": "Introduction to Blockchain"
}
}Response:
{
"message": "Smart contracts are self-executing programs..."
}# Kill existing Node processes
Get-Process -Name node -ErrorAction SilentlyContinue | Stop-Process -Force
# Restart
cd app
npm run dev- Verify your API key in
app/.env.local - Check if key is valid at https://aistudio.google.com/app/apikey
- Ensure you're using
gemini-2.5-flashmodel - Check browser console for detailed error logs
- Make sure wallet extension is installed
- Check if wallet is set to Devnet
- Try disconnecting and reconnecting
- Clear browser cache
# Reset test validator
solana-test-validator --reset
# Rebuild and deploy
anchor build
anchor deploy- Ensure wallet has SOL for transaction fees
- Airdrop SOL:
solana airdrop 2(on devnet) - Check if Metaplex program is available
- Verify connection to Solana network
If you get "Module not found" errors related to tutor_project.json:
- Make sure IDL is synced:
cd app
./sync-idl.bat # Windows
./sync-idl.sh # Linux/Mac-
Verify IDL file exists:
- Check that
app/lib/idl/tutor_project.jsonexists - If missing, rebuild contracts:
anchor build - Then sync IDL again
- Check that
-
Clear Next.js cache:
cd app
rm -rf .next
npm run build| Variable | Description | Required | Default |
|---|---|---|---|
NEXT_PUBLIC_SOLANA_RPC_ENDPOINT |
Solana RPC URL | Yes | https://api.devnet.solana.com |
GEMINI_API_KEY |
Google Gemini API key | Yes | - |
- Push code to GitHub
- Import project in Vercel (select the
appdirectory as root) - Add environment variables:
NEXT_PUBLIC_SOLANA_RPC_ENDPOINTGEMINI_API_KEY
- Deploy
Note: The IDL file is already included in app/lib/idl/. If you redeploy the smart contract, sync the new IDL:
cd app
./sync-idl.bat # Windows
./sync-idl.sh # Linux/Mac- Change Anchor.toml cluster to
mainnet-beta - Build:
anchor build - Deploy:
anchor deploy --provider.cluster mainnet - Copy new program ID from deployment
- Update
app/lib/constants.tswith new PROGRAM_ID - Sync new IDL: Run
cd app && ./sync-idl.bat(Windows) or./sync-idl.sh(Linux/Mac) - Commit and push changes
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License.
- Solana - High-performance blockchain platform
- Anchor - Solana development framework
- Google Gemini - AI capabilities
- Metaplex - NFT standards
- Next.js - React framework
For issues or questions:
- Open an issue on GitHub
- Check PROJECT_COMPLETE.md for detailed documentation
- Review QUICKSTART.md for setup help
Built with ❤️ using Solana, Next.js, and AI
Learn, Earn, and Own Your Achievements on the Blockchain 🎓⚡🏆