AutoHeal is a full-stack SaaS platform that automatically detects CI/CD failures, diagnoses root causes using AI, and generates pull requests with fixes — all without human intervention.
The Command Center: A high-fidelity, interactive hub for autonomous CI
Seamless Control: Manage repository connections and monitor live healing pipelines in real-time via Server-Sent Events (SSE).
AutoHeal 2.0 operates on a weightless, event-driven architecture designed for extreme scalability and cost-efficiency.
graph TD
subgraph "GitHub Ecosystem"
GH_Repo[("Target Repository")]
GH_Actions["GitHub Actions (CI)"]
GH_Webhooks["GitHub Webhooks"]
end
subgraph "AutoHeal 2.0 (Backend)"
API_Gateway["Express API Server"]
Webhook_Handler["Webhook Handler & Mutex"]
Ingestor["Background Ingestion Engine"]
subgraph "AI Core"
RAG["RAG Retrieval (Atlas)"]
AST["AST Parser (Tree-sitter)"]
RCA["AI Root Cause Analysis"]
Fixer["AI Selective Patching"]
end
Git_Ops["Git Operations Hub"]
end
subgraph "Data & AI Layer"
MongoDB[("MongoDB Atlas + Vector Search")]
Groq["Groq (Llama 3.3 70B)"]
Gemini["Google Gemini (Fallback)"]
Xenova["Local Embeddings (WASM)"]
end
subgraph "Frontend"
Dashboard["React Dashboard (SSE Updates)"]
end
GH_Repo -- "Push/Failure" --> GH_Actions
GH_Actions -- "Event: workflow_run" --> GH_Webhooks
GH_Webhooks -- "Secured Payload" --> Webhook_Handler
Webhook_Handler -- "Retrieve Context" --> RAG
RAG -- "Vector Search" --> MongoDB
Webhook_Handler -- "Run RCA" --> RCA
RCA -- "Request Files" --> Git_Ops
Git_Ops -- "Fetch Source" --> GH_Repo
RCA -- "Strategy" --> Fixer
Fixer -- "Generate JSON Patch" --> Groq
Groq -- "Fallback" --> Gemini
Fixer -- "Patch in Memory" --> Git_Ops
Git_Ops -- "Shadow Push" --> GH_Repo
GH_Repo -- "CI Result" --> Webhook_Handler
Webhook_Handler -- "Success" --> Dashboard
Webhook_Handler -- "Failure" --> RCA
Instead of running heavy CI tests locally, AutoHeal offloads 100% of the testing compute infrastructure to GitHub.
- After generating a fix, the backend pushes code to a hidden, temporary branch (
fix/autoheal-...). - GitHub Actions runs the user's native CI suite on this branch.
- AutoHeal intercepts the result via webhooks. If it passes, only then is a PR opened. This ensures developers never see a failing AI PR.
To scale to massive codebases without hitting AI token limits, AutoHeal utilizes Retrieval-Augmented Generation:
- Background Ingestion: When a repo is enabled, a non-blocking worker clones it, parses it via
web-tree-sitter(AST), and extracts individual functions. - Local Embeddings: Code chunks are converted into vectors locally using Xenova Transformers (all-MiniLM-L6-v2) running in WASM—zero API cost.
- Vector Search: During a crash, AutoHeal performs a
$vectorSearchin MongoDB Atlas to surgically find the exact function responsible for the error.
If an AI-generated fix fails validation on the Shadow Branch, the system doesn't give up. It extracts the new error logs, feeds the previous attempt back into the AI as a "failed lesson," and triggers a recursive healing cycle until the code passes all tests.
- 🔐 Enterprise Security — GitHub tokens encrypted with AES-256-GCM; HMAC-signed webhooks.
- 🤖 Multi-Model Fallback — Primary RCA on Groq (Llama 3.3 70B) with instant cascade to Google Gemini 2.0 Flash if rate limits are hit.
- ⚡ Real-Time SSE — Live pipeline status updates pushed to the frontend via Server-Sent Events—no polling needed.
- 🛠️ JSON Selective Patching — AI outputs search/replace blocks instead of full files, slashing token consumption by 90% and preventing indentation errors.
- 🚫 Infinite Loop Protection — Built-in circuit breakers limit executions per repository to prevent runaway CI costs.
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite 6, Framer Motion, Tailwind CSS, Lucide React |
| Backend | Node.js, Express, Passport.js (GitHub OAuth), JWT |
| Database | MongoDB Atlas (Vector Search + Aggregation Pipelines) |
| AI (RCA/Fix) | Groq (Llama-3.3-70b-versatile), Google Gemini 2.0 Flash |
| AI (Embeddings) | Xenova Transformers (WASM), all-MiniLM-L6-v2 |
| Parsing | web-tree-sitter (Abstract Syntax Tree analysis) |
| Real-time | Server-Sent Events (SSE) |
- Node.js 18+
- MongoDB Atlas account (with a Vector Search Index named
vector_index) - GitHub OAuth App
- Groq API key & Gemini API key
- Publicly accessible Backend URL (like Render, or ngrok for local dev)
git clone https://github.com/CodeByAfroj/AutoHeal.git
cd AutoHeal
# Install Backend
cd backend && npm install
# Install Frontend
cd ../frontend && npm installCreate backend/.env:
GITHUB_CLIENT_ID=your_id
GITHUB_CLIENT_SECRET=your_secret
# AI Providers
GROQ_API_KEY=your_key
GEMINI_API_KEY=your_key
# Database
MONGODB_URI=your_atlas_uri
# GitHub App Integration
GITHUB_CLIENT_ID=...
GITHUB_CLIENT_SECRET=...
WEBHOOK_SECRET=...
# Security
JWT_SECRET=...
ENCRYPTION_KEY=... (32-character string for AES-256)Create a Search Index named vector_index on the codechunks collection:
{
"fields": [
{ "numDimensions": 384, "path": "embedding", "similarity": "cosine", "type": "vector" },
{ "path": "repositoryId", "type": "filter" }
]
}AutoHeal/
├── backend/
│ ├── routes/
│ │ ├── webhook.js # Core Event Logic & Shadow Branching
│ │ ├── repos.js # Repo Mgmt & Auto-Webhook Creation
│ │ └── executions.js # SSE status streaming
│ ├── utils/
│ │ ├── ai-fixer.js # RCA & Selective Patching logic
│ │ ├── rag.js # Local Embedding & Vector Search
│ │ ├── ingestor.js # Background Ingestion Worker
│ │ ├── ast.js # Tree-sitter Code Chunking
│ │ └── events.js # Server-Sent Events (SSE) manager
│ └── server.js # Entry Point
├── frontend/
│ └── src/
│ ├── pages/ # Dashboard, Pipelines (Real-time monitoring)
│ └── components/ # High-Fidelity UI components
└── README.md
made with ❤️ by Team CodeImpact