π A cutting-edge full-stack application that analyzes GitHub repositories for security threats in real-time using local AI models and advanced threat detection algorithms
|
|
|
|
graph TB
subgraph "Frontend Layer"
A[React Dashboard] --> B[Socket.IO Client]
A --> C[REST API Client]
end
subgraph "Backend Layer"
D[Express Server] --> E[Socket.IO Server]
D --> F[Analysis Engine]
D --> G[AI Service]
end
subgraph "AI Layer"
G --> H[Ollama Server]
H --> I[DeepSeek-R1 Model]
end
subgraph "Data Layer"
F --> J[MongoDB]
F --> K[Job Queue]
end
subgraph "Security Layer"
F --> L[Docker Engine]
L --> M[Node.js Container]
L --> N[Python Container]
end
B -.->|WebSocket| E
C -.->|HTTP/REST| D
style A fill:#61dafb,stroke:#000,color:#000
style D fill:#339933,stroke:#000,color:#fff
style H fill:#ff6b35,stroke:#000,color:#fff
style J fill:#47a248,stroke:#000,color:#fff
style L fill:#2496ed,stroke:#000,color:#fff
π§ Step-by-Step Setup Guide
git clone https://github.com/Mihir-Rabari/code-dog.git
cd code-dog# Install Ollama (if not already installed)
curl -fsSL https://ollama.ai/install.sh | sh
# Pull the DeepSeek-R1 model
ollama pull deepseek-r1:1.5b
# Verify installation
ollama listcd backend
npm install
# Create environment file
cp .env.example .env
# Edit .env with your configurationscd ../frontend
npm install
# Create environment file
cp .env.example .envcd ../docker
docker build -f Dockerfile.node -t threat-detector:node .
docker build -f Dockerfile.python -t threat-detector:python .# Start MongoDB (using Docker)
docker run -d -p 27017:27017 --name codedog-mongo mongo:latest
# Or use MongoDB Atlas (cloud)
# Update your .env file with connection string
cd backend
npm run devServer runs on |
cd frontend
npm run devDashboard runs on |
# Health check
curl http://localhost:5000/health
# Open dashboard
open http://localhost:3000sequenceDiagram
participant U as π€ User
participant F as π₯οΈ Frontend
participant B as βοΈ Backend
participant A as π§ AI Service
participant D as π³ Docker
participant DB as ποΈ Database
U->>F: Enter GitHub URL
F->>B: POST /api/analyze-repo
B->>DB: Create job record
B->>D: Start sandbox container
D->>D: Clone repository
D->>D: Analyze dependencies
D->>A: Send code for AI analysis
A->>A: Process with DeepSeek-R1
A->>B: Return threat assessment
B->>F: WebSocket: Real-time logs
B->>F: WebSocket: Risk score
F->>U: Display results
| Step | Action | Description |
|---|---|---|
| 1οΈβ£ | Input | Enter GitHub repository URL |
| 2οΈβ£ | Configure | Select project type (Node.js/Python) |
| 3οΈβ£ | Analyze | Click "Start Analysis" button |
| 4οΈβ£ | Monitor | Watch real-time logs and progress |
| 5οΈβ£ | Review | Examine risk score and threats |
| 6οΈβ£ | Export | Download detailed security report |
|
|
|
|
π¬ Test Suite Overview
cd backend
npm test # Run all tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests
npm run test:coverage # Coverage reportcd frontend
npm test # Jest + React Testing Library
npm run test:e2e # Cypress end-to-end tests
npm run test:coverage # Coverage report# Test container builds
docker-compose -f docker-compose.test.yml up --build
# Security scan
docker scout cves threat-detector:node| Method | Endpoint | Description | Parameters |
|---|---|---|---|
POST |
/api/analyze-repo |
Start repository analysis | repoUrl, projectType |
GET |
/api/job/:jobId/status |
Get job status | jobId |
GET |
/api/job/:jobId/details |
Get detailed job info | jobId |
GET |
/api/jobs |
List all jobs | limit (optional) |
GET |
/health |
Health check | - |
|
|
π API Examples
curl -X POST http://localhost:5000/api/analyze-repo \
-H "Content-Type: application/json" \
-d '{
"repoUrl": "https://github.com/user/repo",
"projectType": "nodejs"
}'{
"jobId": "job_1234567890_abc123",
"status": "running",
"message": "Analysis started successfully"
}curl http://localhost:5000/api/job/job_1234567890_abc123/statusconst socket = io('http://localhost:5000');
socket.emit('join', 'job_1234567890_abc123');
socket.on('log', (data) => console.log(data));
|
|
Coming soon - Add your amazing dashboard screenshots here!
Add a link to your demo video here
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
- ESLint + Prettier for JavaScript
- Follow existing patterns
- Add JSDoc comments
- Write meaningful commit messages

