The AI engine that analyzes your codebase, applies smart changes, and creates pull requests automatically.
- Accepts a GitHub repo URL
- Clones the repo into a local sandbox
- Analyzes the code using AI
- Applies smart improvements
- Automatically opens a Pull Request with the changes
- Allows the repo owner to guide the AI mid-process via chat
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB (Mongoose)
- Realtime: Socket.io
- AI: DeepSeek / OpenRouter / Qwen / Puter (fallback order)
- Vector DB: Pinecone
- Version Control Automation: GitHub API
backend/
├── analysis/
│ ├── repoAnalyzer.js # Reads repo files, saves folder structure as .txt
│ ├── aiEngine.js # Sends code to AI, gets suggestions
│ └── changeApplier.js # Applies AI suggestions to code
├── controllers/
│ ├── agentController.js # Main agent logic
│ └── chatController.js # Owner guidance/chat logic
├── models/
│ ├── Chat.js # Chat session data
│ ├── Job.js # Job tracking
│ ├── Lesson.js # AI lessons learned
│ ├── Log.js # Logs for each job
│ └── repoModel.js # Repo data and analysis status
├── routes/
│ ├── agentRoutes.js # Agent API routes
│ ├── chatRoutes.js # Chat API routes
│ └── jobRoutes.js # Job status routes
├── services/
│ ├── githubService.js # GitHub API: clone, branch, commit, PR
│ ├── aiService.js # AI API connection
│ ├── cronService.js # Scheduled jobs
│ └── vectorService.js # Pinecone vector DB
├── sandbox/ # Where repos are cloned and worked on
├── .env # Your environment variables
├── .env.example # Template for .env
└── server.js # Entry point
git clone https://github.com/QuantumLogicsLabs/HackingTheRepo-Backend.git
cd HackingTheRepo-Backendnpm installcp .env.example .envThen fill in your actual keys in .env:
GITHUB_TOKEN— GitHub Personal Access TokenDEEPSEEK_API_KEY— DeepSeek API KeyPINECONE_API_KEY— Pinecone API KeyMONGO_URI— MongoDB connection string
node server.jsServer runs on port 5000 by default.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/status |
Check if server is running |
| POST | /api/agent/analyze |
Submit a repo for analysis |
| POST | /api/agent/apply |
Apply AI suggestions |
| POST | /api/chat |
Send guidance to AI |
| GET | /api/jobs/:id |
Get job status |
Owner submits repo URL
↓
AI clones repo into sandbox/
↓
repoAnalyzer saves folder structure as .txt
↓
aiEngine analyzes code and suggests improvements
↓
Owner guides AI via chat if needed
↓
changeApplier applies changes
↓
githubService opens PR automatically
↓
Owner reviews and accepts PR ✅
Built by TeamAlpha — QuantumLogicsLabs