A fully local AI-powered C programming assistant.
No cloud. No API keys. Runs entirely on your machine via Ollama.
C Code Assistant is a browser-based IDE companion for C programming, powered by locally running LLMs. It can complete, generate, explain, debug, and optimize C code — all without sending anything to the internet.
All Ollama traffic is routed through the Flask backend (localhost proxy), so Ollama never needs to be exposed to any external origin.
| Feature | Description |
|---|---|
| ⚡ Complete | Paste partial C code, get it finished |
| ✨ Generate | Describe in plain English, get working C |
| 📖 Explain | Understand any C code in plain English |
| 🔧 Fix / Debug | Finds and fixes every bug with explanations |
| 🚀 Optimize | Improves performance with Big-O analysis |
| ▶ Compile & Run | Compiles with GCC and runs in the browser |
| 🔍 Lint | Live linting with cppcheck or GCC fallback |
| 🔄 Quality Retry | Output is auto-checked and rewritten if wrong |
| 🤖 Model Switcher | Switch between any installed Ollama model |
| 🕘 History | Session history saved in localStorage |
| ⬇ Export .c | Download code as a .c file |
- Python 3.8+
- Ollama with at least one model pulled
- GCC
- Windows: MinGW-w64 — download, extract, add
bin/to PATH - Linux:
sudo apt install gcc - macOS:
xcode-select --install
- Windows: MinGW-w64 — download, extract, add
- cppcheck (richer linting)
- Windows: cppcheck.sourceforge.io
- Linux:
sudo apt install cppcheck - macOS:
brew install cppcheck
| Model | Size | Pull Command |
|---|---|---|
qwen2.5-coder:1.5b |
~1 GB | ollama pull qwen2.5-coder:1.5b |
deepseek-coder:1.3b |
~776 MB | ollama pull deepseek-coder:1.3b |
qwen2.5-coder:7b |
~4.7 GB | ollama pull qwen2.5-coder:7b |
deepseek-coder:6.7b |
~3.8 GB | ollama pull deepseek-coder:6.7b |
git clone https://github.com/CODExGAMERZ/C-Code-Assistant.git
cd c-code-assistantpython -m pip install flask flask-cors requestsollama pull qwen2.5-coder:1.5bWindows — double-click start.bat or run:
python server.pyLinux / macOS:
bash start.shhttp://localhost:5050
⚠️ Always openhttp://localhost:5050— never openindex.htmldirectly as a file.
Browser (localhost:5050)
│
├── GET / → serves index.html
├── GET /js/*.js → serves JS files
├── GET /css/*.css → serves CSS files
│
├── POST /api/compile → GCC compile & run
├── POST /api/lint → cppcheck / GCC lint
│
└── /api/ollama/* ──proxy──▶ Ollama (localhost:11434)
├── GET /api/ollama/tags
├── POST /api/ollama/chat (streaming)
└── POST /api/ollama/generate
The browser never contacts Ollama directly. All LLM traffic goes through the Flask proxy, so Ollama runs with default settings — no OLLAMA_ORIGINS flag required.
Every response goes through an automatic quality gate:
User clicks Run
│
▼
LLM generates output (streamed live)
│
▼
Quality checker reviews:
- Valid C code in fenced block?
- No unresolved TODO / placeholder?
- No type errors (int passed as char*)?
- All functions complete?
│
pass ──▶ Show output ● green
│
fail ──▶ Retry with failure reason injected
(up to 2 retries, configurable)
│
▼
Show best result ● amber
c-code-assistant/
├── index.html ← App UI
├── server.py ← Flask backend + Ollama proxy
├── start.bat ← Windows launcher
├── start.sh ← Linux/macOS launcher
├── LICENSE
├── README.md
├── .gitignore
├── css/
│ └── style.css ← All styles
└── js/
├── config.js ← Settings & model switcher
├── api.js ← Ollama proxy calls + quality retry
├── app.js ← Main controller
├── compiler.js ← GCC compile & run
├── linter.js ← Live linting
├── editor.js ← Code editor (line nums, tab, indent)
├── output.js ← C syntax highlighter + renderer
└── history.js ← Session history
| Shortcut | Action |
|---|---|
Ctrl+Enter |
Run |
Ctrl+L |
Clear editor |
Ctrl+S |
Export as .c file |
Tab |
Indent 4 spaces |
Shift+Tab |
De-indent |
Ollama shows offline
- Make sure Ollama is running:
ollama serve - The app auto-retries every 12 seconds
Model not found in dropdown
- Pull it:
ollama pull <model-name> - Or select a model you already have
Compile & Run not working
- Install GCC and add it to PATH
- Test with:
gcc --versionin a terminal
Output has bugs / wrong code
- Try a larger model (
qwen2.5-coder:7b) - Lower temperature to
0.1in settings - Increase max retries to
3in settings
- Ollama — local LLM runtime
- Qwen2.5-Coder — by Alibaba Cloud
- DeepSeek-Coder — by DeepSeek AI
- Flask — Python web framework
- cppcheck — C/C++ static analysis
- IBM Plex Mono — editor font
MIT — see LICENSE