Production-ready backend for Zege V1 - A browser-based IDE with AI support and code execution.
- π JWT Authentication with refresh tokens
- π³ Docker-based Code Execution (9 languages: Python, Node, Java, C/C++, Go, Rust, Ruby, PHP)
- πΎ Backblaze B2 Storage (Free 10GB)
- π€ Google Gemini AI (Free unlimited)
- β‘ Supabase Caching (Free 500MB)
- π MongoDB Atlas for data persistence
- π WebSockets for real-time execution logs
- π‘οΈ Security - Rate limiting, helmet, CORS
- π¦ Production Ready with Docker Compose
All documentation is now organized in the /docs folder!
To Deploy Right Now:
- π PORTAINER_QUICK_REFERENCE.md - Copy-paste config
- π DEPLOY_TO_VPS.md - Upload code to VPS
To Understand the Project:
- π START_HERE_HYBRID.md - Architecture overview
- π MIGRATION_SUMMARY.md - What changed
See /docs/README.md for complete documentation index.
- VPS with Docker installed
- Portainer GUI installed
- Git or SCP access to VPS
cd backend# See docs/DEPLOY_TO_VPS.md for detailed instructions
# Option A: Git
git clone https://github.com/YOUR_USERNAME/zege-backend.git
# Option B: SCP
scp -r ./backend your-user@your-vps-ip:/opt/zege-backendOpen docs/PORTAINER_QUICK_REFERENCE.md and follow the copy-paste instructions!
Test your deployment:
curl http://your-vps-ip:5000/health| Component | Technology | Tier |
|---|---|---|
| Runtime | Node.js 18 + Express | Backend |
| Database | MongoDB Atlas | Cloud (Free) |
| Storage | Backblaze B2 | Cloud (Free 10GB) |
| AI | Google Gemini Pro | Cloud (Free) |
| Caching | Supabase | Cloud (Free 500MB) |
| Code Execution | Docker + Dockerode | Self-hosted |
| Real-time | Socket.IO | Backend |
| Auth | JWT + bcrypt | Backend |
/backend
/docs β π All documentation (organized!)
/src
/config β DB, Logger, Environment
/models β MongoDB schemas
/controllers β Request handlers
/routes β API routes
/services β Docker, B2, Gemini, Supabase
/middlewares β Auth, Validation, Rate limiting
/ws β WebSocket for real-time logs
index.js β Entry point
Dockerfile β Container config
docker-compose.yml β Multi-container setup
.env β Your configuration
- Signup, Login, Logout
- JWT with refresh tokens
- Session management
- CRUD operations
- Version control
- Export/Import (ZIP to B2)
- Execute code (9 languages)
- Real-time logs via WebSocket
- Stop execution
- Supported languages list
- Chat with Gemini
- Code completion (with caching)
- Code explanation
- Error fixing
See docs/API.md for complete API documentation.
β
Helmet.js - Secure headers
β
CORS - Restricted origins
β
Rate Limiting - 100 req/min
β
Input Sanitization - XSS/NoSQL injection protection
β
JWT Authentication - Secure tokens
β
Docker Sandboxing - Isolated execution
β
Password Hashing - bcrypt (12 rounds)
- Account Locking - After 5 failed attempts
Supports 9 languages:
- π Python 3.11
- π Node.js 18
- β Java 17
- βοΈ C/C++ (GCC)
- π· Go 1.21
- π¦ Rust (latest)
- π Ruby 3.2
- π PHP 8.2
- More coming soon!
See docs/DOCKER_EXECUTION_GUIDE.md for details.
curl http://localhost:5000/health
# Expected: {"status":"ok","timestamp":"...","uptime":5.123}# Docker Compose
docker-compose logs -f backend
# Portainer
Containers β zege-backend β Logs tabnpm testAll configuration is in .env file. See .env.example for template.
Key Variables:
MONGODB_URI- MongoDB Atlas connectionB2_APPLICATION_KEY_ID- Backblaze B2 credentialsGEMINI_API_KEY- Google Gemini API keySUPABASE_URL- Supabase project URLJWT_*- Authentication secrets
See docs/QUICK_START_FREE.md for how to get free API keys.
| Endpoint | Limit |
|---|---|
| General API | 100 req/min |
| Auth | 5 req/min |
| Code Execution | 10 req/min |
| AI Requests | 20 req/min |
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open Pull Request
MIT License - See LICENSE file for details
- Check
/docsfolder for guides - Read PORTAINER_QUICK_REFERENCE.md for deployment
- Create an issue for bugs/questions
Built with β€οΈ using free-tier services