https://github.com/sabithulla-16/codeforge
CodeForge is a React-based AI-powered coding platform featuring a Monaco editor, live terminal execution, Google & Ollama AI integration, smart token management, and real-time usage analytics.
https://github.com/sabithulla-16/codeforge
ai-assistant ai-code-editor c code-execution cpp developer-tools google-ai javascript monaco-editor ollama online-compiler python react token-analysis web-ide
Last synced: 2 days ago
JSON representation
CodeForge is a React-based AI-powered coding platform featuring a Monaco editor, live terminal execution, Google & Ollama AI integration, smart token management, and real-time usage analytics.
- Host: GitHub
- URL: https://github.com/sabithulla-16/codeforge
- Owner: Sabithulla-16
- License: apache-2.0
- Created: 2025-12-22T07:56:53.000Z (4 days ago)
- Default Branch: main
- Last Pushed: 2025-12-22T14:06:39.000Z (4 days ago)
- Last Synced: 2025-12-23T19:49:23.687Z (2 days ago)
- Topics: ai-assistant, ai-code-editor, c, code-execution, cpp, developer-tools, google-ai, javascript, monaco-editor, ollama, online-compiler, python, react, token-analysis, web-ide
- Language: JavaScript
- Homepage:
- Size: 2.73 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Notice: NOTICE
Awesome Lists containing this project
README






# ⚡ CodeForge — AI-Powered Code Editor & Execution Platform
CodeForge is a **modern AI-powered coding platform** built with **React** that combines a real code editor, compiler/runtime, AI assistant, token-aware usage analytics, and smart safety controls — all in one place.
It is designed for **students, developers, and learners** who want clarity, control, and transparency while coding with AI.
---
## 📌 CodeForge & Its Functions
CodeForge provides:
- 🧠 **AI-assisted coding**
- Explain code
- Explain errors
- Optimize code
- Convert code between languages
- Custom AI prompts
- 🧑💻 **Multi-language editor**
- JavaScript
- Python
- C
- C++
- ▶️ **Real-time code execution**
- Compile + run flow for C/C++
- Direct execution for JS & Python
- Interactive input handling
- 📊 **AI token usage tracking**
- Google & Ollama usage meters
- Per-response token history
- Combined usage graphs
- 🔒 **AI safety controls**
- Token-based cooldowns
- Session-based Google lock
- Auto-switching between providers
---
## 🛠 Implementation
### Frontend
- Built using **React (Create React App)**
- Monaco Editor (VS Code engine)
- Custom Radeon-style dark UI
- Chart.js for visual analytics
### Backend
- Node.js server
- WebSocket-based code execution
- AI routing and token estimation logic
### AI Providers
- **Google AI (Cloud-based)**
- **Ollama (Local / Offline)**
---
## 📦 Resources Used
- React
- Monaco Editor
- Chart.js
- WebSockets
- Node.js
- Google AI API
- Ollama
- Custom CSS (no UI frameworks)
---
## ⚔️ How CodeForge Is Different From Other Editors
| Feature | CodeForge | Other Editors |
|------|---------|--------------|
| Token visibility | ✅ Yes | ❌ Hidden |
| AI usage graphs | ✅ Yes | ❌ No |
| Google AI auto-lock | ✅ Yes | ❌ No |
| Ollama fallback | ✅ Yes | ❌ Rare |
| Compile vs Run logic | ✅ Correct | ❌ Mixed |
| Session-based limits | ✅ Yes | ❌ No |
| Transparent AI cost | ✅ Yes | ❌ No |
---
## 📸 Screenshots
### 🧑💻 Code Editor & Terminal
**JavaScript**

**Python**

**C**

**C++**

---
### 🤖 AI Assistant
**Google AI Provider**

**Ollama (Local AI)**

---
### 📊 Token Usage Analytics
**Per-Response Token Usage**

**Combined Token Usage Graph**

---
## 🚀 How to Use It
### Requirements
- Node.js ≥ 18
- npm ≥ 9
- Git
### Installation
```bash
git clone https://github.com/Sabithulla-16/CodeForge.git
cd CodeForge
npm install
```
### Run Frontend
```bash
npm start
```
Runs at:
http://localhost:3000
### Run Backend
```bash
cd backend
node server.js
```
Runs at:
http://localhost:5000
---
## 🧠 AI Providers Setup
### 🔹 Ollama (Local AI)
- Official Site: [https://ollama.com](https://ollama.com)
- Documentation: [https://ollama.com/docs](https://ollama.com/docs)
- GitHub: [https://github.com/ollama/ollama](https://github.com/ollama/ollama)
### Pull a Model
```bash
ollama pull qwen2.5-coder:0.5b
ollama serve
```
### 🔹 Google AI (Cloud)
- Google AI Studio: [https://aistudio.google.com](https://aistudio.google.com)
- Google Cloud Console: [https://console.cloud.google.com](https://console.cloud.google.com)
- Generative AI Docs: [https://ai.google.dev](https://ai.google.dev)
---
### Google API Key Generation
1. Open [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project
3. Enable **Generative AI API**
4. Go to **APIs & Services → Credentials**
5. Click **Create API Key**
6. Add key to backend .env
```bash
GOOGLE_API_KEY=your_api_key_here
```
---
### ✅ Advantages
- No hidden AI costs
- Clear compile/run behavior
- Offline AI support (Ollama)
- Beginner-friendly UI
- Visual understanding of AI usage
- Safe usage controls
---
### 🧠 Advancements Used
- Session-based AI governance
- Dynamic token estimation
- Cooldown-based AI throttling
- Auto AI provider switching
- Per-response analytics visualization
- Real-time WebSocket execution
---
### 🔬 New Logics Implemented
1. 🔢 Token Estimation Logic
- 1 token ≈ 4 characters
- Pre-request estimation
- Post-response reconciliation
2. 🔒 Google AI Lock Logic
- 4000 tokens → cooldown (120s)
- 10 high-usage responses → session lock
- Auto fallback to Ollama
3. 🔁 Smart AI Routing
- Payload size & token checks
- Google → Ollama auto-switch
- User transparency messages
4. 📊 Usage Analytics
- Per-response token logging
- Provider-separated graphs
- Combined usage visualization
---
### 🔮 Future Upgrades
- Authentication & profiles
- Persistent usage history
- Cost estimation ($)
- More languages (Java, Rust, Go)
- AI debugging mode
- Export usage reports
- Cloud deployment support
---
### 👨💻 Developer Info
- Project Name: CodeForge
- Developer: Sabithulla
- Role: Student / Full Stack Developer
- Purpose: Learning, transparency, and safe AI-assisted coding
---