Skip to content

JayeshRajbhar/CodeHealth-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

418 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeHealth-AI

An AI-powered platform for continuous repository health analysis, observability, and proactive developer insights.


Project Overview

CodeHealth-AI is a developer-focused platform that provides deep, automated insights into the health, maintainability, and long-term sustainability of software repositories. The platform combines static code analysis, commit behavior analytics, and AI-driven insights to help developers and teams understand where their codebase stands today and what to improve next.

The system is designed to be continuous, automated, and actionable. Once a repository is connected, CodeHealth-AI continuously re-analyzes the project on every push or pull request, tracks trends over time, and notifies users when important quality thresholds are breached.


Live Links

  • Live Website: [Add Live Website URL Here]
  • GitHub Repository: [Add GitHub Repository URL Here]

Team and Responsibilities

This project was built and maintained by a two-member team:

Kalash Thakare

  • Complete backend architecture and implementation
  • Metric design, scoring algorithms, and data modeling
  • GitHub integrations, background workers, alerts, and automation

Jayesh Rajbhar

  • Complete frontend architecture, implementation, and production deployment
  • UI/UX design, interactive dashboards, and data visualizations
  • Automated CI/CD pipelines and cross-service integration
  • Production environment setup and configuration

Technology Stack

Frontend

Technology Version Purpose
Next.js 15.4.10 Application framework with App Router
React 19.1.0 UI component library
TypeScript 5.x Type-safe development
Zustand 5.0.7 State management
Recharts 3.5.1 Line charts and metric graphs
D3.js 7.9.0 Advanced visualizations (radar, heatmaps)
Chart.js 4.5.1 Gauge and distribution charts
GSAP 3.13.0 Animations and transitions
Socket.io-client 4.8.1 Real-time communication
Tailwind CSS 4.x Utility-first CSS framework
Axios 1.11.0 HTTP client

Backend and Infrastructure

Technology Purpose
Node.js + Express Core API layer
Redis Caching, queues, and real-time metric storage
BullMQ Distributed job queue for async analysis
Supabase Database and authentication support
Python + FastAPI Advanced code analysis engine
Socket.io Real-time bidirectional communication

Deployment Architecture & Production Readiness

The system is deployed across four independent servers, managed via a sophisticated CI/CD pipeline that ensures scalability, isolation, and seamless delivery.

Infrastructure Overview

Service Platform Purpose
Frontend Vercel Next.js SSR application with Edge caching
Backend API Heroku Express.js REST API (horizontally scaled)
Background Workers Heroku BullMQ job processing (isolated dynos)
Python Analysis Server Heroku FastAPI code analysis engine

Engineering for Production

The transition from a development environment to a distributed production infrastructure required focused engineering efforts to ensure operational excellence.

Backend Optimizations

  • Production Hardening: Building upon the robust core architecture, targeted optimizations were implemented to align the system with distributed production constraints.
  • Concurrency Management: Fine-tuned database connection pooling and resource limits to handle high-concurrency environments reliably.
  • Resilient Processing: Hardened error recovery strategies and configured the asynchronous job processing system to sustain peak analysis loads without failure.

Frontend & Delivery

  • Performance Tuning: Optimization of the Vercel deployment pipeline to leverage aggressive caching strategies and Edge capabilities.
  • SSR Optimization: Enhanced Server-Side Rendering (SSR) configuration to ensure fast First Contentful Paint (FCP) and optimal SEO.
  • Unified CI/CD: Integrated workflows that orchestrate seamless deployments across both frontend and backend services, ensuring reliability and professional standards.

User Flow

1. Authentication

Users can sign up or log in using GitHub OAuth or Google OAuth. After authentication, the user is redirected to the Dashboard.

2. Repository Connection

From the dashboard, users can connect their GitHub repositories, select a repository and branch, and initialize analysis. Once initialized, CodeHealth-AI performs a full repository scan.

3. Initial Repository Analysis

After initialization, users receive a comprehensive analysis including:

  • Overall Code Health Score
  • Technical Debt Score
  • SLOC (Source Lines of Code)
  • Days Active and Commit Activity
  • Top Refactoring Targets

This analysis is visualized through interactive dashboards.


Core Metrics Explained

1. Code Health Score (Overall)

The Code Health Score is a composite score (0-100) that represents the overall sustainability of a repository.

It is computed using four weighted dimensions:

Dimension Weight
Code Quality 45%
Development Activity 25%
Bus Factor 15%
Community 15%

The final score is soft-graded into categories:

  • Excellent (85+)
  • Good (70-84)
  • Fair (55-69)
  • Needs Improvement (40-54)
  • Critical (<40)

2. Code Quality Score (45%)

Code Quality is calculated using static code analysis metrics aggregated at repository level:

a. Maintainability Index

  • Indicates how easy the code is to understand and modify
  • Higher values = better maintainability

b. Cyclomatic Complexity

  • Measures logical complexity of code paths
  • Penalized as complexity increases

c. Technical Debt (Risk Score)

Each file receives a Risk Score based on:

  • Cyclomatic Complexity
  • Halstead Volume (cognitive load)
  • Maintainability Index
  • Source Lines of Code (LOC)

3. Technical Debt Score

Technical Debt represents the average risk score across all files:

  • Lower debt = easier future development
  • Used to estimate refactoring effort (days), cost impact, and files requiring attention

4. Development Activity (25%)

This score evaluates how actively and consistently the repository is being developed.

Measured using:

  • Commits in last 30 days (logarithmic scaling)
  • Average commits per day
  • Active days ratio
  • Consistency score

Velocity trends: Increasing, Stable, Decreasing, or Insufficient data

5. Bus Factor (15%)

Bus Factor measures knowledge concentration risk.

Risk levels:

  • Low: Healthy contributor distribution
  • Medium: Few dominant contributors
  • High: Project depends heavily on one contributor

6. Community Score (15%)

Community reflects external adoption and engagement:

  • GitHub Stars
  • Forks
  • Watchers

Metrics are logarithmically scaled to avoid bias toward large projects.


Observability Dashboard

The Observability Tab provides continuous monitoring:

  • Code Health Score over time
  • Code Quality Score over time
  • Push and Pull activity metrics
  • Pull request velocity and throughput
  • Reviewer performance tracking
  • Activity heatmaps
  • Stale PR identification
  • Custom alert rule configuration

This allows users to track trends, not just snapshots.


Automated Re-Analysis

CodeHealth-AI is fully automated:

  • Every push or pull request triggers a background job
  • Repository is re-analyzed
  • Metrics are recalculated
  • Dashboards update in real time

This ensures insights are always up-to-date.


Alerts and Notifications

Users can configure custom alerts:

  • Select a metric (e.g., Code Health Score)
  • Define a threshold and operator

When an activity causes the metric to breach the threshold:

  • In-app notification is triggered
  • Email notification is sent

This enables proactive quality control instead of reactive debugging.


AI Insights

In addition to raw metrics, the platform provides AI-generated insights:

  • Human-readable summaries of repository state
  • Explanations of risks and strengths
  • Actionable recommendations for improvement
  • Code smell detection and categorization
  • Quick wins with estimated effort
  • Architectural recommendations

These insights help developers understand why a score changed and decide what to refactor next.


Executive Summary Section

For decision-makers, CodeHealth-AI generates:

  • Key strengths
  • Areas for improvement
  • Overall bottom-line recommendation

This makes the platform suitable for individual developers, development teams, and technical leads.


Conclusion

CodeHealth-AI bridges the gap between raw static analysis tools and actionable engineering insights. By combining continuous analysis, observability, AI explanations, and alerting, it helps developers maintain healthy, scalable, and sustainable codebases over time.

The platform is designed to grow with the repository, providing value from early-stage projects to mature codebases.


Built by Kalash Thakare and Jayesh Rajbhar

About

Copy of the original project to showcase in my github profile

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors