Last Updated: May 12, 2026
Status: Ready for Production Deployment
- Prerequisites
- Backend Deployment
- Frontend Deployment
- Environment Configuration
- Database Setup
- Blockchain Setup
- Post-Deployment Checks
- Monitoring & Maintenance
- Node.js 18+ (for frontend)
- Python 3.10+ (for backend)
- MongoDB 4.4+ (database)
- Foundry/Anvil or Ethereum RPC endpoint (blockchain)
- Git
- PM2 or systemd (process manager)
- Nginx or Apache (reverse proxy)
- SSL/TLS certificates (HTTPS)
- Backend: Heroku, DigitalOcean, AWS, GCP, or self-hosted VPS
- Frontend: Vercel, Netlify, or static hosting
- Database: MongoDB Atlas, AWS DocumentDB, or self-hosted
- Blockchain: Alchemy, Infura, or self-hosted node
npm install -g heroku
heroku logincd backend
cat > Procfile << 'EOF'
web: python main.py
EOFpip freeze > requirements.txtheroku create openlearnx-backend
git push heroku main
# Set environment variables
heroku config:set FLASK_ENV=production
heroku config:set MONGODB_URI=<your-mongodb-uri>
heroku config:set WEB3_PROVIDER_URL=<your-rpc-endpoint>
heroku config:set CONTRACT_ADDRESS=<deployed-contract-address>
heroku config:set SECRET_KEY=<secure-random-key>
heroku config:set JWT_SECRET_KEY=<secure-jwt-key>heroku logs --tailssh root@your-server-ipapt update && apt upgrade -y
apt install -y python3.10 python3-pip python3-venv nginx git mongodbcd /var/www
git clone https://github.com/th30d4y/OpenLearnX.git
cd OpenLearnX/backendpython3 -m venv venv
source venv/bin/activate
pip install -r ../requirements.txtcat > .env << 'EOF'
FLASK_ENV=production
SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))')
MONGODB_URI=mongodb://localhost:27017/openlearnx
WEB3_PROVIDER_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY
CONTRACT_ADDRESS=0x...
JWT_SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))')
EOFnpm install -g pm2
pm2 start "python3 main.py" --name openlearnx-backend
pm2 startup
pm2 savecat > /etc/nginx/sites-available/openlearnx-backend << 'EOF'
server {
listen 80;
server_name api.openlearnx.com;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
EOF
ln -s /etc/nginx/sites-available/openlearnx-backend /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginxapt install -y certbot python3-certbot-nginx
certbot --nginx -d api.openlearnx.com- Go to https://vercel.com
- Import GitHub repository
- Select
frontendas root directory
NEXT_PUBLIC_API_URL=https://api.openlearnx.com
NEXT_PUBLIC_CHAIN_ID=1
NEXT_PUBLIC_CONTRACT_ADDRESS=0x...
NEXT_PUBLIC_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY
git push origin main
# Vercel will automatically deploy on push- Go to https://netlify.com
- Import GitHub repository
- Select
frontendas publish directory
- Build command:
pnpm install && pnpm build - Publish directory:
.next
NEXT_PUBLIC_API_URL=https://api.openlearnx.com
NEXT_PUBLIC_CHAIN_ID=1
NEXT_PUBLIC_CONTRACT_ADDRESS=0x...
NEXT_PUBLIC_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY
ssh root@your-server-ipcurl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
apt install -y nodejs
npm install -g pnpmcd /var/www
git clone https://github.com/th30d4y/OpenLearnX.git
cd OpenLearnX/frontendpnpm install
pnpm buildpm2 start "pnpm start" --name openlearnx-frontend
pm2 startup
pm2 savecat > /etc/nginx/sites-available/openlearnx-frontend << 'EOF'
server {
listen 80;
server_name openlearnx.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
EOF
ln -s /etc/nginx/sites-available/openlearnx-frontend /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginxcertbot --nginx -d openlearnx.comFLASK_ENV=production
DEBUG=False
SECRET_KEY=<secure-random-32-char-key>
JWT_SECRET_KEY=<secure-jwt-key>
# Database
MONGODB_URI=mongodb+srv://user:password@cluster.mongodb.net/openlearnx
# Blockchain
WEB3_PROVIDER_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY
CONTRACT_ADDRESS=0x<deployed-contract-address>
# Security
CORS_ORIGINS=https://openlearnx.com,https://www.openlearnx.com
ADMIN_TOKEN=<secure-admin-token>
# Optional: Email configuration
MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-passwordNEXT_PUBLIC_API_URL=https://api.openlearnx.com
NEXT_PUBLIC_CHAIN_ID=1
NEXT_PUBLIC_CONTRACT_ADDRESS=0x<contract-address>
NEXT_PUBLIC_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY- Go to https://mongodb.com/cloud/atlas
- Create account and new cluster
- Add database user with strong password
- Whitelist IP addresses
- Get connection string:
mongodb+srv://user:pass@cluster.mongodb.net/openlearnx
# Install MongoDB
apt install -y mongodb-org
# Start service
systemctl start mongod
systemctl enable mongod
# Create database and user
mongosh
use openlearnx
db.createUser({
user: "openlearnx",
pwd: "secure-password",
roles: ["readWrite"]
})- Go to https://alchemy.com
- Create account and new app
- Select Ethereum mainnet (or testnet)
- Get API key:
https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY
- Go to https://infura.io
- Create account and new project
- Select Ethereum mainnet
- Get API key:
https://mainnet.infura.io/v3/YOUR-API-KEY
# Deploy smart contract to mainnet
cd backend
source venv/bin/activate
# Update WEB3_PROVIDER_URL to mainnet endpoint
python3 scripts/deploy.py # Deploys to mainnetcurl https://api.openlearnx.com/api/health
curl https://api.openlearnx.com/api/dashboard/comprehensive-stats- Open https://openlearnx.com in browser
- Verify page loads
- Test wallet connection
- Test authentication flow
mongosh
use openlearnx
db.stats()curl -X POST https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0x...","latest"],"id":1}'pm2 monit # Real-time monitoring
pm2 logs # View logs
pm2 restart all # Restart all processes
pm2 stop all # Stop all processestail -f /var/log/nginx/access.log
tail -f /var/log/nginx/error.log# Daily backup to S3
0 2 * * * mongodump --uri="mongodb+srv://..." --archive=/backups/openlearnx-$(date +\%Y\%m\%d).archive# Auto-renewal with Let's Encrypt
certbot renew --dry-run
certbot renew # Runs automatically via cron# Backend
cd backend
source venv/bin/activate
pip install --upgrade pip
pip install -r ../requirements.txt
# Frontend
cd frontend
pnpm update
pnpm buildpm2 logs openlearnx-backend
systemctl status mongodpm2 logs openlearnx-frontend
# Check NEXT_PUBLIC_API_URL environment variable# Test MongoDB connection
mongosh --uri="your-connection-string"certbot renew --force-renewal
systemctl restart nginx- Update
SECRET_KEYandJWT_SECRET_KEYwith secure values - Enable HTTPS with SSL certificates
- Configure firewall rules
- Setup rate limiting on API
- Enable CORS only for your domain
- Rotate API keys regularly
- Setup monitoring and alerting
- Implement database backups
- Use environment variables for secrets
- Enable audit logging
- Update dependencies regularly
- Setup DDoS protection (Cloudflare)
For issues or questions:
- GitHub Issues: https://github.com/th30d4y/OpenLearnX/issues
- Documentation: See DOCUMENTATION.md
- Contact: See README.md for contact info
Deployment Version: 2.0.4
Last Updated: May 12, 2026