A research-backed, self-improving AI code generation platform that learns from every interaction
Features β’ Quick Start β’ Architecture β’ Tech Stack β’ Documentation
CodeForge is an advanced AI-powered code generation platform that doesn't just generate codeβit learns and improves from every interaction. Built on cutting-edge research in meta-learning, curriculum learning, and multi-agent systems, CodeForge represents the next generation of AI development tools.
- π§ Self-Learning System: Implements advanced reflexion, curriculum learning, and meta-learning to continuously improve
- π€ Multi-Agent Architecture: Specialized AI agents (Manager, Generator, Reviewer, Analyzer) work together using Google's A2A protocol
- π Secure Execution: Integrated Daytona Sandbox for safe code testing
- π Real-Time Analytics: Comprehensive dashboard tracking learning progress, patterns, and performance
- π‘ Pattern Recognition: Automatically extracts and reuses successful code patterns
- π¨ Beautiful UI: Modern, responsive interface built with React 19 and Tailwind CSS
- π¨ AI Code Generation: Generate complete web applications from natural language descriptions
- π Self-Improvement: System learns from successes and failures, improving over time
- π§ͺ Automated Testing: Daytona Sandbox integration for secure code execution
- π Learning Analytics: Advanced metrics on curriculum progress, meta-learning, and efficiency
- π¬ AI Assistant: Integrated CopilotKit for conversational help
- π Dark Mode: Seamless theme switching for comfortable coding
- Surface-level analysis of successes/failures
- Causal reasoning about what led to outcomes
- Counterfactual thinking ("what if" scenarios)
- Pattern discovery across generations
- Progressive difficulty levels (Beginner β Research)
- Adaptive task suggestions based on mastery
- Focus area identification
- Performance tracking by category
- Strategy performance tracking (Imitation, Exploration, Refinement, Transfer, Composition)
- Domain mastery assessment
- Learning efficiency optimization
- Cross-domain transfer learning
- Short-term (recent experiences)
- Mid-term (consolidating patterns)
- Long-term (proven strategies)
- Reflective insights layer
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Manager Agent β
β β’ Orchestrates workflow β
β β’ Coordinates other agents β
β β’ Makes high-level decisions β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββΌββββββββββ¬ββββββββββββββ
βΌ βΌ βΌ βΌ
βββββββ βββββββ βββββββββββ ββββββββββββ
βCode β βCode β β Pattern β βSelf-Learnβ
βGen β βReviewβ βAnalyzer β β Engine β
βββββββ βββββββ βββββββββββ ββββββββββββ
User Input β Manager Agent β Code Generator Agent
β
Technical Plan
β
Code Generation (Gemini Flash)
β
Code Reviewer Agent
β
Pattern Analyzer Agent
β
Self-Learning System
β
[Memory, Curriculum, Meta-Learning, Reflexion]
β
Improved Future Generations
- Python 3.13 - Core language
- FastAPI - High-performance async web framework
- Google Gemini Flash Latest - AI code generation
- MongoDB - NoSQL database (Motor async driver)
- Daytona Sandbox - Secure code execution
- WebSocket - Real-time updates
- Pydantic - Data validation
- React 19 - Latest React with concurrent features
- Tailwind CSS - Utility-first styling
- Shadcn UI - Beautiful component system
- Radix UI - Accessible primitives
- Framer Motion - Smooth animations
- Recharts - Data visualization
- CopilotKit - AI assistant integration
- Axios - HTTP client
- Google Gemini API - Code generation
- Custom Learning Frameworks:
- Advanced Reflexion
- Curriculum Learning
- Meta-Learning Engine
- Hierarchical Memory
- NumPy - Statistical analysis
- Daytona Cloud - Sandbox execution
- MongoDB Atlas - Database hosting (production)
- Vercel/AWS - Deployment ready
- Python 3.13+
- Node.js 18+
- MongoDB (local or Atlas)
- Google AI Studio API Key
- Daytona API Key (optional)
- Clone the repository
git clone https://github.com/nihalnihalani/SelfCoding.git
cd SelfCoding- Set up environment variables
Create backend/.env:
GEMINI_API_KEY=your_google_ai_studio_api_key
DAYTONA_API_KEY=your_daytona_api_key
MONGO_URL=mongodb://localhost:27017
DB_NAME=codeforge
CORS_ORIGINS=http://localhost:3000Create frontend/.env:
REACT_APP_BACKEND_URL=http://localhost:8000
REACT_APP_DAYTONA_API_KEY=your_daytona_api_key- Install dependencies
# Backend
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Frontend
cd ../frontend
npm install- Start the application
# Terminal 1 - Backend
cd backend
source venv/bin/activate
python -m uvicorn server:app --reload --host 0.0.0.0 --port 8000
# Terminal 2 - Frontend
cd frontend
npm start- Open your browser
http://localhost:3000
- Go to the Generate tab
- Enter: "Create a counter button with red background"
- Click Generate App
- Watch the AI generate, review, and improve the code!
POST /api/generate
Content-Type: application/json
{
"description": "Create a todo list app",
"use_thinking": true,
"auto_test": true,
"max_iterations": 3
}GET /api/self-learning/comprehensive-report
Response: {
"overall_learning_score": 73.5,
"score_breakdown": [...],
"curriculum_progress": {...},
"meta_learning_insights": {...},
"recommendations": [...]
}GET /api/patterns
Response: {
"total_patterns": 25,
"patterns": [{
"category": "ui_components",
"usage_count": 12,
"success_rate": 0.92
}]
}const ws = new WebSocket('ws://localhost:8000/ws');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Update:', data);
};For complete API documentation, visit: http://localhost:8000/docs (Swagger UI)
The system calculates an overall learning score (0-100) based on:
- Curriculum Mastery (30%): Task completion and mastery rates
- Memory Performance (25%): Pattern recognition and reuse
- Reflection Quality (20%): Depth of self-analysis
- Learning Velocity (25%): Improvement rate over time
- Tasks Attempted/Mastered: Track learning progress
- Success Rate: Overall generation success
- Strategy Performance: Which learning strategies work best
- Domain Mastery: Skill levels in different areas (UI, Data Viz, APIs, etc.)
- Learning Velocity: Quality improvement per hour
cd backend
pytestcd frontend
npm test# Test code generation
curl -X POST http://localhost:8000/api/generate \
-H "Content-Type: application/json" \
-d '{"description":"Create a button","use_thinking":false}'
# Test self-learning data
curl http://localhost:8000/api/self-learning/comprehensive-reportComprehensive documentation is available in the /docs folder:
- PROJECT_OVERVIEW.md - Complete project guide (952 lines)
- A2A_ARCHITECTURE.md - Multi-agent system details
- ADVANCED_SELF_LEARNING.md - Learning framework details
- TECHNOLOGY_STACK.md - Full tech stack breakdown
- SETUP_API_KEY.md - API key configuration guide
Real-time learning analytics and metrics
AI-powered code generation with live updates
Comprehensive learning progress tracking
Automatically extracted code patterns
CodeForge implements several cutting-edge research papers:
-
Reflexion: Language Agents with Verbal Reinforcement Learning
- Multi-level self-reflection
- Causal and counterfactual reasoning
-
Curriculum Learning
- Progressive difficulty scaling
- Adaptive task selection
-
Model-Agnostic Meta-Learning (MAML)
- Fast adaptation to new tasks
- Strategy optimization
-
Hierarchical Memory Networks
- Multi-tier memory consolidation
- Confidence-weighted pattern storage
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
pytestandnpm test) - Commit (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing-feature) - Open a Pull Request
Issue: GEMINI_API_KEY not configured
- Solution: Get an API key from Google AI Studio and add it to
backend/.env
Issue: MongoDB connection failed
- Solution: Ensure MongoDB is running (
mongod) or updateMONGO_URLin.env
Issue: Frontend can't connect to backend
- Solution: Check that backend is running on port 8000 and
REACT_APP_BACKEND_URLis correct
Issue: Import errors in Python
- Solution: Activate virtual environment:
source venv/bin/activate
For more help, see our FAQ or open an issue.
This project is licensed under the MIT License - see the LICENSE file for details.
This project was built for [Hackathon Name] showcasing:
- β Google Gemini Flash Latest integration
- β Multi-agent architecture with A2A protocol
- β Daytona Sandbox for secure execution
- β Research-backed self-learning algorithms
- β Production-ready, scalable architecture
CodeForge was created by passionate developers who believe AI should continuously learn and improve.
- Lead Developer: [Your Name]
- GitHub: @nihalnihalani
- Google for the Gemini API
- Daytona for secure sandbox execution
- Research Papers that inspired our learning frameworks
- Open Source Community for amazing tools and libraries
- GitHub Issues: Report a bug
- Email: [email protected]
- Discord: Join our community
β Star this repo if you find it helpful! β
Made with β€οΈ using Google Gemini, React, and FastAPI