A comprehensive blockchain-based education platform built with React, Express.js, MySQL, and Sui blockchain.
- Node.js (v16+)
- MySQL (v8.0+)
- Git
git clone <your-repo-url>
cd educhain# For first-time setup (includes dependencies)
chmod +x setup.sh
./setup.sh
# For team members (after cloning)
chmod +x scripts/setup-team.sh
./scripts/setup-team.sh# Backend configuration
cp backend/.env.example backend/.env
# Edit backend/.env with your settings
# Frontend configuration
cp educhain-frontend/.env.example educhain-frontend/.env
# Edit educhain-frontend/.env with your settings# Terminal 1: Backend
cd backend
npm run migrate # Setup database
npm run dev
# Terminal 2: Frontend
cd educhain-frontend
npm run dev# Check if everything is working
./scripts/health-check.sheduchain/
βββ backend/ # Express.js API server
β βββ src/
β β βββ controllers/ # Route handlers
β β βββ models/ # Database models
β β βββ routes/ # API routes
β β βββ middleware/ # Custom middleware
β β βββ utils/ # Helper functions
β βββ scripts/ # Database migrations
β βββ .env.example # Environment template
βββ educhain-frontend/ # React frontend
β βββ src/
β β βββ components/ # React components
β β βββ contexts/ # React contexts
β β βββ services/ # API services
β β βββ utils/ # Helper functions
β βββ .env.example # Environment template
βββ sources/ # Sui Move contracts
βββ tests/ # Contract tests
βββ setup.sh # Setup automation
# Server
PORT=3001
NODE_ENV=development
# Database
DB_HOST=localhost
DB_USER=your_mysql_user
DB_PASSWORD=your_mysql_password
DB_NAME=educhain_db
# JWT
JWT_SECRET=your_super_secret_key
JWT_EXPIRE=7d
# Blockchain
SUI_RPC_URL=https://fullnode.testnet.sui.io:443
PACKAGE_ID=your_package_id
ADMIN_CAP_ID=your_admin_cap_id
REGISTRY_ID=your_registry_idVITE_API_URL=http://localhost:3001/api
VITE_SUI_RPC_URL=https://fullnode.testnet.sui.io:443
VITE_PACKAGE_ID=your_package_id
VITE_ADMIN_CAP_ID=your_admin_cap_id
VITE_EDUCHAINRegistry=your_registry_id# Verify all services are running
./scripts/health-check.sh# For new team members
./scripts/setup-team.sh# Create feature branch
git checkout -b feature/your-feature-name
# Create bug fix branch
git checkout -b bugfix/issue-description
# Create hotfix branch
git checkout -b hotfix/critical-fix# Feature commits
git commit -m "feat: add user authentication"
# Bug fixes
git commit -m "fix: resolve wallet connection issue"
# Documentation
git commit -m "docs: update API documentation"
# Refactoring
git commit -m "refactor: optimize database queries"- Create PR from your feature branch to
main - Add description with:
- What was changed
- Why it was changed
- How to test
- Request review from team members
- Address feedback and make necessary changes
- Merge after approval
# 1. Clone repository
git clone <repo-url>
cd educhain
# 2. Run setup script
./setup.sh
# 3. Configure environment
cp backend/.env.example backend/.env
cp educhain-frontend/.env.example educhain-frontend/.env
# 4. Edit .env files with personal credentials
# - Database credentials
# - JWT secret
# - API keys (if any)
# 5. Install dependencies
cd backend && npm install
cd ../educhain-frontend && npm install
# 6. Setup database
cd ../backend
npm run migrate
# 7. Start development
npm run dev &
cd ../educhain-frontend && npm run dev# Create MySQL database
mysql -u root -p
CREATE DATABASE educhain_db;
EXIT;
# Run migrations
cd backend
npm run migrate- β
Never commit
.envfiles to Git - β Use strong secrets for JWT and database passwords
- β Document required environment variables
- β
Provide examples in
.env.examplefiles
# Backend must be running for API testing
cd backend && npm run dev
# Test endpoints
curl http://localhost:3001/health
curl http://localhost:3001/api/courses/published# Run migrations
npm run migrate
# Reset database (development only)
mysql -u root -p educhain_db < reset.sql# Backend
cd backend && npm run dev
# Frontend
cd educhain-frontend && npm run dev# Backend
cd backend && npm start
# Frontend (after build)
cd educhain-frontend
npm run build
npm run previewPOST /api/auth/login- User loginGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update profile
GET /api/courses/published- Get published coursesGET /api/courses/:id- Get course details
GET /health- Health check
# Check if port is available
lsof -i :3001
# Check database connection
cd backend && npm run migrate# Ensure backend is running
curl http://localhost:3001/health
# Check API URL in frontend .env
cat educhain-frontend/.env# Test MySQL connection
mysql -u your_user -p -h localhost educhain_db
# Reset database
cd backend && npm run migrate- Issues: Create GitHub issues for bugs/features
- Discussions: Use GitHub discussions for questions
- Documentation: Update this README for improvements
- Run tests:
npm test - Lint code:
npm run lint - Update documentation
- Test API endpoints
- Check environment variables
- Code review completed
- All tests passing
- Documentation updated
- Environment variables documented
- Migration scripts tested
Happy coding! ππ
For detailed API documentation, see backend/README.md and educhain-frontend/README.md.